2026-04-13 20:28:09 +08:00
|
|
|
import * as React from "react"
|
|
|
|
|
import {
|
|
|
|
|
Car,
|
|
|
|
|
NotebookPen,
|
|
|
|
|
UserCog,
|
|
|
|
|
Settings,
|
|
|
|
|
LogOut,
|
|
|
|
|
ChevronRight
|
|
|
|
|
} from "lucide-react"
|
|
|
|
|
|
|
|
|
|
import {
|
|
|
|
|
Sidebar,
|
|
|
|
|
SidebarContent,
|
|
|
|
|
SidebarFooter,
|
|
|
|
|
SidebarGroup,
|
|
|
|
|
SidebarGroupContent,
|
|
|
|
|
SidebarGroupLabel,
|
|
|
|
|
SidebarHeader,
|
|
|
|
|
SidebarMenu,
|
|
|
|
|
SidebarMenuButton,
|
|
|
|
|
SidebarMenuItem,
|
|
|
|
|
SidebarRail,
|
|
|
|
|
} from "@/components/ui/sidebar"
|
2026-04-15 17:08:17 +08:00
|
|
|
import { LogoIconOnly } from "./Logo"
|
2026-04-13 20:28:09 +08:00
|
|
|
|
|
|
|
|
const navItems = [
|
|
|
|
|
{
|
2026-04-15 17:08:17 +08:00
|
|
|
title: "官网车型库",
|
2026-04-13 20:28:09 +08:00
|
|
|
icon: Car,
|
|
|
|
|
id: "car-library",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: "小程序内容库",
|
|
|
|
|
icon: NotebookPen,
|
|
|
|
|
id: "mini-content",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: "用户与权限",
|
|
|
|
|
icon: UserCog,
|
|
|
|
|
id: "user-access",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: "系统设置",
|
|
|
|
|
icon: Settings,
|
|
|
|
|
id: "settings",
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
export function AppSidebar({
|
|
|
|
|
activeTab,
|
|
|
|
|
setActiveTab
|
|
|
|
|
}: {
|
|
|
|
|
activeTab: string;
|
|
|
|
|
setActiveTab: (id: string) => void
|
|
|
|
|
}) {
|
|
|
|
|
return (
|
|
|
|
|
<Sidebar collapsible="icon">
|
2026-04-15 17:08:17 +08:00
|
|
|
<SidebarHeader className="border-b border-sidebar-border/50">
|
|
|
|
|
{/* Expanded: full logo banner */}
|
|
|
|
|
<div className="group-data-[collapsible=icon]:hidden">
|
|
|
|
|
<div className="bg-black px-4 py-3">
|
|
|
|
|
<img
|
|
|
|
|
src="/images/audi_logo.png"
|
|
|
|
|
alt="Audi"
|
|
|
|
|
className="h-7 w-auto object-contain"
|
|
|
|
|
/>
|
2026-04-13 20:28:09 +08:00
|
|
|
</div>
|
2026-04-15 17:08:17 +08:00
|
|
|
<div className="px-4 py-2">
|
|
|
|
|
<p className="text-[11px] font-semibold text-gray-800 leading-tight tracking-wide">Rednote Mini App</p>
|
|
|
|
|
<p className="text-[10px] text-gray-400 leading-tight tracking-widest uppercase">Backend Portal</p>
|
2026-04-13 20:28:09 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2026-04-15 17:08:17 +08:00
|
|
|
{/* Collapsed: icon only */}
|
|
|
|
|
<div className="hidden group-data-[collapsible=icon]:flex justify-center py-3">
|
|
|
|
|
<LogoIconOnly />
|
|
|
|
|
</div>
|
2026-04-13 20:28:09 +08:00
|
|
|
</SidebarHeader>
|
|
|
|
|
<SidebarContent>
|
|
|
|
|
<SidebarGroup>
|
|
|
|
|
<SidebarGroupLabel className="group-data-[collapsible=icon]:hidden">主要功能</SidebarGroupLabel>
|
|
|
|
|
<SidebarGroupContent>
|
|
|
|
|
<SidebarMenu>
|
|
|
|
|
{navItems.map((item) => (
|
|
|
|
|
<SidebarMenuItem key={item.id}>
|
|
|
|
|
<SidebarMenuButton
|
|
|
|
|
tooltip={item.title}
|
|
|
|
|
isActive={activeTab === item.id}
|
|
|
|
|
onClick={() => setActiveTab(item.id)}
|
|
|
|
|
className="data-active:bg-audi-red/5 data-active:text-audi-red"
|
|
|
|
|
>
|
|
|
|
|
<item.icon />
|
|
|
|
|
<span>{item.title}</span>
|
|
|
|
|
{activeTab === item.id && (
|
|
|
|
|
<ChevronRight className="ml-auto size-3 opacity-50 group-data-[collapsible=icon]:hidden" />
|
|
|
|
|
)}
|
|
|
|
|
</SidebarMenuButton>
|
|
|
|
|
</SidebarMenuItem>
|
|
|
|
|
))}
|
|
|
|
|
</SidebarMenu>
|
|
|
|
|
</SidebarGroupContent>
|
|
|
|
|
</SidebarGroup>
|
|
|
|
|
</SidebarContent>
|
|
|
|
|
<SidebarFooter className="border-t border-sidebar-border/50 p-4">
|
|
|
|
|
<SidebarMenu>
|
|
|
|
|
<SidebarMenuItem>
|
|
|
|
|
<SidebarMenuButton className="text-muted-foreground hover:text-foreground">
|
|
|
|
|
<LogOut />
|
|
|
|
|
<span>退出登录</span>
|
|
|
|
|
</SidebarMenuButton>
|
|
|
|
|
</SidebarMenuItem>
|
|
|
|
|
</SidebarMenu>
|
|
|
|
|
</SidebarFooter>
|
|
|
|
|
<SidebarRail />
|
|
|
|
|
</Sidebar>
|
|
|
|
|
)
|
|
|
|
|
}
|