59 lines
1.6 KiB
Vue
59 lines
1.6 KiB
Vue
<script setup lang="ts">
|
|
import NavFooter from '@/components/NavFooter.vue';
|
|
import NavMain from '@/components/NavMain.vue';
|
|
import NavUser from '@/components/NavUser.vue';
|
|
import { Sidebar, SidebarContent, SidebarFooter, SidebarHeader, SidebarMenu, SidebarMenuButton, SidebarMenuItem } from '@/components/ui/sidebar';
|
|
import { type NavItem } from '@/types';
|
|
import { Link, usePage } from '@inertiajs/vue3';
|
|
import { LayoutGrid, Server } from 'lucide-vue-next';
|
|
import AppLogo from './AppLogo.vue';
|
|
|
|
const mainNavItems: NavItem[] = [
|
|
{
|
|
title: 'Dashboard',
|
|
href: '/dashboard',
|
|
icon: LayoutGrid,
|
|
},
|
|
];
|
|
|
|
const organisation = usePage().props.organisation;
|
|
|
|
if (organisation) {
|
|
mainNavItems.push({
|
|
title: 'Servers',
|
|
href: route('servers.index', {
|
|
organisation: organisation.id,
|
|
}),
|
|
icon: Server,
|
|
});
|
|
}
|
|
|
|
const footerNavItems: NavItem[] = [];
|
|
</script>
|
|
|
|
<template>
|
|
<Sidebar collapsible="icon" variant="inset">
|
|
<SidebarHeader>
|
|
<SidebarMenu>
|
|
<SidebarMenuItem>
|
|
<SidebarMenuButton size="lg" as-child>
|
|
<Link :href="route('dashboard')">
|
|
<AppLogo />
|
|
</Link>
|
|
</SidebarMenuButton>
|
|
</SidebarMenuItem>
|
|
</SidebarMenu>
|
|
</SidebarHeader>
|
|
|
|
<SidebarContent>
|
|
<NavMain :items="mainNavItems" />
|
|
</SidebarContent>
|
|
|
|
<SidebarFooter>
|
|
<NavFooter :items="footerNavItems" />
|
|
<NavUser />
|
|
</SidebarFooter>
|
|
</Sidebar>
|
|
<slot />
|
|
</template>
|