diff --git a/src/lib/components/contents/contents-page.svelte b/src/lib/components/contents/contents-page.svelte index 47b08f3b..bebe1e0a 100644 --- a/src/lib/components/contents/contents-page.svelte +++ b/src/lib/components/contents/contents-page.svelte @@ -23,6 +23,8 @@ const routeRegex = /^\/collections\/(?<_collectionName>[^/]+)(?:\/(?new|entries))?(?:\/(?.+?))?$/; + const MainContent = $derived($selectedCollection?.files ? FileList : EntryList); + /** * Navigate to the content list or content details page given the URL hash. * @todo Show Not Found page. @@ -165,7 +167,7 @@ {/snippet} {#snippet mainContent()} - + {/snippet} {#snippet secondarySidebar()} diff --git a/src/lib/components/contents/details/backup-feedback.svelte b/src/lib/components/contents/details/backup-feedback.svelte index 96af0d55..2366be7d 100644 --- a/src/lib/components/contents/details/backup-feedback.svelte +++ b/src/lib/components/contents/details/backup-feedback.svelte @@ -4,26 +4,28 @@ import { backupToastState, restoreDialogState } from '$lib/services/contents/draft/backup'; import { showContentOverlay } from '$lib/services/contents/draft/editor'; - $: now = new Date(); - $: ({ resolve, timestamp } = $restoreDialogState); - $: sameYear = now.getUTCFullYear() === timestamp?.getUTCFullYear(); - $: sameMonth = sameYear && now.getUTCMonth() === timestamp?.getUTCMonth(); - $: sameDay = sameMonth && now.getUTCDate() === timestamp?.getUTCDate(); - $: datetime = timestamp?.toLocaleString($appLocale ?? undefined, { - year: sameYear ? undefined : 'numeric', - month: sameDay ? undefined : 'short', - day: sameDay ? undefined : 'numeric', - hour: 'numeric', - minute: 'numeric', - }); + const now = $derived(new Date()); + const { resolve, timestamp } = $derived($restoreDialogState); + const sameYear = $derived(now.getUTCFullYear() === timestamp?.getUTCFullYear()); + const sameMonth = $derived(sameYear && now.getUTCMonth() === timestamp?.getUTCMonth()); + const sameDay = $derived(sameMonth && now.getUTCDate() === timestamp?.getUTCDate()); + const datetime = $derived( + timestamp?.toLocaleString($appLocale ?? undefined, { + year: sameYear ? undefined : 'numeric', + month: sameDay ? undefined : 'short', + day: sameDay ? undefined : 'numeric', + hour: 'numeric', + minute: 'numeric', + }), + ); - $: { + $effect(() => { if (!$showContentOverlay && $restoreDialogState.show) { // Close the dialog when the Content Editor is closed $restoreDialogState.show = false; resolve?.(); } - } + });