close DTL panel exactly at the same time as the dialog

This commit is contained in:
isUnknown 2025-01-28 07:26:20 +01:00
parent bada0df7a6
commit 8bb4f552cd
3 changed files with 6 additions and 8 deletions

View file

@ -63,8 +63,10 @@ const api = useApiStore();
const { page } = storeToRefs(usePageStore()); const { page } = storeToRefs(usePageStore());
const isOpen = ref(true); const isOpen = ref(true);
watch(isOpen, (newValue) => { watch(isOpen, (newValue) => {
router.push({ name: route.name }); router.push({ name: route.name });
openedFile.value = null;
}); });
openedFile.value = route.query.fileIndex openedFile.value = route.query.fileIndex
@ -73,7 +75,7 @@ openedFile.value = route.query.fileIndex
const correspondingDTLProposal = computed(() => { const correspondingDTLProposal = computed(() => {
const hasDTLProposal = page.value?.designToLight; const hasDTLProposal = page.value?.designToLight;
if (!hasDTLProposal) return false; if (!hasDTLProposal || !isOpen.value || !openedFile.value) return false;
const correspondingDTLProposal = page.value.designToLight.find((proposal) => { const correspondingDTLProposal = page.value.designToLight.find((proposal) => {
return openedFile.value.source === proposal.location.source; return openedFile.value.source === proposal.location.source;

View file

@ -129,6 +129,7 @@ const route = useRoute();
const isOpen = ref(true); const isOpen = ref(true);
watch(isOpen, (newValue) => { watch(isOpen, (newValue) => {
router.push({ name: route.name }); router.push({ name: route.name });
openedFile.value = null;
}); });
const downloadText = computed(() => { const downloadText = computed(() => {
@ -145,7 +146,7 @@ const downloadText = computed(() => {
const correspondingDTLProposal = computed(() => { const correspondingDTLProposal = computed(() => {
const hasDTLProposal = page.value?.designToLight; const hasDTLProposal = page.value?.designToLight;
if (!hasDTLProposal) return false; if (!hasDTLProposal || !isOpen.value || !openedFile.value) return false;
const correspondingDTLProposal = page.value.designToLight.find((proposal) => { const correspondingDTLProposal = page.value.designToLight.find((proposal) => {
if (activeTab.value === "dynamic") { if (activeTab.value === "dynamic") {
@ -158,7 +159,7 @@ const correspondingDTLProposal = computed(() => {
} else { } else {
return ( return (
proposal.location.type === "static" && proposal.location.type === "static" &&
openedFile.value.source === proposal.location.source openedFile.value?.source === proposal.location.source
); );
} }
}); });

View file

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