diff --git a/frontend/bun.lockb b/frontend/bun.lockb index a777d8d..7b5b7d9 100755 Binary files a/frontend/bun.lockb and b/frontend/bun.lockb differ diff --git a/frontend/package.json b/frontend/package.json index 2d0e8ee..05d6dae 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -47,6 +47,7 @@ "formsnap": "^1.0.0", "he": "^1.2.0", "lucide-svelte": "^0.356.0", + "magic-regexp": "^0.8.0", "mode-watcher": "^0.1.2", "nanoid": "^5.0.3", "node-html-parser": "^6.1.12", diff --git a/frontend/src/lib/components/sidebar.svelte b/frontend/src/lib/components/sidebar.svelte index 05a6bce..a5b7d7d 100644 --- a/frontend/src/lib/components/sidebar.svelte +++ b/frontend/src/lib/components/sidebar.svelte @@ -2,15 +2,38 @@ import { page } from '$app/stores' import { Button } from '$lib/components/ui/button' import { cn } from '$lib/utils' + import { createRegExp, exactly, word } from 'magic-regexp' let className: string | undefined = undefined export { className as class } const routes = [ - { href: '/', name: 'Home' }, - { href: '/links', name: 'Links' }, - { href: '/projects', name: 'Projects' }, - { href: '/settings/account', name: 'Settings' }, + { + href: '/', + name: 'Home', + regex: createRegExp(exactly('/').notBefore(word)), + }, + { + href: '/links', + name: 'Links', + regex: createRegExp( + exactly('/links').or(exactly('/links/').before(word)), + ), + }, + { + href: '/projects', + name: 'Projects', + regex: createRegExp( + exactly('/projects').or(exactly('/projects/').before(word)), + ), + }, + { + href: '/settings/account', + name: 'Settings', + regex: createRegExp( + exactly('/settings').or(exactly('/settings/').before(word)), + ), + }, ] as const @@ -23,7 +46,7 @@