This commit is contained in:
Vincent van der Wal
2026-08-01 15:07:28 +02:00
parent 9806396476
commit 774afa6c65
45 changed files with 1515 additions and 239 deletions
@@ -1,7 +1,9 @@
<script lang="ts">
import { resolve } from '$app/paths';
import { page } from '$app/stores';
import { href, routePath } from '$lib/i18n';
import * as m from '$lib/paraglide/messages';
import LogoMark from './logo-mark.svelte';
interface Props {
@@ -14,38 +16,38 @@
const links = [
{
title: '7-Day Forecast',
title: m.nav_week,
url: '/weather/week' as const,
iconPaths: [
'M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z'
]
},
{
title: 'Model Comparison',
title: m.nav_compare,
url: '/weather/compare' as const,
iconPaths: ['M13 7h8m0 0v8m0-8l-8 8-4-4-6 6']
},
{
title: '14-Day Forecast',
title: m.nav_14day,
url: '/weather/14-day' as const,
iconPaths: [
'M3 15a4 4 0 004 4h9a5 5 0 10-.1-9.999 5.002 5.002 0 10-9.78 2.096A4.001 4.001 0 003 15z'
]
},
{
title: 'Seasonal',
title: m.nav_seasonal,
url: '/weather/seasonal' as const,
// rising trend line (long-range outlook)
iconPaths: ['M3 17l6-6 4 4 7-7', 'M16 8h5v5']
},
{
title: 'Historical',
title: m.nav_historical,
url: '/weather/historical' as const,
// clock with a counter-clockwise arrow (history)
iconPaths: ['M12 8v4l3 2', 'M3.5 9a9 9 0 1 0 2.2-3.6L3 8m0-4.5V8h4.5']
},
{
title: 'Maps',
title: m.nav_maps,
url: '/weather/maps' as const,
// Heroicons "map" outline icon
iconPaths: [
@@ -54,7 +56,8 @@
}
];
let currentPath = $derived($page.url.pathname);
// the URL carries a locale prefix; compare the neutral path behind it
let currentPath = $derived(routePath($page.url.pathname));
const isActive = (url: string) => {
return currentPath === url || currentPath.startsWith(url + '/');
@@ -70,12 +73,12 @@
home link fills the entire row, padding included -->
<div class="flex h-14 shrink-0 items-stretch border-b border-sidebar-border">
<a
href={resolve('/weather/week')}
href={href('/weather/week')}
class="flex flex-1 items-center gap-2.5 transition-colors hover:bg-sidebar-accent {collapsed
? 'justify-center'
: 'px-4'}"
onclick={onMobileClose}
aria-label="Drizzli home"
aria-label={m.nav_home()}
>
<div
class="flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary text-primary-foreground"
@@ -92,14 +95,14 @@
<!-- Navigation links -->
<nav class="flex-1 space-y-1 px-2 py-3">
{#each links as link (link.title)}
{#each links as link (link.url)}
{@const active = isActive(link.url)}
<a
href={resolve(link.url)}
href={href(link.url)}
class="relative flex items-center rounded-md px-2.5 py-2 text-sm font-medium text-sidebar-foreground opacity-70 transition-colors duration-150 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:opacity-100 {active
? 'bg-sidebar-accent text-sidebar-primary! opacity-100! font-semibold! nav-active'
: ''}"
title={collapsed ? link.title : undefined}
title={collapsed ? link.title() : undefined}
onclick={onMobileClose}
>
<div class="flex h-5 w-5 shrink-0 items-center justify-center">
@@ -116,7 +119,7 @@
</svg>
</div>
{#if !collapsed}
<span class="ml-2.5 whitespace-nowrap">{link.title}</span>
<span class="ml-2.5 whitespace-nowrap">{link.title()}</span>
{/if}
</a>
{/each}
@@ -130,7 +133,7 @@
<button
class="relative flex w-full cursor-pointer items-center rounded-md px-2.5 py-2 text-sm font-medium text-sidebar-foreground opacity-70 transition-colors duration-150 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:opacity-100"
onclick={onToggle}
title={collapsed ? 'Expand sidebar' : 'Collapse sidebar'}
title={collapsed ? m.nav_expand_sidebar() : m.nav_collapse_sidebar()}
>
<div class="flex h-5 w-5 shrink-0 items-center justify-center">
<svg
@@ -149,7 +152,7 @@
</svg>
</div>
{#if !collapsed}
<span class="ml-2.5 whitespace-nowrap">Collapse</span>
<span class="ml-2.5 whitespace-nowrap">{m.nav_collapse()}</span>
{/if}
</button>
</div>