designtopack/src/stores/project.js
isUnknown c578538fe0 #59
2024-12-19 19:27:38 +01:00

41 lines
1.1 KiB
JavaScript

import { defineStore } from "pinia";
import { usePageStore } from "./page";
export const useProjectStore = defineStore("project", () => {
const { page } = usePageStore();
const stepsLabels = {
Brief: "Votre brief",
proposal: "Proposition commerciale",
extendedBrief: "Brief enrichi",
industrialIdeation: "Idéation industrielle",
virtualSample: "Échantillon virtuel",
physicalSample: "Échantillon physique",
};
function setStatus(steps, currentStepId, targetStep) {
const currentStepIndex = steps.findIndex(
(item) => item.id === currentStepId
);
const stepIndex = steps.findIndex((item) => item.id === targetStep.id);
if (currentStepIndex === stepIndex) {
return "in-progress";
}
if (currentStepIndex > stepIndex) {
return "done";
}
if (currentStepIndex < stepIndex) {
return "uncompleted";
}
}
function isEmptyBrief(project) {
return (
project.currentStep === "clientBrief" &&
project.steps[0].files.length === 0
);
}
return { stepsLabels, setStatus, isEmptyBrief };
});