This commit is contained in:
isUnknown 2025-04-04 14:58:49 +02:00
parent 806bc993da
commit c29906f306
5 changed files with 77 additions and 54 deletions

View file

@ -87,7 +87,7 @@
</Dialog>
<DTLPanel
v-if="correspondingDTLProposal"
:proposals="[correspondingDTLProposal]"
:proposals="correspondingDTLProposal"
/>
</template>
@ -147,30 +147,41 @@ const downloadText = computed(() => {
});
const correspondingDTLProposal = computed(() => {
const hasDTLProposal = page.value?.designToLight;
if (!hasDTLProposal || !isOpen.value || !openedFile.value) return false;
const correspondingDTLProposal = page.value.designToLight.find((proposal) => {
if (activeTab.value === 'dynamic') {
return (
proposal.location.type === 'dynamic' &&
activeTracks?.value?.some(
(activeTrack) => activeTrack.slug === proposal.location.trackSlug
)
);
} else {
return (
proposal.location.type === 'static' &&
openedFile.value?.source === proposal.location.source
);
}
});
if (!correspondingDTLProposal) return false;
return correspondingDTLProposal;
if (activeTracks.value?.length === 1) {
const matchingProposal = page.value.designToLight.find(
(proposal) => proposal.location.trackSlug === activeTracks.value[0].slug
);
return matchingProposal ? [matchingProposal] : false;
} else {
return false;
}
});
// const correspondingDTLProposal = computed(() => {
// const hasDTLProposal = page.value?.designToLight;
// if (!hasDTLProposal || !isOpen.value || !openedFile.value) return false;
// const correspondingDTLProposal = page.value.designToLight.find((proposal) => {
// if (activeTab.value === 'dynamic') {
// return (
// proposal.location.type === 'dynamic' &&
// activeTracks?.value?.some(
// (activeTrack) => activeTrack.slug === proposal.location.trackSlug
// )
// );
// } else {
// return (
// proposal.location.type === 'static' &&
// openedFile.value?.source === proposal.location.source
// );
// }
// });
// if (!correspondingDTLProposal) return false;
// return correspondingDTLProposal;
// });
// Functions
function downloadFiles() {
isDownloadTriggered.value = true;