diff --git a/src/components/Nav.astro b/src/components/Nav.astro index 8113621..1404880 100644 --- a/src/components/Nav.astro +++ b/src/components/Nav.astro @@ -8,6 +8,8 @@ const t = useTranslations(lang); const translations = { name: t("nav.name"), magic: t("nav.magic"), + main: t("nav.main"), + github: t("nav.github"), }; --- diff --git a/src/components/Nav.svelte b/src/components/Nav.svelte index 319e3ce..4b2124e 100644 --- a/src/components/Nav.svelte +++ b/src/components/Nav.svelte @@ -8,6 +8,8 @@ translations: { name: string; magic: string; + main: string; + github: string; }; } @@ -16,6 +18,10 @@ let isMenuOpen = $state(false); const links = [ + { + name: translations.main, + link: "https://liphium.com", + }, { name: translations.magic, link: getAbsoluteLocaleUrl( @@ -23,6 +29,10 @@ "/magic/getting-started/introduction", ), }, + { + name: translations.github, + link: "https://github.com/Liphium/dev", + }, ]; function toggleMenu() { @@ -40,35 +50,50 @@ } - +
{link.name} diff --git a/src/components/PanelWrapper.svelte b/src/components/PanelWrapper.svelte index 1a7317a..5326b1d 100644 --- a/src/components/PanelWrapper.svelte +++ b/src/components/PanelWrapper.svelte @@ -8,12 +8,21 @@ link: string; } + interface ProcessedLinkItem extends LinkItem { + href: string; + external: boolean; + } + interface Section { name: string; linkPrefix: string; links: LinkItem[]; } + interface ProcessedSection extends Section { + links: ProcessedLinkItem[]; + } + interface Props { software: string; linkPrefix: string; @@ -25,6 +34,22 @@ let { software, linkPrefix, children, sections, currentPath }: Props = $props(); + const processedSections: ProcessedSection[] = $derived( + sections.map((section) => ({ + ...section, + links: section.links.map((link) => { + const external = + link.link.startsWith("https://") || + link.link.startsWith("http://"); + return { + ...link, + href: external ? link.link : linkPrefix + link.link, + external, + }; + }), + })), + ); + let isSidebarOpen = $state(false); function toggleSidebar() { @@ -63,14 +88,14 @@
Planet logo -

{software}

+

{software}

- {#each sections as section} + {#each processedSections as section}
{#if section.name}

@@ -81,7 +106,13 @@ {#each section.links as link} {link.name} @@ -132,14 +163,14 @@

Planet logo -

{software}

+

{software}

- {#each sections as section} + {#each processedSections as section}
{#if section.name}

@@ -151,7 +182,11 @@ {link.name} @@ -169,7 +204,7 @@