From 5262a08306dee9296c89b4ceaab5f9f66c24b43b Mon Sep 17 00:00:00 2001
From: ivarlovlie <git@ivarlovlie.no>
Date: Thu, 2 Jun 2022 23:24:51 +0200
Subject: fix: Fix route matching when deciding which tab is open

---
 apps/projects/src/app/pages/_layout.svelte | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'apps/projects/src/app/pages/_layout.svelte')

diff --git a/apps/projects/src/app/pages/_layout.svelte b/apps/projects/src/app/pages/_layout.svelte
index 24a9370..3d632ae 100644
--- a/apps/projects/src/app/pages/_layout.svelte
+++ b/apps/projects/src/app/pages/_layout.svelte
@@ -28,17 +28,17 @@
             <div class="tab-v2">
                 <a href="/home"
                    use:link
-                   class="tabs-nav-v2__item {$location === '/home' ? 'tabs-nav-v2__item--selected' : ''}">Home</a>
+                   class="tabs-nav-v2__item {($location === '/' || $location.startsWith('/home')) ? 'tabs-nav-v2__item--selected' : ''}">Home</a>
             </div>
             <div class="tab-v2">
                 <a href="/data"
                    use:link
-                   class="tabs-nav-v2__item {$location === '/data' ? 'tabs-nav-v2__item--selected' : ''}">Data</a>
+                   class="tabs-nav-v2__item {$location.startsWith('/data') ? 'tabs-nav-v2__item--selected' : ''}">Data</a>
             </div>
             <div class="tab-v2">
                 <a href="/settings"
                    use:link
-                   class="tabs-nav-v2__item {$location === '/settings' ? 'tabs-nav-v2__item--selected' : ''}">Settings</a>
+                   class="tabs-nav-v2__item {$location.startsWith('/settings') ? 'tabs-nav-v2__item--selected' : ''}">Settings</a>
             </div>
         </div>
         <div class="tab-v2 padding-x-sm">
-- 
cgit v1.3

