Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions resources/js/layouts/settings/Layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ const sidebarNavItems: NavItem[] = [
const page = usePage();

const currentPath = page.props.ziggy?.location ? new URL(page.props.ziggy.location).pathname : '';

const getNavItemLink = (item:NavItem,defaultValue:string = '#') : string=>{
if(!item.href ) return defaultValue;
return item.type === 'route' ? route(item.href):item.href;
}
</script>

<template>
Expand All @@ -36,10 +41,10 @@ const currentPath = page.props.ziggy?.location ? new URL(page.props.ziggy.locati
v-for="item in sidebarNavItems"
:key="item.href"
variant="ghost"
:class="['w-full justify-start', { 'bg-muted': currentPath === item.href }]"
:class="['w-full justify-start', { 'bg-muted': currentPath === getNavItemLink(item) }]"
as-child
>
<Link :href="item.href">
<Link :href="getNavItemLink(item)">
{{ item.title }}
</Link>
</Button>
Expand Down