fix collection nav link to point to user's collection

The Collection nav link now points to /{username}/collection/characters
instead of /collection. Also updates isNavSelected to properly detect
when on any collection page.
This commit is contained in:
Justin Edmund 2025-12-02 11:29:09 -08:00
parent 2aa961b5e6
commit d107d56f82

View file

@ -41,7 +41,9 @@
// Localized links // Localized links
const galleryHref = $derived(localizeHref('/teams/explore')) const galleryHref = $derived(localizeHref('/teams/explore'))
const guidesHref = $derived(localizeHref('/guides')) const guidesHref = $derived(localizeHref('/guides'))
const collectionHref = $derived(localizeHref('/collection')) const collectionHref = $derived(
username ? localizeHref(`/${username}/collection/characters`) : localizeHref('/collection')
)
const meHref = $derived(localizeHref('/me')) const meHref = $derived(localizeHref('/me'))
const loginHref = $derived(localizeHref('/auth/login')) const loginHref = $derived(localizeHref('/auth/login'))
const registerHref = $derived(localizeHref('/auth/register')) const registerHref = $derived(localizeHref('/auth/register'))
@ -101,6 +103,11 @@
return path === href return path === href
} }
// For collection, check if we're on any collection page
if (href === collectionHref) {
return path.includes('/collection')
}
// Exact match or starts with href + / // Exact match or starts with href + /
return path === href || path.startsWith(href + '/') return path === href || path.startsWith(href + '/')
} }