home (projects) : dynamize steps

This commit is contained in:
isUnknown 2024-11-21 11:27:14 +01:00
parent 8bcba4ca9c
commit 837b741c47
4 changed files with 49 additions and 37 deletions

View file

@ -11,20 +11,16 @@
</p>
</hgroup>
<img :src="project.logo" alt="Logo" class="project-logo | rounded-sm" />
<ol class="project-steps" data-steps="1">
<li class="project-step" data-status="in-progress">
<span class="pill" data-icon="Brief">{{
<ol class="project-steps" :data-steps="project.steps.length">
<li
v-for="step in project.steps"
class="project-step"
:data-status="setStatus(project.steps, step)"
>
<span class="pill" :data-icon="step.id">{{
stepsLabels[project.currentStep]
}}</span>
</li>
<!--
<li class="project-step" data-status="in-progress">
<span class="pill" data-icon="extendedBrief">Brief enrichi</span>
</li>
<li class="project-step" data-status="uncompleted">
<span class="pill" data-icon="proposal">Proposition commerciales</span>
</li>
-->
</ol>
</article>
</router-link>
@ -43,7 +39,7 @@ const frenchFormattedModified = dayjs(project.modified).format(
"dddd D MMMM YYYY"
);
const { stepsLabels } = useProjectStore();
const { stepsLabels, setStatus } = useProjectStore();
</script>
<style scoped>

View file

@ -1,5 +1,9 @@
<template>
<section class="flex-1" :aria-labelledby="step.id" :data-status="status">
<section
class="flex-1"
:aria-labelledby="step.id"
:data-status="setStatus(page.steps, step)"
>
<h2 :id="step.id">
<!-- ADRIEN / TIMOTHÉE : DYNAMISER L'ICONE -->
<span :data-icon="step.id">{{ step.label }}</span>
@ -25,7 +29,11 @@
v-if="step.id.includes('Brief') && step.files[0]?.type === 'image'"
class="card__images"
:data-count="step.files.dynamic.length"
:data-plus="step.files.dynamic.length > 3 ? step.files.dynamic.length - 3 : undefined"
:data-plus="
step.files.dynamic.length > 3
? step.files.dynamic.length - 3
: undefined
"
>
<img
v-for="image in step.files.dynamic.slice(0, 3)"
@ -38,7 +46,11 @@
v-if="step.id === 'virtualSample'"
class="card__images"
:data-count="step.files.dynamic.length"
:data-plus="step.files.dynamic.length > 3 ? step.files.dynamic.length - 3 : undefined"
:data-plus="
step.files.dynamic.length > 3
? step.files.dynamic.length - 3
: undefined
"
>
<img
v-for="track in step.files.dynamic"
@ -112,6 +124,7 @@ import dayjs from "dayjs";
import "dayjs/locale/fr";
import { usePageStore } from "../../stores/page";
import { computed } from "vue";
import { useProjectStore } from "../../stores/project";
const { step } = defineProps({
step: Object,
@ -122,6 +135,7 @@ const emit = defineEmits(["update:file"]);
dayjs.locale("fr");
const { page } = usePageStore();
const { setStatus } = useProjectStore();
const steps = page.steps.map((item) => {
return item.value;
@ -135,27 +149,6 @@ const mergedFiles = computed(() => {
return [...staticFiles, ...dynamicFiles];
});
const status = setStatus();
function setStatus() {
const currentStepId = page.content.currentstep;
const currentStepIndex = page.steps.findIndex(
(item) => item.id === currentStepId
);
const stepIndex = page.steps.findIndex((item) => item.id === step.id);
if (currentStepIndex === stepIndex) {
return "in-progress";
}
if (currentStepIndex > stepIndex) {
return "done";
}
if (currentStepIndex < stepIndex) {
return "uncompleted";
}
}
</script>
<style scoped>