From 1f4bad72e920350280feabc9a78607050bc713d3 Mon Sep 17 00:00:00 2001 From: not-nullptr Date: Mon, 11 Nov 2024 20:10:37 +0000 Subject: [PATCH] feat: oops --- src/routes/+layout.svelte | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index a939317..3dee0cc 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -12,22 +12,17 @@ let shouldGoBack = $state(false); const links = $derived<{ - [key: string]: { - href: string; - alert?: boolean; - }; + [key: string]: string; }>({ - Upload: { href: "/" }, + Upload: "/", [files.files.length > 0 ? `Convert ${files.files.length} file${files.files.length > 1 ? "s" : ""}` - : `Convert`]: { href: "/convert", alert: files.shouldShowAlert }, + : `Convert`]: "/convert", }); const linkCount = $derived(Object.keys(links).length); const linkIndex = $derived( - Object.keys(links).findIndex( - (link) => links[link].href === data.pathname, - ), + Object.keys(links).findIndex((link) => links[link] === data.pathname), ); @@ -49,14 +44,14 @@ onclick={() => { const keys = Object.keys(links); const currentIndex = keys.findIndex( - (key) => links[key].href === data.pathname, + (key) => links[key] === data.pathname, ); const nextIndex = keys.findIndex( (key) => links[key] === link, ); shouldGoBack = nextIndex < currentIndex; console.log({ shouldGoBack }); - goto(link.href); + goto(link); }} >