import type { ComponentType } from "react"; import { ArchiveIcon, ArrowLeftIcon, Settings2Icon } from "lucide-react"; import { useNavigate } from "@tanstack/react-router"; import { SidebarContent, SidebarFooter, SidebarGroup, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarSeparator, } from "../ui/sidebar"; export type SettingsSectionPath = "/settings/general" | "/settings/archived"; export const SETTINGS_NAV_ITEMS: ReadonlyArray<{ label: string; to: SettingsSectionPath; icon: ComponentType<{ className?: string }>; }> = [ { label: "General", to: "/settings/general", icon: Settings2Icon }, { label: "Archive", to: "/settings/archived", icon: ArchiveIcon }, ]; export function SettingsSidebarNav({ pathname }: { pathname: string }) { const navigate = useNavigate(); return ( <> {SETTINGS_NAV_ITEMS.map((item) => { const Icon = item.icon; const isActive = pathname === item.to; return ( void navigate({ to: item.to, replace: true })} > {item.label} ); })} window.history.back()} > Back ); }