diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5fa295d..3d6fd61 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,15 +4,16 @@ stages: variables: COMPOSER_ALLOW_SUPERUSER: '1' -build_prod: +# PREPROD +build_preprod: stage: build only: - - prod + - preprod image: composer:2 script: - apk add --no-cache nodejs npm - npm install - - npm run build + - npm run build:preprod - cd dist - composer install --no-dev --optimize-autoloader --ignore-platform-req=ext-gd - cd .. @@ -24,17 +25,44 @@ build_prod: paths: - node_modules/ -build_preprod: - stage: build +deploy_preprod: + stage: deploy + image: node:latest only: - preprod + before_script: + - apt-get update -qq && apt-get install -y rsync sshpass + script: + - cd dist + - | + rsync_deploy() { + local src=$1 + local dst=$2 + local exclude=$3 + cmd="sshpass -p \"$PASSWORD\" rsync -az --delete -O" + [[ -n $exclude ]] && cmd="$cmd $exclude" + cmd="$cmd -e 'ssh -p 2244 -o StrictHostKeyChecking=no' $src $USERNAME@$HOST:$dst" + echo "$cmd" + eval $cmd + } + + rsync_deploy site/ "$PREPROD_PATH/site/" "--exclude 'accounts/' --exclude 'cache/' --exclude 'sessions/'" + rsync_deploy vendor/ "$PREPROD_PATH/vendor/" + rsync_deploy kirby/ "$PREPROD_PATH/kirby/" + rsync_deploy assets/ "$PREPROD_PATH/assets/" "--exclude 'tiles/'" + +# PROD +build_prod: + stage: build + only: + - prod image: composer:2 script: - apk add --no-cache nodejs npm - npm install - - npm run build:preprod - - cd dist - - composer install --no-dev --optimize-autoloader --ignore-platform-req=ext-gd + - npm run build + - cd dist + - composer install --no-dev --optimize-autoloader --ignore-platform-req=ext-gd - cd .. artifacts: paths: @@ -69,29 +97,3 @@ deploy_prod: rsync_deploy vendor/ "$PROD_PATH/vendor/" rsync_deploy kirby/ "$PROD_PATH/kirby/" rsync_deploy assets/ "$PROD_PATH/assets/" "--exclude 'tiles/'" - -deploy_preprod: - stage: deploy - image: node:latest - only: - - preprod - before_script: - - apt-get update -qq && apt-get install -y rsync sshpass - script: - - cd dist - - | - rsync_deploy() { - local src=$1 - local dst=$2 - local exclude=$3 - cmd="sshpass -p \"$PASSWORD\" rsync -az --delete -O" - [[ -n $exclude ]] && cmd="$cmd $exclude" - cmd="$cmd -e 'ssh -p 2244 -o StrictHostKeyChecking=no' $src $USERNAME@$HOST:$dst" - echo "$cmd" - eval $cmd - } - - rsync_deploy site/ "$PREPROD_PATH/site/" "--exclude 'accounts/' --exclude 'cache/' --exclude 'sessions/'" - rsync_deploy vendor/ "$PREPROD_PATH/vendor/" - rsync_deploy kirby/ "$PREPROD_PATH/kirby/" - rsync_deploy assets/ "$PREPROD_PATH/assets/" "--exclude 'tiles/'" diff --git a/package.json b/package.json index adb73d0..db18c29 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "scripts": { "dev": "vite", "build": "vite build", + "build:preprod": "vite build --mode=staging", "preview": "vite preview" }, "dependencies": { diff --git a/public/site/config/config.php b/public/site/config/config.php index d4505ea..72ea0da 100644 --- a/public/site/config/config.php +++ b/public/site/config/config.php @@ -3,7 +3,7 @@ $regenerateSteps = require_once(__DIR__ . '/hooks/page-update--regenerate-project-steps-cache.php'); return [ - 'debug' => Dir::exists('assets/dist') ? false: true, + 'debug' => $_SERVER['HTTP_HOST'] !== 'designtopack.groupe-pochet.fr', 'cache' => [ 'pages' => [ 'active' => true diff --git a/src/components/Menu.vue b/src/components/Menu.vue index 6b09277..65aa5a3 100644 --- a/src/components/Menu.vue +++ b/src/components/Menu.vue @@ -126,12 +126,13 @@ const { isEmptyBrief } = useProjectStore(); const { page } = storeToRefs(usePageStore()); const unreadNotificationsCount = computed(() => { - if (!user.value) return undefined; - const count = notifications.value.filter( - (notification) => !notification.isRead - ).length; - if (count === 0) return undefined; - return count; + if (!user.value) return 0; + + const count = + notifications.value?.filter((notification) => !notification.isRead) + .length ?? 0; + + return count === 0 ? 0 : count; }); const mainItems = [ @@ -320,7 +321,7 @@ button[aria-controls='menu'][aria-expanded='false'] align-items: center; width: 100%; min-height: 2.5rem; /* 40px */ - padding: .66rem var(--space-16); + padding: 0.66rem var(--space-16); gap: var(--space-12); border-radius: var(--rounded-lg); } diff --git a/src/stores/projects.js b/src/stores/projects.js index c61f052..c372c63 100644 --- a/src/stores/projects.js +++ b/src/stores/projects.js @@ -7,21 +7,27 @@ export const useProjectsStore = defineStore('projects', () => { const projects = ref(null); const currentProjects = computed(() => { - return projects.value - .filter((project) => project.status === 'listed') - .sort((a, b) => new Date(b.modified) - new Date(a.modified)); + return ( + projects.value + ?.filter((project) => project.status === 'listed') + .sort((a, b) => new Date(b.modified) - new Date(a.modified)) ?? [] + ); }); const draftProjects = computed(() => { - return projects.value - .filter((project) => project.status === 'draft') - .sort((a, b) => new Date(b.modified) - new Date(a.modified)); + return ( + projects.value + ?.filter((project) => project.status === 'draft') + .sort((a, b) => new Date(b.modified) - new Date(a.modified)) ?? [] + ); }); const archivedProjects = computed(() => { - return projects.value - .filter((project) => project.status === 'unlisted') - .sort((a, b) => new Date(b.modified) - new Date(a.modified)); + return ( + projects.value + ?.filter((project) => project.status === 'unlisted') + .sort((a, b) => new Date(b.modified) - new Date(a.modified)) ?? [] + ); }); const api = useApiStore();