front > menu : disable skeleton if 0 projects

This commit is contained in:
isUnknown 2025-09-03 11:18:51 +02:00
parent d8fe9ad13a
commit 5b1291b400
3 changed files with 110 additions and 28 deletions

View file

@ -57,9 +57,9 @@
>
</li>
</ul>
<details :class="{ skeleton: !currentProjects.length }" open>
<details :class="{ skeleton: !currentProjects }" open>
<summary>Projets en cours</summary>
<ul v-if="currentProjects.length">
<ul v-if="currentProjects.length > 0">
<li
v-for="project in currentProjects"
:class="{ active: isCurrent(project) }"

View file

@ -4,7 +4,7 @@ import { ref, computed } from 'vue';
export const useProjectsStore = defineStore('projects', () => {
const isProjectsLoading = ref(true);
const projects = ref([]);
const projects = ref(null);
const currentProjects = computed(() => {
return projects.value

View file

@ -1,15 +1,25 @@
<template>
<main class="flex flex-col items-stretch | w-full">
<header v-if="user.name" class="flex | bg-white rounded-2xl | p-8" style="height:3.5rem">
<header
v-if="user.name"
class="flex | bg-white rounded-2xl | p-8"
style="height: 3.5rem"
>
<h1 class="font-serif | px-8">{{ user.name }}</h1>
</header>
<div class="auto-grid" style="--min:20rem">
<section :class="{ 'is-editing': isEditingEmail }" class="bg-white rounded-2xl px-16 py-24" aria-labelledby="email-label">
<div class="auto-grid" style="--min: 20rem">
<section
:class="{ 'is-editing': isEditingEmail }"
class="bg-white rounded-2xl px-16 py-24"
aria-labelledby="email-label"
>
<h2 class="sr-only" id="email-label">Email</h2>
<div class="field | flow w-full" role="group" aria-labelledby="username">
<div
class="field | flow w-full"
role="group"
aria-labelledby="username"
>
<label for="username" class="text-grey-700">Email</label>
<input
v-if="isEditingEmail"
@ -32,17 +42,27 @@
>
{{ emailBtn.text }}
</button>
<button v-else @click="isEditingEmail = true" class="btn | w-full text-md">
<button
v-else
@click="isEditingEmail = true"
class="btn | w-full text-md"
>
Modifier
</button>
</div>
</section>
<section :class="{ 'is-editing': isEditingEmail }" class="bg-white rounded-2xl px-16 py-24" aria-labelledby="password-label">
<section
:class="{ 'is-editing': isEditingEmail }"
class="bg-white rounded-2xl px-16 py-24"
aria-labelledby="password-label"
>
<h2 class="sr-only" id="password-label">Mot de passe</h2>
<div class="flow">
<div class="field | w-full" role="group" aria-labelledby="password">
<label for="password" class="text-grey-700">Nouveau mot de passe</label>
<label for="password" class="text-grey-700"
>Nouveau mot de passe</label
>
<input
:type="isPasswordVisible ? 'text' : 'password'"
v-model="password"
@ -62,17 +82,45 @@
:aria-pressed="isPasswordVisible ? 'true' : 'false'"
aria-controls="password"
@click="isPasswordVisible = !isPasswordVisible"
:title="isPasswordVisible ? 'Masquer le mot de passe' : 'Afficher le mot de passe'"
:title="
isPasswordVisible
? 'Masquer le mot de passe'
: 'Afficher le mot de passe'
"
>
<svg aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" fill="currentColor">
<path v-if="isPasswordVisible" d="M12.0003 3C17.3924 3 21.8784 6.87976 22.8189 12C21.8784 17.1202 17.3924 21 12.0003 21C6.60812 21 2.12215 17.1202 1.18164 12C2.12215 6.87976 6.60812 3 12.0003 3ZM12.0003 19C16.2359 19 19.8603 16.052 20.7777 12C19.8603 7.94803 16.2359 5 12.0003 5C7.7646 5 4.14022 7.94803 3.22278 12C4.14022 16.052 7.7646 19 12.0003 19ZM12.0003 16.5C9.51498 16.5 7.50026 14.4853 7.50026 12C7.50026 9.51472 9.51498 7.5 12.0003 7.5C14.4855 7.5 16.5003 9.51472 16.5003 12C16.5003 14.4853 14.4855 16.5 12.0003 16.5ZM12.0003 14.5C13.381 14.5 14.5003 13.3807 14.5003 12C14.5003 10.6193 13.381 9.5 12.0003 9.5C10.6196 9.5 9.50026 10.6193 9.50026 12C9.50026 13.3807 10.6196 14.5 12.0003 14.5Z"></path>
<path v-else d="M17.8827 19.2968C16.1814 20.3755 14.1638 21.0002 12.0003 21.0002C6.60812 21.0002 2.12215 17.1204 1.18164 12.0002C1.61832 9.62282 2.81932 7.5129 4.52047 5.93457L1.39366 2.80777L2.80788 1.39355L22.6069 21.1925L21.1927 22.6068L17.8827 19.2968ZM5.9356 7.3497C4.60673 8.56015 3.6378 10.1672 3.22278 12.0002C4.14022 16.0521 7.7646 19.0002 12.0003 19.0002C13.5997 19.0002 15.112 18.5798 16.4243 17.8384L14.396 15.8101C13.7023 16.2472 12.8808 16.5002 12.0003 16.5002C9.51498 16.5002 7.50026 14.4854 7.50026 12.0002C7.50026 11.1196 7.75317 10.2981 8.19031 9.60442L5.9356 7.3497ZM12.9139 14.328L9.67246 11.0866C9.5613 11.3696 9.50026 11.6777 9.50026 12.0002C9.50026 13.3809 10.6196 14.5002 12.0003 14.5002C12.3227 14.5002 12.6309 14.4391 12.9139 14.328ZM20.8068 16.5925L19.376 15.1617C20.0319 14.2268 20.5154 13.1586 20.7777 12.0002C19.8603 7.94818 16.2359 5.00016 12.0003 5.00016C11.1544 5.00016 10.3329 5.11773 9.55249 5.33818L7.97446 3.76015C9.22127 3.26959 10.5793 3.00016 12.0003 3.00016C17.3924 3.00016 21.8784 6.87992 22.8189 12.0002C22.5067 13.6998 21.8038 15.2628 20.8068 16.5925ZM11.7229 7.50857C11.8146 7.50299 11.9071 7.50016 12.0003 7.50016C14.4855 7.50016 16.5003 9.51488 16.5003 12.0002C16.5003 12.0933 16.4974 12.1858 16.4919 12.2775L11.7229 7.50857Z"></path>
<svg
aria-hidden="true"
focusable="false"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
width="16"
height="16"
fill="currentColor"
>
<path
v-if="isPasswordVisible"
d="M12.0003 3C17.3924 3 21.8784 6.87976 22.8189 12C21.8784 17.1202 17.3924 21 12.0003 21C6.60812 21 2.12215 17.1202 1.18164 12C2.12215 6.87976 6.60812 3 12.0003 3ZM12.0003 19C16.2359 19 19.8603 16.052 20.7777 12C19.8603 7.94803 16.2359 5 12.0003 5C7.7646 5 4.14022 7.94803 3.22278 12C4.14022 16.052 7.7646 19 12.0003 19ZM12.0003 16.5C9.51498 16.5 7.50026 14.4853 7.50026 12C7.50026 9.51472 9.51498 7.5 12.0003 7.5C14.4855 7.5 16.5003 9.51472 16.5003 12C16.5003 14.4853 14.4855 16.5 12.0003 16.5ZM12.0003 14.5C13.381 14.5 14.5003 13.3807 14.5003 12C14.5003 10.6193 13.381 9.5 12.0003 9.5C10.6196 9.5 9.50026 10.6193 9.50026 12C9.50026 13.3807 10.6196 14.5 12.0003 14.5Z"
></path>
<path
v-else
d="M17.8827 19.2968C16.1814 20.3755 14.1638 21.0002 12.0003 21.0002C6.60812 21.0002 2.12215 17.1204 1.18164 12.0002C1.61832 9.62282 2.81932 7.5129 4.52047 5.93457L1.39366 2.80777L2.80788 1.39355L22.6069 21.1925L21.1927 22.6068L17.8827 19.2968ZM5.9356 7.3497C4.60673 8.56015 3.6378 10.1672 3.22278 12.0002C4.14022 16.0521 7.7646 19.0002 12.0003 19.0002C13.5997 19.0002 15.112 18.5798 16.4243 17.8384L14.396 15.8101C13.7023 16.2472 12.8808 16.5002 12.0003 16.5002C9.51498 16.5002 7.50026 14.4854 7.50026 12.0002C7.50026 11.1196 7.75317 10.2981 8.19031 9.60442L5.9356 7.3497ZM12.9139 14.328L9.67246 11.0866C9.5613 11.3696 9.50026 11.6777 9.50026 12.0002C9.50026 13.3809 10.6196 14.5002 12.0003 14.5002C12.3227 14.5002 12.6309 14.4391 12.9139 14.328ZM20.8068 16.5925L19.376 15.1617C20.0319 14.2268 20.5154 13.1586 20.7777 12.0002C19.8603 7.94818 16.2359 5.00016 12.0003 5.00016C11.1544 5.00016 10.3329 5.11773 9.55249 5.33818L7.97446 3.76015C9.22127 3.26959 10.5793 3.00016 12.0003 3.00016C17.3924 3.00016 21.8784 6.87992 22.8189 12.0002C22.5067 13.6998 21.8038 15.2628 20.8068 16.5925ZM11.7229 7.50857C11.8146 7.50299 11.9071 7.50016 12.0003 7.50016C14.4855 7.50016 16.5003 9.51488 16.5003 12.0002C16.5003 12.0933 16.4974 12.1858 16.4919 12.2775L11.7229 7.50857Z"
></path>
</svg>
<span class="sr-only">{{ isPasswordVisible ? 'Masquer le mot de passe' : 'Afficher le mot de passe' }}</span>
<span class="sr-only">{{
isPasswordVisible
? 'Masquer le mot de passe'
: 'Afficher le mot de passe'
}}</span>
</button>
</div>
<div class="field | w-full" role="group" aria-labelledby="password-confirm">
<label for="passwordConfirm" class="text-grey-700">Confirmez le nouveau mot de passe</label>
<div
class="field | w-full"
role="group"
aria-labelledby="password-confirm"
>
<label for="passwordConfirm" class="text-grey-700"
>Confirmez le nouveau mot de passe</label
>
<input
:type="isPasswordVisible ? 'text' : 'password'"
v-model="passwordConfirm"
@ -92,13 +140,35 @@
:aria-pressed="isPasswordVisible ? 'true' : 'false'"
aria-controls="password-confirm"
@click="isPasswordVisible = !isPasswordVisible"
:title="isPasswordVisible ? 'Masquer le mot de passe' : 'Afficher le mot de passe'"
:title="
isPasswordVisible
? 'Masquer le mot de passe'
: 'Afficher le mot de passe'
"
>
<svg aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" fill="currentColor">
<path v-if="isPasswordVisible" d="M12.0003 3C17.3924 3 21.8784 6.87976 22.8189 12C21.8784 17.1202 17.3924 21 12.0003 21C6.60812 21 2.12215 17.1202 1.18164 12C2.12215 6.87976 6.60812 3 12.0003 3ZM12.0003 19C16.2359 19 19.8603 16.052 20.7777 12C19.8603 7.94803 16.2359 5 12.0003 5C7.7646 5 4.14022 7.94803 3.22278 12C4.14022 16.052 7.7646 19 12.0003 19ZM12.0003 16.5C9.51498 16.5 7.50026 14.4853 7.50026 12C7.50026 9.51472 9.51498 7.5 12.0003 7.5C14.4855 7.5 16.5003 9.51472 16.5003 12C16.5003 14.4853 14.4855 16.5 12.0003 16.5ZM12.0003 14.5C13.381 14.5 14.5003 13.3807 14.5003 12C14.5003 10.6193 13.381 9.5 12.0003 9.5C10.6196 9.5 9.50026 10.6193 9.50026 12C9.50026 13.3807 10.6196 14.5 12.0003 14.5Z"></path>
<path v-else d="M17.8827 19.2968C16.1814 20.3755 14.1638 21.0002 12.0003 21.0002C6.60812 21.0002 2.12215 17.1204 1.18164 12.0002C1.61832 9.62282 2.81932 7.5129 4.52047 5.93457L1.39366 2.80777L2.80788 1.39355L22.6069 21.1925L21.1927 22.6068L17.8827 19.2968ZM5.9356 7.3497C4.60673 8.56015 3.6378 10.1672 3.22278 12.0002C4.14022 16.0521 7.7646 19.0002 12.0003 19.0002C13.5997 19.0002 15.112 18.5798 16.4243 17.8384L14.396 15.8101C13.7023 16.2472 12.8808 16.5002 12.0003 16.5002C9.51498 16.5002 7.50026 14.4854 7.50026 12.0002C7.50026 11.1196 7.75317 10.2981 8.19031 9.60442L5.9356 7.3497ZM12.9139 14.328L9.67246 11.0866C9.5613 11.3696 9.50026 11.6777 9.50026 12.0002C9.50026 13.3809 10.6196 14.5002 12.0003 14.5002C12.3227 14.5002 12.6309 14.4391 12.9139 14.328ZM20.8068 16.5925L19.376 15.1617C20.0319 14.2268 20.5154 13.1586 20.7777 12.0002C19.8603 7.94818 16.2359 5.00016 12.0003 5.00016C11.1544 5.00016 10.3329 5.11773 9.55249 5.33818L7.97446 3.76015C9.22127 3.26959 10.5793 3.00016 12.0003 3.00016C17.3924 3.00016 21.8784 6.87992 22.8189 12.0002C22.5067 13.6998 21.8038 15.2628 20.8068 16.5925ZM11.7229 7.50857C11.8146 7.50299 11.9071 7.50016 12.0003 7.50016C14.4855 7.50016 16.5003 9.51488 16.5003 12.0002C16.5003 12.0933 16.4974 12.1858 16.4919 12.2775L11.7229 7.50857Z"></path>
<svg
aria-hidden="true"
focusable="false"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
width="16"
height="16"
fill="currentColor"
>
<path
v-if="isPasswordVisible"
d="M12.0003 3C17.3924 3 21.8784 6.87976 22.8189 12C21.8784 17.1202 17.3924 21 12.0003 21C6.60812 21 2.12215 17.1202 1.18164 12C2.12215 6.87976 6.60812 3 12.0003 3ZM12.0003 19C16.2359 19 19.8603 16.052 20.7777 12C19.8603 7.94803 16.2359 5 12.0003 5C7.7646 5 4.14022 7.94803 3.22278 12C4.14022 16.052 7.7646 19 12.0003 19ZM12.0003 16.5C9.51498 16.5 7.50026 14.4853 7.50026 12C7.50026 9.51472 9.51498 7.5 12.0003 7.5C14.4855 7.5 16.5003 9.51472 16.5003 12C16.5003 14.4853 14.4855 16.5 12.0003 16.5ZM12.0003 14.5C13.381 14.5 14.5003 13.3807 14.5003 12C14.5003 10.6193 13.381 9.5 12.0003 9.5C10.6196 9.5 9.50026 10.6193 9.50026 12C9.50026 13.3807 10.6196 14.5 12.0003 14.5Z"
></path>
<path
v-else
d="M17.8827 19.2968C16.1814 20.3755 14.1638 21.0002 12.0003 21.0002C6.60812 21.0002 2.12215 17.1204 1.18164 12.0002C1.61832 9.62282 2.81932 7.5129 4.52047 5.93457L1.39366 2.80777L2.80788 1.39355L22.6069 21.1925L21.1927 22.6068L17.8827 19.2968ZM5.9356 7.3497C4.60673 8.56015 3.6378 10.1672 3.22278 12.0002C4.14022 16.0521 7.7646 19.0002 12.0003 19.0002C13.5997 19.0002 15.112 18.5798 16.4243 17.8384L14.396 15.8101C13.7023 16.2472 12.8808 16.5002 12.0003 16.5002C9.51498 16.5002 7.50026 14.4854 7.50026 12.0002C7.50026 11.1196 7.75317 10.2981 8.19031 9.60442L5.9356 7.3497ZM12.9139 14.328L9.67246 11.0866C9.5613 11.3696 9.50026 11.6777 9.50026 12.0002C9.50026 13.3809 10.6196 14.5002 12.0003 14.5002C12.3227 14.5002 12.6309 14.4391 12.9139 14.328ZM20.8068 16.5925L19.376 15.1617C20.0319 14.2268 20.5154 13.1586 20.7777 12.0002C19.8603 7.94818 16.2359 5.00016 12.0003 5.00016C11.1544 5.00016 10.3329 5.11773 9.55249 5.33818L7.97446 3.76015C9.22127 3.26959 10.5793 3.00016 12.0003 3.00016C17.3924 3.00016 21.8784 6.87992 22.8189 12.0002C22.5067 13.6998 21.8038 15.2628 20.8068 16.5925ZM11.7229 7.50857C11.8146 7.50299 11.9071 7.50016 12.0003 7.50016C14.4855 7.50016 16.5003 9.51488 16.5003 12.0002C16.5003 12.0933 16.4974 12.1858 16.4919 12.2775L11.7229 7.50857Z"
></path>
</svg>
<span class="sr-only">{{ isPasswordVisible ? 'Masquer le mot de passe' : 'Afficher le mot de passe' }}</span>
<span class="sr-only">{{
isPasswordVisible
? 'Masquer le mot de passe'
: 'Afficher le mot de passe'
}}</span>
</button>
</div>
<button
@ -112,20 +182,32 @@
</div>
</section>
<section class="bg-white rounded-2xl px-16 py-24" aria-labelledby="client-label">
<section
class="bg-white rounded-2xl px-16 py-24"
aria-labelledby="client-label"
>
<h2 id="client-label" class="text-grey-700 mb-16">Client</h2>
<div class="flex" style="--column-gap: 2rem">
<img :src="user.client.logo" :alt="'logo' + user.client.name" class="rounded-md" width="72" height="72">
<img
:src="user.client.logo"
:alt="'logo' + user.client.name"
class="rounded-md"
width="72"
height="72"
/>
<p class="font-serif text-lg">{{ user.client.name }}</p>
</div>
</section>
<section v-if="user.hasOwnProperty('projects')" class="bg-white rounded-2xl px-16 py-24" aria-labelledby="projects-label">
<section
v-if="user.hasOwnProperty('projects')"
class="bg-white rounded-2xl px-16 py-24"
aria-labelledby="projects-label"
>
<h2 class="sr-only" id="projects-label">Projets</h2>
<p class="text-grey-700 mb-16">Nombre de projets</p>
<p class="text-xl">{{ Object.values(user.projects).length }}</p>
</section>
</div>
</main>
</template>