fix: footer links causing full-page reload

this also unintentionalyl fixes translations being broken for the page, but there seems to be an issue on first load - sanitization code/ssr might be the issue?
This commit is contained in:
Maya 2025-12-02 17:04:09 +03:00
parent dbc4c394b1
commit 45db105521
No known key found for this signature in database
1 changed files with 31 additions and 15 deletions

View File

@ -7,16 +7,10 @@
? __COMMIT_HASH__
: null;
const items = $derived([
[m["footer.source_code"](), GITHUB_URL_VERT],
[m["footer.discord_server"](), DISCORD_URL],
[m["footer.privacy_policy"](), "/privacy"],
...(commitHash
? [[commitHash, `${GITHUB_URL_VERT}/commit/${commitHash}`]]
: []),
]);
const year = new Date().getFullYear();
// we can't use svelte snippets or a derived object to render the footer as it causes a full-page reload
// ...for some reason. i have no idea, maybe it's to do with the {#key $locale} in +layout.svelte
</script>
<footer
@ -26,17 +20,39 @@
class="w-full h-full flex items-center justify-center text-muted gap-3 relative"
>
<p>{m["footer.copyright"]({ year })}</p>
{#each items as [name, url] (name)}
<!-- bullet point -->
<p></p>
<a
class="hover:underline font-normal"
href={GITHUB_URL_VERT}
target="_blank"
>
{m["footer.source_code"]()}
</a>
<p></p>
<a
class="hover:underline font-normal"
href={DISCORD_URL}
target="_blank"
>
{m["footer.discord_server"]()}
</a>
<p></p>
<a
class="hover:underline font-normal"
href="/privacy/"
>
{m["footer.privacy_policy"]()}
</a>
{#if commitHash}
<p></p>
<a
class="hover:underline font-normal"
href={url}
target={url.startsWith("http") ? "_blank" : "_self"}
href="{GITHUB_URL_VERT}/commit/{commitHash}"
target="_blank"
>
{name}
{commitHash}
</a>
{/each}
{/if}
</div>
<div