2025-10-20 08:57:51 +02:00
|
|
|
<script setup lang="ts">
|
2025-10-22 12:35:40 +02:00
|
|
|
import { SidebarGroup, SidebarGroupLabel, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarMenuAction } from '@/components/ui/sidebar';
|
2025-10-20 08:57:51 +02:00
|
|
|
import { urlIsActive } from '@/lib/utils';
|
|
|
|
|
import { type NavGroup } from '@/types';
|
|
|
|
|
import { Link, usePage } from '@inertiajs/vue3';
|
2025-10-22 12:35:40 +02:00
|
|
|
import { LayoutGrid, Plus } from 'lucide-vue-next';
|
2025-10-20 08:57:51 +02:00
|
|
|
import { dashboard } from '@/routes';
|
|
|
|
|
import SidebarSeparator from './ui/sidebar/SidebarSeparator.vue';
|
|
|
|
|
|
|
|
|
|
defineProps<{
|
|
|
|
|
groups: NavGroup[];
|
|
|
|
|
}>();
|
|
|
|
|
|
|
|
|
|
const page = usePage();
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<SidebarGroup class="px-2 py-0">
|
|
|
|
|
|
|
|
|
|
<SidebarMenuItem :key="'dashboard'">
|
|
|
|
|
<SidebarMenuButton as-child :is-active="urlIsActive(dashboard(), page.url)" :tooltip="'Dashboard'">
|
|
|
|
|
<Link :href="dashboard()">
|
2025-10-22 11:58:58 +02:00
|
|
|
<component :is="LayoutGrid" class="text-gray-500" stroke-width="1.5" />
|
2025-10-20 08:57:51 +02:00
|
|
|
<span>Dashboard</span>
|
|
|
|
|
</Link>
|
|
|
|
|
</SidebarMenuButton>
|
|
|
|
|
</SidebarMenuItem>
|
|
|
|
|
</SidebarGroup>
|
|
|
|
|
|
|
|
|
|
<SidebarGroup class="px-2 py-0" v-for="group in groups">
|
2025-10-22 12:35:40 +02:00
|
|
|
<SidebarSeparator
|
2025-10-22 16:51:28 +02:00
|
|
|
class="absolute mt-6 shrink transition-[opacity] opacity-0 group-data-[collapsible=icon]:opacity-100 w-4 bg-muted-foreground"
|
2025-10-22 12:35:40 +02:00
|
|
|
style="width: calc(var(--spacing) * 4);" />
|
2025-10-20 08:57:51 +02:00
|
|
|
<SidebarGroupLabel class="text-bold uppercase text-gray-400 mt-2 group-data-[collapsible=icon]:mt-2">
|
|
|
|
|
{{ group.title }}
|
|
|
|
|
</SidebarGroupLabel>
|
|
|
|
|
<SidebarMenu>
|
|
|
|
|
<SidebarMenuItem v-for="item in group.items" :key="item.title">
|
|
|
|
|
<SidebarMenuButton as-child :is-active="urlIsActive(item.href, page.url)" :tooltip="item.title">
|
|
|
|
|
<Link :href="item.href">
|
2025-10-22 11:58:58 +02:00
|
|
|
<component :is="item.icon" :class="item.color" stroke-width="1.5" />
|
2025-10-20 08:57:51 +02:00
|
|
|
<span>{{ item.title }}</span>
|
|
|
|
|
</Link>
|
|
|
|
|
</SidebarMenuButton>
|
2025-10-22 12:35:40 +02:00
|
|
|
<SidebarMenuAction v-if="item.action">
|
|
|
|
|
<Link :href="item.action.href">
|
|
|
|
|
<component :is="item.action.icon" :class="item.action.color" stroke-width="1.5" size="0.833rem" />
|
|
|
|
|
<span class="sr-only">{{ item.action.title }}</span>
|
|
|
|
|
</Link>
|
|
|
|
|
</SidebarMenuAction>
|
2025-10-20 08:57:51 +02:00
|
|
|
</SidebarMenuItem>
|
|
|
|
|
</SidebarMenu>
|
|
|
|
|
</SidebarGroup>
|
|
|
|
|
|
|
|
|
|
</template>
|