Files
full-stack-fastapi/frontend/src/components/Sidebar/AppSidebar.tsx
魏风 ff971e2cea
All checks were successful
Deploy to Production / deploy (push) Successful in 1m19s
feat: add mqtt raw data management with UTC+8 range UI
2026-03-20 17:46:37 +08:00

46 lines
1.3 KiB
TypeScript

import { FileDown, Home, MapPin, Satellite, Users } from "lucide-react"
import { SidebarAppearance } from "@/components/Common/Appearance"
import { Logo } from "@/components/Common/Logo"
import {
Sidebar,
SidebarContent,
SidebarFooter,
SidebarHeader,
} from "@/components/ui/sidebar"
import useAuth from "@/hooks/useAuth"
import { type Item, Main } from "./Main"
import { User } from "./User"
const baseItems: Item[] = [
{ icon: Home, title: "Dashboard", path: "/" },
{ icon: MapPin, title: "Locations", path: "/locations" },
{ icon: Satellite, title: "GNSS Monitor", path: "/gnss-monitor" },
{ icon: FileDown, title: "MQTT Raw", path: "/mqtt-raw" },
]
export function AppSidebar() {
const { user: currentUser } = useAuth()
const items = currentUser?.is_superuser
? [...baseItems, { icon: Users, title: "Admin", path: "/admin" }]
: baseItems
return (
<Sidebar collapsible="icon">
<SidebarHeader className="px-4 py-6 group-data-[collapsible=icon]:px-0 group-data-[collapsible=icon]:items-center">
<Logo variant="responsive" />
</SidebarHeader>
<SidebarContent>
<Main items={items} />
</SidebarContent>
<SidebarFooter>
<SidebarAppearance />
<User user={currentUser} />
</SidebarFooter>
</Sidebar>
)
}
export default AppSidebar