This commit is contained in:
isUnknown 2024-11-28 14:45:45 +01:00
parent cca389f1b0
commit 7764f4651c
17 changed files with 40 additions and 47 deletions

View file

@ -30,9 +30,6 @@ const licenseKey = import.meta.env.VITE_VPV_LICENSE;
useLicense({ licenseKey });
const { openedFile, isCommentsOpen, comments } = storeToRefs(useDialogStore());
const dialog = useDialogStore();
const router = useRouter();
const route = useRoute();
const draftComment = ref(null);
@ -44,9 +41,6 @@ watch(isCommentsOpen, (newVal) => {
}
});
openedFile.value = route.query.fileIndex
? dialog.content.files[route.query.fileIndex]
: dialog.content.files[0];
watch(openedFile, (newVal) => {
removeCommentMarkers();
if (newVal.comments) {

View file

@ -56,6 +56,10 @@ watch(isOpen, (newValue) => {
router.push({ name: route.name });
});
openedFile.value = route.query.fileIndex
? dialog.content.files[route.query.fileIndex]
: dialog.content.files[0];
// Functions
async function validate() {
const response = await api.validateBrief(

View file

@ -25,31 +25,28 @@
</button>
</header>
<div class="dialog__inner" id="verre-brut">
<VPdfViewer
v-if="activeTab === 'rawGlass'"
:darkMode="true"
:initialThumbnailsVisible="true"
:src="step.files.static.rawGlass.url"
local="fr_FR"
@loaded="onPdfLoaded"
/>
<VPdfViewer
v-if="activeTab === 'finishedGlass'"
:darkMode="true"
:initialThumbnailsVisible="true"
:src="step.files.static.finishedGlass.url"
local="fr_FR"
@loaded="onPdfLoaded"
/>
<PdfViewer />
</div>
</template>
<script setup>
import { ref } from "vue";
import { ref, watch } from "vue";
import { useVirtualSampleStore } from "../../../stores/virtualSample";
import PdfViewer from "../PdfViewer.vue";
import { storeToRefs } from "pinia";
import { useDialogStore } from "../../../stores/dialog";
const { step } = useVirtualSampleStore();
const { openedFile } = storeToRefs(useDialogStore());
const activeTab = ref(Object.keys(step.files.static)[0]);
watch(
activeTab,
(newVal) => {
openedFile.value = step.files.static[newVal];
},
{ immediate: true }
);
</script>
<style scoped>

View file

@ -65,13 +65,6 @@
>
<span class="sr-only">Afficher les commentaires</span>
</button>
<Comments
v-if="isCommentsOpen"
:current-page-index="currentPageIndex"
:file="file"
:comments="file.comments"
@update:file="changeFile"
/>
</template>
</Dialog>
</template>
@ -82,21 +75,18 @@ import Dialog from "primevue/dialog";
import DynamicView from "./DynamicView.vue";
import StaticView from "./StaticView.vue";
import { ref } from "vue";
import { useDialogStore } from "../../../stores/dialog";
import { useVirtualSampleStore } from "../../../stores/virtualSample";
import { usePageStore } from "../../../stores/page";
import { useDialogStore } from "../../../stores/dialog";
const { file } = defineProps({
file: Object,
});
const { page } = usePageStore();
const { comments } = storeToRefs(useDialogStore());
const { activeTab, currentFile, step } = storeToRefs(useVirtualSampleStore());
const { isCommentsOpen } = storeToRefs(useDialogStore());
// Variables
const isOpen = ref(true);
const isCommentsOpen = ref(false);
</script>
<style scoped>

View file

@ -10,10 +10,12 @@ export const useDialogStore = defineStore("dialog", () => {
});
function updateFile(newFile) {
openedFile.value = newFile;
if (!content.value.files) return;
content.value.files = content.value.files.map((file) =>
file.id === newFile.id ? newFile : file
);
openedFile.value = newFile;
}
const route = useRoute();