Files
fluxent-web/components/nav-main.tsx
T
SerinaNya c33857ffac feat(ledger): add bookkeeping workbench and transaction views
- Add transactions_dirty table and zero-tolerance cleansing action

- Implement bookkeeping workbench (/bookkeeping) with searchable Combobox channel selector and card suffix / account identifier

- Implement transaction ledger (/transactions) with date groupings, multi-currency metrics, and filters

- Update AGENTS.md guidelines for Base UI Select and Combobox bindings
2026-09-06 23:23:29 +08:00

68 lines
1.8 KiB
TypeScript

"use client"
import Link from "next/link"
import { usePathname } from "next/navigation"
import { type LucideIcon } from "lucide-react"
import {
SidebarGroup,
SidebarGroupLabel,
SidebarMenu,
SidebarMenuButton,
SidebarMenuItem,
useSidebar,
} from "@/components/ui/sidebar"
export interface NavMainItem {
title: string
url: string
icon: LucideIcon
badge?: string
}
export function NavMain({ items }: { items: NavMainItem[] }) {
const pathname = usePathname()
const { isMobile, setOpenMobile } = useSidebar()
const handleNavigation = () => {
if (isMobile) {
setOpenMobile(false)
}
}
return (
<SidebarGroup>
<SidebarGroupLabel className="text-[11px] font-medium tracking-wider text-sidebar-foreground/60 uppercase">
核心功能
</SidebarGroupLabel>
<SidebarMenu>
{items.map((item) => {
const Icon = item.icon
return (
<SidebarMenuItem key={item.title}>
<SidebarMenuButton
isActive={
item.url === "/"
? pathname === "/"
: pathname === item.url ||
pathname.startsWith(`${item.url}/`)
}
tooltip={item.title}
render={<Link href={item.url} onClick={handleNavigation} />}
>
<Icon data-icon="inline-start" />
<span className="font-medium">{item.title}</span>
{item.badge && (
<span className="ml-auto rounded-full bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium text-primary">
{item.badge}
</span>
)}
</SidebarMenuButton>
</SidebarMenuItem>
)
})}
</SidebarMenu>
</SidebarGroup>
)
}