2024-10-28 18:18:32 +01:00
|
|
|
|
<template>
|
2024-10-30 16:41:29 +01:00
|
|
|
|
<Dialog
|
|
|
|
|
|
id="virtual-sample"
|
|
|
|
|
|
v-model:visible="isOpen"
|
|
|
|
|
|
modal
|
|
|
|
|
|
:draggable="false"
|
2024-11-28 15:15:21 +01:00
|
|
|
|
dismissableMask="true"
|
2024-10-30 16:41:29 +01:00
|
|
|
|
header="Titre du rendu"
|
|
|
|
|
|
class="dialog"
|
2025-01-27 15:53:23 +01:00
|
|
|
|
:class="[
|
|
|
|
|
|
{ 'with-comments': isCommentsOpen },
|
|
|
|
|
|
activeTab,
|
|
|
|
|
|
{ 'with-dtl': correspondingDTLProposal },
|
|
|
|
|
|
]"
|
2024-10-30 16:41:29 +01:00
|
|
|
|
:closeOnEscape="true"
|
|
|
|
|
|
>
|
|
|
|
|
|
<template #header>
|
2024-11-28 18:08:39 +01:00
|
|
|
|
<div class="dialog__tabs" role="tablist">
|
2024-11-05 14:14:40 +01:00
|
|
|
|
<button
|
2024-11-21 13:20:57 +01:00
|
|
|
|
v-if="step.files.dynamic"
|
2024-11-28 18:08:39 +01:00
|
|
|
|
type="button"
|
|
|
|
|
|
role="tab"
|
2024-11-05 14:14:40 +01:00
|
|
|
|
class="btn btn--transparent | font-serif"
|
2024-10-30 16:41:29 +01:00
|
|
|
|
data-icon="cursor"
|
2024-11-20 16:03:38 +01:00
|
|
|
|
:aria-pressed="activeTab === 'dynamic' ? true : false"
|
2024-11-28 18:08:39 +01:00
|
|
|
|
aria-controls="dynamic"
|
2024-11-20 16:03:38 +01:00
|
|
|
|
@click="activeTab = 'dynamic'"
|
2024-10-30 16:41:29 +01:00
|
|
|
|
>
|
2024-12-16 15:29:54 +01:00
|
|
|
|
<span>Présentation dynamique</span>
|
2024-10-30 16:41:29 +01:00
|
|
|
|
</button>
|
2024-11-20 16:03:38 +01:00
|
|
|
|
<button
|
2024-11-21 13:20:57 +01:00
|
|
|
|
v-if="step.files.static"
|
2024-11-28 18:08:39 +01:00
|
|
|
|
type="button"
|
|
|
|
|
|
role="tab"
|
2024-11-20 16:03:38 +01:00
|
|
|
|
@click="activeTab = 'static'"
|
|
|
|
|
|
class="btn btn--transparent | font-serif"
|
|
|
|
|
|
data-icon="image"
|
|
|
|
|
|
:aria-pressed="activeTab === 'static' ? true : false"
|
2024-11-28 18:08:39 +01:00
|
|
|
|
aria-controls="static"
|
2024-11-20 16:03:38 +01:00
|
|
|
|
>
|
2024-10-30 16:41:29 +01:00
|
|
|
|
<span>Vue statique</span>
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
2024-11-20 18:42:37 +01:00
|
|
|
|
<h2 class="font-serif text-lg">Échantillon virtuel</h2>
|
2024-10-30 16:41:29 +01:00
|
|
|
|
</template>
|
2024-11-13 07:46:32 +01:00
|
|
|
|
|
2024-11-28 18:08:39 +01:00
|
|
|
|
<DynamicView id="dynamic" v-if="activeTab === 'dynamic'" />
|
|
|
|
|
|
<StaticView id="static" v-if="activeTab === 'static'" />
|
2024-11-20 15:57:07 +01:00
|
|
|
|
|
2024-10-30 16:41:29 +01:00
|
|
|
|
<template #footer>
|
2025-01-07 16:54:08 +01:00
|
|
|
|
<button
|
2024-11-21 10:08:37 +01:00
|
|
|
|
v-if="currentFile"
|
2024-10-30 16:41:29 +01:00
|
|
|
|
id="download-image"
|
2024-11-05 14:14:40 +01:00
|
|
|
|
class="btn btn--white-10"
|
2024-10-30 16:41:29 +01:00
|
|
|
|
data-icon="download"
|
2025-01-07 16:54:08 +01:00
|
|
|
|
@click="downloadFiles()"
|
2024-10-30 16:41:29 +01:00
|
|
|
|
>
|
2025-01-07 16:54:08 +01:00
|
|
|
|
<span>{{ downloadText }}</span>
|
|
|
|
|
|
</button>
|
2024-11-05 14:14:40 +01:00
|
|
|
|
<button
|
2024-10-30 16:41:29 +01:00
|
|
|
|
id="loop-animation"
|
2024-12-16 18:28:19 +01:00
|
|
|
|
class="btn"
|
|
|
|
|
|
:class="{ 'btn--transparent btn--outline': !isLoopAnimationEnabled }"
|
|
|
|
|
|
:data-icon="!isLoopAnimationEnabled ? 'loop' : 'pause'"
|
2024-12-16 16:27:21 +01:00
|
|
|
|
@click="isLoopAnimationEnabled = !isLoopAnimationEnabled"
|
2024-10-30 16:41:29 +01:00
|
|
|
|
>
|
2024-12-17 12:09:57 +01:00
|
|
|
|
<span>{{
|
|
|
|
|
|
!isLoopAnimationEnabled
|
2025-02-19 15:31:57 +01:00
|
|
|
|
? 'Animation en boucle'
|
|
|
|
|
|
: 'Arrêter l’animation'
|
2024-12-17 12:09:57 +01:00
|
|
|
|
}}</span>
|
2024-10-30 16:41:29 +01:00
|
|
|
|
</button>
|
|
|
|
|
|
<button
|
2024-12-19 17:18:26 +01:00
|
|
|
|
v-if="isCommentPanelEnabled"
|
2024-10-30 16:41:29 +01:00
|
|
|
|
id="toggle-comments"
|
|
|
|
|
|
:aria-pressed="isCommentsOpen"
|
|
|
|
|
|
class="btn btn--transparent btn--outline"
|
|
|
|
|
|
data-icon="comment"
|
|
|
|
|
|
@click="isCommentsOpen = !isCommentsOpen"
|
|
|
|
|
|
>
|
2024-12-19 17:18:26 +01:00
|
|
|
|
<span class="sr-only"
|
2025-02-19 15:31:57 +01:00
|
|
|
|
>{{ isCommentsOpen ? 'Masquer' : 'Afficher' }} les commentaires</span
|
2024-12-19 17:18:26 +01:00
|
|
|
|
>
|
2024-10-30 16:41:29 +01:00
|
|
|
|
</button>
|
|
|
|
|
|
</template>
|
2024-12-18 18:22:39 +01:00
|
|
|
|
<Comments v-if="isCommentsOpen" @show-draft-marker="showDraftMarker" />
|
2024-10-30 16:41:29 +01:00
|
|
|
|
</Dialog>
|
2025-01-27 11:06:06 +01:00
|
|
|
|
<DTLPanel
|
|
|
|
|
|
v-if="correspondingDTLProposal"
|
|
|
|
|
|
:proposals="[correspondingDTLProposal]"
|
|
|
|
|
|
/>
|
2024-10-28 18:18:32 +01:00
|
|
|
|
</template>
|
2024-10-30 16:41:29 +01:00
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2025-02-19 15:31:57 +01:00
|
|
|
|
import Comments from '../../comments/Comments.vue';
|
|
|
|
|
|
import Dialog from 'primevue/dialog';
|
|
|
|
|
|
import DynamicView from './DynamicView.vue';
|
|
|
|
|
|
import StaticView from './StaticView.vue';
|
|
|
|
|
|
import DTLPanel from '../../design-to-light/DTLPanel.vue';
|
|
|
|
|
|
import { storeToRefs } from 'pinia';
|
|
|
|
|
|
import { ref, watch, computed } from 'vue';
|
|
|
|
|
|
import { useVirtualSampleStore } from '../../../stores/virtualSample';
|
|
|
|
|
|
import { useDialogStore } from '../../../stores/dialog';
|
|
|
|
|
|
import { useRoute, useRouter } from 'vue-router';
|
|
|
|
|
|
import { usePageStore } from '../../../stores/page';
|
2024-10-30 16:41:29 +01:00
|
|
|
|
|
|
|
|
|
|
const { file } = defineProps({
|
|
|
|
|
|
file: Object,
|
|
|
|
|
|
});
|
2024-11-20 08:26:12 +01:00
|
|
|
|
|
2025-01-07 16:54:08 +01:00
|
|
|
|
const {
|
|
|
|
|
|
activeTab,
|
|
|
|
|
|
currentFile,
|
|
|
|
|
|
step,
|
|
|
|
|
|
isLoopAnimationEnabled,
|
|
|
|
|
|
isDownloadTriggered,
|
|
|
|
|
|
} = storeToRefs(useVirtualSampleStore());
|
2025-01-27 11:06:06 +01:00
|
|
|
|
|
|
|
|
|
|
const { isCommentsOpen, isCommentPanelEnabled, activeTracks, openedFile } =
|
|
|
|
|
|
storeToRefs(useDialogStore());
|
|
|
|
|
|
|
|
|
|
|
|
const { page } = storeToRefs(usePageStore());
|
|
|
|
|
|
|
2024-12-17 12:10:32 +01:00
|
|
|
|
isLoopAnimationEnabled.value = false;
|
2024-10-30 16:41:29 +01:00
|
|
|
|
|
|
|
|
|
|
// Variables
|
2024-11-28 15:15:21 +01:00
|
|
|
|
const router = useRouter();
|
|
|
|
|
|
const route = useRoute();
|
2024-11-19 17:20:47 +01:00
|
|
|
|
const isOpen = ref(true);
|
2024-11-28 15:15:21 +01:00
|
|
|
|
watch(isOpen, (newValue) => {
|
|
|
|
|
|
router.push({ name: route.name });
|
2025-01-28 07:26:20 +01:00
|
|
|
|
openedFile.value = null;
|
2025-02-19 15:31:57 +01:00
|
|
|
|
activeTracks.value = null;
|
2024-11-28 15:15:21 +01:00
|
|
|
|
});
|
2025-01-07 16:54:08 +01:00
|
|
|
|
|
|
|
|
|
|
const downloadText = computed(() => {
|
2025-02-19 15:31:57 +01:00
|
|
|
|
if (activeTab.value === 'dynamic') {
|
2025-01-07 16:54:08 +01:00
|
|
|
|
if (activeTracks.value.length === 1) {
|
|
|
|
|
|
return "Télécharger l'image";
|
|
|
|
|
|
} else {
|
2025-02-19 15:31:57 +01:00
|
|
|
|
return 'Télécharger les images';
|
2025-01-07 16:54:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
} else {
|
2025-02-19 15:31:57 +01:00
|
|
|
|
return 'Télécharger le PDF';
|
2025-01-07 16:54:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
2025-01-27 11:06:06 +01:00
|
|
|
|
const correspondingDTLProposal = computed(() => {
|
|
|
|
|
|
const hasDTLProposal = page.value?.designToLight;
|
2025-01-28 07:26:20 +01:00
|
|
|
|
if (!hasDTLProposal || !isOpen.value || !openedFile.value) return false;
|
2025-01-27 11:06:06 +01:00
|
|
|
|
|
|
|
|
|
|
const correspondingDTLProposal = page.value.designToLight.find((proposal) => {
|
2025-02-19 15:31:57 +01:00
|
|
|
|
if (activeTab.value === 'dynamic') {
|
2025-01-27 11:06:06 +01:00
|
|
|
|
return (
|
2025-02-19 15:31:57 +01:00
|
|
|
|
proposal.location.type === 'dynamic' &&
|
2025-01-27 11:06:06 +01:00
|
|
|
|
activeTracks?.value?.some(
|
|
|
|
|
|
(activeTrack) => activeTrack.slug === proposal.location.trackSlug
|
|
|
|
|
|
)
|
|
|
|
|
|
);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return (
|
2025-02-19 15:31:57 +01:00
|
|
|
|
proposal.location.type === 'static' &&
|
2025-01-28 07:26:20 +01:00
|
|
|
|
openedFile.value?.source === proposal.location.source
|
2025-01-27 11:06:06 +01:00
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
if (!correspondingDTLProposal) return false;
|
|
|
|
|
|
|
|
|
|
|
|
return correspondingDTLProposal;
|
|
|
|
|
|
});
|
|
|
|
|
|
|
2025-01-07 16:54:08 +01:00
|
|
|
|
// Functions
|
|
|
|
|
|
function downloadFiles() {
|
|
|
|
|
|
isDownloadTriggered.value = true;
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
isDownloadTriggered.value = false;
|
|
|
|
|
|
}, 400);
|
|
|
|
|
|
}
|
2024-10-30 16:41:29 +01:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
.dialog__inner {
|
|
|
|
|
|
padding: var(--space-16);
|
|
|
|
|
|
}
|
2024-12-18 18:22:39 +01:00
|
|
|
|
.with-comments .dialog__inner {
|
|
|
|
|
|
margin-right: var(--dialog-comments-w, 20rem);
|
|
|
|
|
|
}
|
|
|
|
|
|
#comments-container {
|
|
|
|
|
|
top: var(--dialog-header-h);
|
|
|
|
|
|
}
|
2024-10-30 16:41:29 +01:00
|
|
|
|
</style>
|