diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 0fea456..3a9fd66 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -16,6 +16,36 @@ // Merge base meta tags with page-specific meta tags let metaTags = $derived(deepMerge(data.baseMetaTags, page.data.pageMetaTags || {})); + // Helper function to check if a path is active + function isActivePath(path: string): boolean { + if (path === '/') { + return page.url.pathname === '/'; + } + return page.url.pathname.startsWith(path); + } + + // Helper function to get navigation link classes + function getNavLinkClasses(path: string): string { + const isActive = isActivePath(path); + const baseClasses = 'btn flex items-center gap-2'; + + if (isActive) { + return `${baseClasses} preset-filled-primary-500 cursor-default`; + } + return `${baseClasses} preset-ghost-surface-200-800`; + } + + // Helper function to get mobile navigation link classes + function getMobileNavLinkClasses(path: string): string { + const isActive = isActivePath(path); + const baseClasses = 'btn flex items-center justify-start gap-2'; + + if (isActive) { + return `${baseClasses} preset-filled-primary-500 cursor-default`; + } + return `${baseClasses} preset-ghost-surface-200-800`; + } + onMount(() => { // Sync client-side session with server-side on mount const { data } = supabase.auth.onAuthStateChange((event, newSession) => { @@ -51,24 +81,55 @@