"use client"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { useState } from "react"; import { CreditCard, Gear, ListCheck, Person, PlugConnection, TagDollar, Thunderbolt, ThunderboltFill, Xmark, Bars, } from "@gravity-ui/icons"; import SidebarFooter from "@/components/sidebar-footer"; import { useSession } from "@/lib/auth-client"; const chargeItems = [ { href: "/dashboard/charge", label: "立即充电", icon: ThunderboltFill, adminOnly: false }, { href: "/dashboard/pricing", label: "电价标准", icon: TagDollar, adminOnly: false }, ]; const navItems = [ { href: "/dashboard", label: "概览", icon: Thunderbolt, exact: true, adminOnly: false }, { href: "/dashboard/charge-points", label: "充电桩", icon: PlugConnection, adminOnly: false }, { href: "/dashboard/id-tags", label: "储值卡", icon: CreditCard, adminOnly: false }, { href: "/dashboard/transactions", label: "充电记录", icon: ListCheck, adminOnly: false }, { href: "/dashboard/settings/pricing", label: "峰谷电价", icon: TagDollar, adminOnly: true }, { href: "/dashboard/users", label: "用户管理", icon: Person, adminOnly: true }, ]; const settingsItems = [ { href: "/dashboard/settings/user", label: "账号设置", icon: Gear, adminOnly: false }, ]; function NavContent({ pathname, isAdmin, onNavigate, }: { pathname: string; isAdmin: boolean; onNavigate?: () => void; }) { return ( <> {/* Logo */}
Helios EVCS
{/* Navigation */} {/* Footer */} ); } export default function Sidebar() { const pathname = usePathname(); const [open, setOpen] = useState(false); const { data: sessionData } = useSession(); const isAdmin = sessionData?.user?.role === "admin"; return ( <> {/* Mobile top bar */}
Helios EVCS
{/* Mobile drawer overlay */} {open && (
setOpen(false)} /> )} {/* Mobile drawer */} {/* Desktop sidebar */} ); }