From 646c809c6569b96f64324606ecd2e92a6640b789 Mon Sep 17 00:00:00 2001 From: xiaozhu <2395895331@qq.com> Date: Fri, 7 Aug 2026 18:43:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/app/components/common/Sidebar.tsx | 27 ++++++++++++++++------ frontend/app/routes/platform.tsx | 1 + 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/frontend/app/components/common/Sidebar.tsx b/frontend/app/components/common/Sidebar.tsx index 7a4ffc4..98a5189 100644 --- a/frontend/app/components/common/Sidebar.tsx +++ b/frontend/app/components/common/Sidebar.tsx @@ -1,12 +1,5 @@ import Icon from "./Icon"; -const navigation = [ - { label: "工作台", icon: "home" as const, page: "home" as const }, - { label: "构建脚本", icon: "script" as const, page: "scripts" as const }, - { label: "调度配置", icon: "schedule" as const, page: "schedules" as const }, - { label: "系统管理", icon: "settings" as const, page: "system" as const }, -]; - type ActivePage = "home" | "scripts" | "schedules" | "system"; type SidebarProps = { @@ -17,6 +10,13 @@ type SidebarProps = { onEndEditing?: () => void; onSelectScript?: (scriptId: null) => void; editSessionRef?: React.RefObject; + isSystemAdmin?: boolean; +}; + +type NavigationItem = { + label: string; + icon: "home" | "script" | "schedule" | "settings"; + page: ActivePage; }; export function Sidebar({ @@ -27,6 +27,7 @@ export function Sidebar({ onEndEditing, onSelectScript, editSessionRef, + isSystemAdmin = false, }: SidebarProps) { const handleNavigationClick = (page: ActivePage) => { if (page !== "scripts") { @@ -39,6 +40,18 @@ export function Sidebar({ onNavigate(page); }; + // 根据管理员权限构建菜单项 + const navigation: NavigationItem[] = [ + { label: "工作台", icon: "home", page: "home" }, + { label: "构建脚本", icon: "script", page: "scripts" }, + { label: "调度配置", icon: "schedule", page: "schedules" }, + ]; + + // 系统管理员才显示"系统管理"菜单 + if (isSystemAdmin) { + navigation.push({ label: "系统管理", icon: "settings", page: "system" }); + } + return (