fix active link on dashboard nav

Signed-off-by: Ronni Skansing <rskansing@gmail.com>
This commit is contained in:
Ronni Skansing
2026-02-19 00:11:38 +01:00
parent 569fdd55f5
commit 67f9465ca2
@@ -2,14 +2,15 @@
import { page } from '$app/stores';
// determine active tab based on current route
$: currentPath = $page.url.pathname;
// normalize path to handle trailing slashes
$: currentPath = $page.url.pathname.replace(/\/$/, '') || '/';
</script>
<nav class="mb-6 border-b border-gray-200 dark:border-gray-700">
<div class="flex gap-6">
<nav class="mt-4 mb-6 border-b border-gray-200 dark:border-gray-700">
<div class="flex">
<a
href="/dashboard"
class="px-1 py-3 text-sm font-medium border-b-2 transition-colors
class="px-6 py-3 text-sm font-medium border-b-2 transition-colors
{currentPath === '/dashboard'
? 'border-cta-blue dark:border-highlight-blue text-cta-blue dark:text-highlight-blue'
: 'border-transparent text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hover:border-gray-300 dark:hover:border-gray-600'}"
@@ -18,7 +19,7 @@
</a>
<a
href="/dashboard/campaigns"
class="px-1 py-3 text-sm font-medium border-b-2 transition-colors
class="px-6 py-3 text-sm font-medium border-b-2 transition-colors
{currentPath === '/dashboard/campaigns'
? 'border-cta-blue dark:border-highlight-blue text-cta-blue dark:text-highlight-blue'
: 'border-transparent text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hover:border-gray-300 dark:hover:border-gray-600'}"
@@ -27,7 +28,7 @@
</a>
<a
href="/dashboard/events"
class="px-1 py-3 text-sm font-medium border-b-2 transition-colors
class="px-6 py-3 text-sm font-medium border-b-2 transition-colors
{currentPath === '/dashboard/events'
? 'border-cta-blue dark:border-highlight-blue text-cta-blue dark:text-highlight-blue'
: 'border-transparent text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hover:border-gray-300 dark:hover:border-gray-600'}"