mirror of https://github.com/VERT-sh/VERT.git
feat: oops
This commit is contained in:
parent
38709395d4
commit
1f4bad72e9
|
|
@ -12,22 +12,17 @@
|
||||||
let shouldGoBack = $state(false);
|
let shouldGoBack = $state(false);
|
||||||
|
|
||||||
const links = $derived<{
|
const links = $derived<{
|
||||||
[key: string]: {
|
[key: string]: string;
|
||||||
href: string;
|
|
||||||
alert?: boolean;
|
|
||||||
};
|
|
||||||
}>({
|
}>({
|
||||||
Upload: { href: "/" },
|
Upload: "/",
|
||||||
[files.files.length > 0
|
[files.files.length > 0
|
||||||
? `Convert ${files.files.length} file${files.files.length > 1 ? "s" : ""}`
|
? `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 linkCount = $derived(Object.keys(links).length);
|
||||||
const linkIndex = $derived(
|
const linkIndex = $derived(
|
||||||
Object.keys(links).findIndex(
|
Object.keys(links).findIndex((link) => links[link] === data.pathname),
|
||||||
(link) => links[link].href === data.pathname,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -49,14 +44,14 @@
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
const keys = Object.keys(links);
|
const keys = Object.keys(links);
|
||||||
const currentIndex = keys.findIndex(
|
const currentIndex = keys.findIndex(
|
||||||
(key) => links[key].href === data.pathname,
|
(key) => links[key] === data.pathname,
|
||||||
);
|
);
|
||||||
const nextIndex = keys.findIndex(
|
const nextIndex = keys.findIndex(
|
||||||
(key) => links[key] === link,
|
(key) => links[key] === link,
|
||||||
);
|
);
|
||||||
shouldGoBack = nextIndex < currentIndex;
|
shouldGoBack = nextIndex < currentIndex;
|
||||||
console.log({ shouldGoBack });
|
console.log({ shouldGoBack });
|
||||||
goto(link.href);
|
goto(link);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<span class="mix-blend-difference invert">
|
<span class="mix-blend-difference invert">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue