diff --git a/src/lib/components/icons/Mic.svelte b/src/lib/components/icons/Mic.svelte index df3c550451..fd52bd9fb5 100644 --- a/src/lib/components/icons/Mic.svelte +++ b/src/lib/components/icons/Mic.svelte @@ -12,9 +12,10 @@ stroke="currentColor" class={className} > + diff --git a/src/lib/components/layout/Sidebar.svelte b/src/lib/components/layout/Sidebar.svelte index 151f522118..05050f942c 100644 --- a/src/lib/components/layout/Sidebar.svelte +++ b/src/lib/components/layout/Sidebar.svelte @@ -4,6 +4,7 @@ import Sortable from 'sortablejs'; import { goto } from '$app/navigation'; + import { page } from '$app/stores'; import { user, chats, @@ -161,6 +162,26 @@ return items[id]; }; + const menuItemPathPrefixes = { + notes: '/notes', + workspace: '/workspace', + calendar: '/calendar', + automations: '/automations', + playground: '/playground' + }; + + const getActiveMenuItemId = (pathname) => { + for (const [id, pathPrefix] of Object.entries(menuItemPathPrefixes)) { + if (pathname === pathPrefix || pathname.startsWith(`${pathPrefix}/`)) { + return id; + } + } + + return null; + }; + + $: activeMenuItemId = getActiveMenuItemId($page.url.pathname); + const initPinnedMenuSortable = () => { const el = document.getElementById('pinned-menu-items-list'); if (el && !$mobile) { @@ -795,7 +816,7 @@ {#if !$mobile && !$showSidebar}