designtopack/src/stores/virtualSample.js
2025-01-07 16:54:08 +01:00

25 lines
721 B
JavaScript

import { defineStore } from "pinia";
import { ref, watch } from "vue";
import { usePageStore } from "./page";
export const useVirtualSampleStore = defineStore("virtual-sample", () => {
const { page } = usePageStore();
const step = page.steps.find((step) => step.id === "virtualSample");
const isCompareModeEnabled = ref(false);
const activeTab = ref(step.files.dynamic ? "dynamic" : "static");
const currentFile = ref(null);
const isLoopAnimationEnabled = ref(false);
const isDownloadTriggered = ref(false);
watch(activeTab, () => (currentFile.value = null));
return {
activeTab,
currentFile,
step,
isLoopAnimationEnabled,
isCompareModeEnabled,
isDownloadTriggered,
};
});