judge4c/src/components/sidebar/teacher-sidebar.tsx

128 lines
2.9 KiB
TypeScript
Raw Normal View History

2025-06-21 15:19:49 +00:00
"use client";
2025-06-19 08:07:40 +00:00
import {
Command,
LifeBuoy,
PieChart,
Send,
SquareTerminal,
2025-06-21 15:19:49 +00:00
} from "lucide-react";
import * as React from "react";
2025-06-19 08:07:40 +00:00
import {
Sidebar,
SidebarContent,
SidebarFooter,
SidebarHeader,
SidebarMenu,
SidebarMenuButton,
SidebarMenuItem,
2025-06-21 15:19:49 +00:00
} from "@/components/ui/sidebar";
import { User } from "next-auth";
import { siteConfig } from "@/config/site";
import { NavMain } from "@/components/nav-main";
import { NavUser } from "@/components/nav-user";
import { NavSecondary } from "@/components/nav-secondary";
2025-06-19 08:07:40 +00:00
const data = {
navMain: [
{
2025-06-21 09:44:14 +00:00
title: "教师管理",
url: "#",
2025-06-19 08:07:40 +00:00
icon: SquareTerminal,
isActive: true,
items: [
{
2025-06-21 09:44:14 +00:00
title: "用户管理",
url: "/dashboard/usermanagement/guest",
2025-06-19 08:07:40 +00:00
},
{
title: "题库管理",
2025-06-21 09:44:14 +00:00
url: "/dashboard/usermanagement/problem",
2025-06-19 08:07:40 +00:00
},
],
},
{
title: "统计分析",
2025-06-21 09:44:14 +00:00
url: "#",
2025-06-19 08:07:40 +00:00
icon: PieChart,
items: [
{
2025-06-20 12:18:13 +00:00
title: "完成情况",
2025-06-21 09:44:14 +00:00
url: "/dashboard/teacher/dashboard",
2025-06-19 08:07:40 +00:00
},
2025-06-21 09:44:14 +00:00
// {
// title: "错题统计",
// url: "/dashboard/teacher/dashboard",
// },
2025-06-19 08:07:40 +00:00
],
},
2025-06-21 09:44:14 +00:00
// {
// title: "设置",
// url: "#",
// icon: Settings2,
// items: [
// {
// title: "语言",
// url: "#",
// },
// ],
// },
2025-06-19 08:07:40 +00:00
],
navSecondary: [
{
title: "帮助",
url: "/",
icon: LifeBuoy,
},
{
title: "反馈",
url: siteConfig.url.repo.github,
icon: Send,
},
],
2025-06-21 15:19:49 +00:00
};
2025-06-19 08:07:40 +00:00
2025-06-21 09:44:14 +00:00
interface TeacherSidebarProps {
user: User;
}
2025-06-21 15:19:49 +00:00
export function TeacherSidebar({
user,
...props
}: TeacherSidebarProps & React.ComponentProps<typeof Sidebar>) {
2025-06-21 09:44:14 +00:00
const userInfo = {
name: user.name ?? "",
email: user.email ?? "",
avatar: user.image ?? "/avatars/teacher.jpg",
};
2025-06-19 08:07:40 +00:00
return (
<Sidebar variant="inset" {...props}>
<SidebarHeader>
<SidebarMenu>
<SidebarMenuItem>
<SidebarMenuButton size="lg" asChild>
<a href="#">
<div className="flex aspect-square size-8 items-center justify-center rounded-lg bg-sidebar-primary text-sidebar-primary-foreground">
<Command className="size-4" />
</div>
<div className="grid flex-1 text-left text-sm leading-tight">
<span className="truncate font-semibold">Judge4c </span>
<span className="truncate text-xs">Teaching Platform</span>
</div>
</a>
</SidebarMenuButton>
</SidebarMenuItem>
</SidebarMenu>
</SidebarHeader>
<SidebarContent>
<NavMain items={data.navMain} />
<NavSecondary items={data.navSecondary} className="mt-auto" />
</SidebarContent>
<SidebarFooter>
2025-06-21 09:44:14 +00:00
<NavUser user={userInfo} />
2025-06-19 08:07:40 +00:00
</SidebarFooter>
</Sidebar>
2025-06-21 15:19:49 +00:00
);
2025-06-19 08:07:40 +00:00
}