2024-11-30 00:58:04 +01:00
|
|
|
<script setup lang="ts">
|
2024-12-26 14:34:59 +01:00
|
|
|
import { ChevronDownIcon } from "lucide-vue-next";
|
2024-11-30 00:58:04 +01:00
|
|
|
import {
|
|
|
|
|
Breadcrumb,
|
|
|
|
|
BreadcrumbItem,
|
|
|
|
|
BreadcrumbLink,
|
|
|
|
|
BreadcrumbList,
|
|
|
|
|
BreadcrumbPage,
|
|
|
|
|
BreadcrumbSeparator,
|
|
|
|
|
} from "~/components/ui/breadcrumb";
|
|
|
|
|
import { Separator } from "~/components/ui/separator";
|
|
|
|
|
import {
|
|
|
|
|
SidebarInset,
|
|
|
|
|
SidebarProvider,
|
|
|
|
|
SidebarTrigger,
|
|
|
|
|
} from "~/components/ui/sidebar";
|
2024-12-04 14:34:09 +01:00
|
|
|
import { SettingIds } from "~/settings";
|
2024-12-26 14:34:59 +01:00
|
|
|
import Timelines from "../navigation/timelines.vue";
|
2024-12-02 22:55:36 +01:00
|
|
|
import LeftSidebar from "./left-sidebar.vue";
|
|
|
|
|
import RightSidebar from "./right-sidebar.vue";
|
2024-12-04 14:34:09 +01:00
|
|
|
|
|
|
|
|
const showRightSidebar = useSetting(SettingIds.NotificationsSidebar);
|
2024-12-04 15:17:47 +01:00
|
|
|
|
|
|
|
|
const route = useRoute();
|
2024-12-26 14:34:59 +01:00
|
|
|
const isMd = useMediaQuery("(max-width: 768px)");
|
|
|
|
|
const showTimelines = computed(
|
|
|
|
|
() =>
|
|
|
|
|
["/", "/home", "/local", "/public", "/global"].includes(route.path) &&
|
|
|
|
|
isMd.value,
|
|
|
|
|
);
|
2024-11-30 00:58:04 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<SidebarProvider>
|
2024-12-02 22:55:36 +01:00
|
|
|
<LeftSidebar />
|
2024-11-30 00:58:04 +01:00
|
|
|
<SidebarInset>
|
|
|
|
|
<header
|
2024-12-15 16:16:16 +01:00
|
|
|
class="flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-[[data-collapsible=icon]]/sidebar-wrapper:h-12 overflow-hidden bg-background">
|
2024-12-26 14:34:59 +01:00
|
|
|
<div :key="route.path" class="flex items-center gap-2 px-4 max-w-full">
|
|
|
|
|
<SidebarTrigger class="-ml-1 shrink-0" />
|
|
|
|
|
<Separator v-if="route.meta.breadcrumbs" orientation="vertical" class="mr-2 h-4" />
|
2024-12-04 15:17:47 +01:00
|
|
|
<Breadcrumb v-if="route.meta.breadcrumbs">
|
2024-11-30 00:58:04 +01:00
|
|
|
<BreadcrumbList>
|
2024-12-07 23:05:26 +01:00
|
|
|
<template v-for="(breadcrumb, index) of route.meta.breadcrumbs()">
|
2024-12-26 14:34:59 +01:00
|
|
|
<BreadcrumbItem>
|
|
|
|
|
<component v-if="!breadcrumb.links"
|
|
|
|
|
:is="breadcrumb.href ? BreadcrumbLink : BreadcrumbPage" :href="breadcrumb.href">
|
2024-12-04 15:17:47 +01:00
|
|
|
{{ breadcrumb.text }}
|
|
|
|
|
</component>
|
2024-12-26 14:34:59 +01:00
|
|
|
<DropdownMenu v-else>
|
|
|
|
|
<DropdownMenuTrigger class="flex items-center gap-1">
|
|
|
|
|
{{ breadcrumb.text }}
|
|
|
|
|
<ChevronDownIcon class="size-4" />
|
|
|
|
|
</DropdownMenuTrigger>
|
|
|
|
|
<DropdownMenuContent align="start">
|
|
|
|
|
<DropdownMenuItem v-for="link of breadcrumb.links" :key="link.href"
|
|
|
|
|
:as="BreadcrumbLink" :href="link.href">
|
|
|
|
|
{{ link.text }}
|
|
|
|
|
</DropdownMenuItem>
|
|
|
|
|
</DropdownMenuContent>
|
|
|
|
|
</DropdownMenu>
|
2024-12-04 15:17:47 +01:00
|
|
|
</BreadcrumbItem>
|
2024-12-26 14:34:59 +01:00
|
|
|
<BreadcrumbSeparator v-if="index !== (route.meta.breadcrumbs().length - 1)" />
|
2024-12-04 15:17:47 +01:00
|
|
|
</template>
|
2024-11-30 00:58:04 +01:00
|
|
|
</BreadcrumbList>
|
|
|
|
|
</Breadcrumb>
|
2024-12-26 14:34:59 +01:00
|
|
|
<Separator v-if="showTimelines" orientation="vertical" class="h-4" />
|
|
|
|
|
<Timelines v-if="showTimelines" />
|
2024-11-30 00:58:04 +01:00
|
|
|
</div>
|
|
|
|
|
</header>
|
2024-11-30 16:21:16 +01:00
|
|
|
<div class="flex flex-1 flex-col gap-4 md:p-1 overflow-auto *:z-10">
|
2024-11-30 00:58:04 +01:00
|
|
|
<slot />
|
|
|
|
|
</div>
|
|
|
|
|
</SidebarInset>
|
2024-12-04 14:34:09 +01:00
|
|
|
<RightSidebar v-if="identity" v-show="showRightSidebar.value" />
|
2024-11-30 00:58:04 +01:00
|
|
|
</SidebarProvider>
|
|
|
|
|
</template>
|