fix #69
This commit is contained in:
parent
bff0f8eda3
commit
cb1f842fc9
4 changed files with 53 additions and 14 deletions
|
|
@ -44,18 +44,15 @@
|
|||
<StaticView id="static" v-if="activeTab === 'static'" />
|
||||
|
||||
<template #footer>
|
||||
<a
|
||||
<button
|
||||
v-if="currentFile"
|
||||
id="download-image"
|
||||
class="btn btn--white-10"
|
||||
data-icon="download"
|
||||
:href="currentFile.url"
|
||||
download
|
||||
@click="downloadFiles()"
|
||||
>
|
||||
<span>{{
|
||||
activeTab === "dynamic" ? "Télécharger l’image" : "Télécharger le PDF"
|
||||
}}</span>
|
||||
</a>
|
||||
<span>{{ downloadText }}</span>
|
||||
</button>
|
||||
<button
|
||||
id="loop-animation"
|
||||
class="btn"
|
||||
|
|
@ -92,7 +89,7 @@ import { storeToRefs } from "pinia";
|
|||
import Dialog from "primevue/dialog";
|
||||
import DynamicView from "./DynamicView.vue";
|
||||
import StaticView from "./StaticView.vue";
|
||||
import { ref, watch } from "vue";
|
||||
import { ref, watch, computed } from "vue";
|
||||
import { useVirtualSampleStore } from "../../../stores/virtualSample";
|
||||
import { useDialogStore } from "../../../stores/dialog";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
|
|
@ -101,11 +98,17 @@ const { file } = defineProps({
|
|||
file: Object,
|
||||
});
|
||||
|
||||
const { activeTab, currentFile, step, isLoopAnimationEnabled } = storeToRefs(
|
||||
useVirtualSampleStore()
|
||||
);
|
||||
const {
|
||||
activeTab,
|
||||
currentFile,
|
||||
step,
|
||||
isLoopAnimationEnabled,
|
||||
isDownloadTriggered,
|
||||
} = storeToRefs(useVirtualSampleStore());
|
||||
isLoopAnimationEnabled.value = false;
|
||||
const { isCommentsOpen, isCommentPanelEnabled } = storeToRefs(useDialogStore());
|
||||
const { isCommentsOpen, isCommentPanelEnabled, activeTracks } = storeToRefs(
|
||||
useDialogStore()
|
||||
);
|
||||
|
||||
// Variables
|
||||
const router = useRouter();
|
||||
|
|
@ -114,6 +117,26 @@ const isOpen = ref(true);
|
|||
watch(isOpen, (newValue) => {
|
||||
router.push({ name: route.name });
|
||||
});
|
||||
|
||||
const downloadText = computed(() => {
|
||||
if (activeTab.value === "dynamic") {
|
||||
if (activeTracks.value.length === 1) {
|
||||
return "Télécharger l'image";
|
||||
} else {
|
||||
return "Télécharger les images";
|
||||
}
|
||||
} else {
|
||||
return "Télécharger le PDF";
|
||||
}
|
||||
});
|
||||
|
||||
// Functions
|
||||
function downloadFiles() {
|
||||
isDownloadTriggered.value = true;
|
||||
setTimeout(() => {
|
||||
isDownloadTriggered.value = false;
|
||||
}, 400);
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue