project store : fix setStatus
This commit is contained in:
parent
837b741c47
commit
1398da62be
3 changed files with 4 additions and 6 deletions
|
|
@ -15,7 +15,7 @@
|
||||||
<li
|
<li
|
||||||
v-for="step in project.steps"
|
v-for="step in project.steps"
|
||||||
class="project-step"
|
class="project-step"
|
||||||
:data-status="setStatus(project.steps, step)"
|
:data-status="setStatus(project.steps, project.currentStep, step)"
|
||||||
>
|
>
|
||||||
<span class="pill" :data-icon="step.id">{{
|
<span class="pill" :data-icon="step.id">{{
|
||||||
stepsLabels[project.currentStep]
|
stepsLabels[project.currentStep]
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
<section
|
<section
|
||||||
class="flex-1"
|
class="flex-1"
|
||||||
:aria-labelledby="step.id"
|
:aria-labelledby="step.id"
|
||||||
:data-status="setStatus(page.steps, step)"
|
:data-status="setStatus(page.steps, page.content.currentstep, step)"
|
||||||
>
|
>
|
||||||
<h2 :id="step.id">
|
<h2 :id="step.id">
|
||||||
<!-- ADRIEN / TIMOTHÉE : DYNAMISER L'ICONE -->
|
<!-- ADRIEN / TIMOTHÉE : DYNAMISER L'ICONE -->
|
||||||
|
|
|
||||||
|
|
@ -13,13 +13,11 @@ export const useProjectStore = defineStore("project", () => {
|
||||||
physicalSample: "Échantillon physique",
|
physicalSample: "Échantillon physique",
|
||||||
};
|
};
|
||||||
|
|
||||||
function setStatus(steps, step) {
|
function setStatus(steps, currentStepId, targetStep) {
|
||||||
const currentStepId = page.content.currentstep;
|
|
||||||
|
|
||||||
const currentStepIndex = steps.findIndex(
|
const currentStepIndex = steps.findIndex(
|
||||||
(item) => item.id === currentStepId
|
(item) => item.id === currentStepId
|
||||||
);
|
);
|
||||||
const stepIndex = steps.findIndex((item) => item.id === step.id);
|
const stepIndex = steps.findIndex((item) => item.id === targetStep.id);
|
||||||
|
|
||||||
if (currentStepIndex === stepIndex) {
|
if (currentStepIndex === stepIndex) {
|
||||||
return "in-progress";
|
return "in-progress";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue