import { Bell, CalendarClock, Database, HardDrive, Settings, ShieldCheck } from "lucide-react"; import { useState } from "react"; import { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupContent, SidebarHeader, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarSeparator, useSidebar, } from "~/client/components/ui/sidebar"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "~/client/components/ui/tooltip"; import { HoverCard, HoverCardContent, HoverCardTrigger } from "~/client/components/ui/hover-card"; import { cn } from "~/client/lib/utils"; import { APP_VERSION, RCLONE_VERSION, RESTIC_VERSION, SHOUTRRR_VERSION } from "~/client/lib/version"; import { useUpdates } from "~/client/hooks/use-updates"; import { ReleaseNotesDialog } from "./release-notes-dialog"; import { OrganizationSwitcher } from "./organization-switcher"; import { Link } from "@tanstack/react-router"; const items = [ { title: "Volumes", url: "/volumes", icon: HardDrive, }, { title: "Repositories", url: "/repositories", icon: Database, }, { title: "Backups", url: "/backups", icon: CalendarClock, }, { title: "Notifications", url: "/notifications", icon: Bell, }, { title: "Settings", url: "/settings", icon: Settings, }, ]; type Props = { isInstanceAdmin: boolean; }; export function AppSidebar({ isInstanceAdmin }: Props) { const { state, isMobile, setOpenMobile } = useSidebar(); const { updates, hasUpdate } = useUpdates(); const [showReleaseNotes, setShowReleaseNotes] = useState(false); const isCollapsed = state === "collapsed"; const displayVersion = APP_VERSION.startsWith("v") || APP_VERSION === "dev" ? APP_VERSION : `v${APP_VERSION}`; const releaseUrl = APP_VERSION === "dev" ? "https://github.com/nicotsx/zerobyte" : `https://github.com/nicotsx/zerobyte/releases/tag/${displayVersion}`; return ( Zerobyte Logo Zerobyte {items.map((item) => ( isMobile && setOpenMobile(false)} activeProps={{ className: "bg-strong-accent/10" }} className="w-full flex items-center gap-2" > {({ isActive }) => ( <> {isActive && (
)} {item.title} )}

{item.title}

))} {isInstanceAdmin && ( <> isMobile && setOpenMobile(false)} activeProps={{ className: "bg-strong-accent/10" }} className="w-full flex items-center gap-2" > {({ isActive }) => ( <> {isActive && (
)} Administration )}

Administration

)}
{displayVersion}
Restic: {RESTIC_VERSION} Rclone: {RCLONE_VERSION} Shoutrrr: {SHOUTRRR_VERSION}
{hasUpdate && state !== "collapsed" && ( )}
); }