refactor: use shadcn sidebar

This commit is contained in:
tao.chen
2026-08-25 20:20:14 +08:00
parent 9294c7fd9f
commit e186e5e541
10 changed files with 245 additions and 205 deletions
@@ -1,47 +0,0 @@
import { useState } from "react";
import Icon from "../../components/common/Icon";
import { UserManagementPage } from "./UserManagementPage";
import { ProjectManagementPage } from "./ProjectManagementPage";
import "../../styles/admin.css";
export function SystemAdminPage({
onNotify,
onConnectionChange,
}: {
onNotify: (notice: { tone: "success" | "error" | "info"; message: string }) => void;
onConnectionChange: (online: boolean) => void;
}) {
const [activeTab, setActiveTab] = useState<"users" | "projects">("users");
return (
<section className="admin-page">
<div className="admin-tabs">
<button
className={`admin-tab${activeTab === "users" ? " is-active" : ""}`}
type="button"
onClick={() => setActiveTab("users")}
>
<Icon name="workspace" size={16} />
</button>
<button
className={`admin-tab${activeTab === "projects" ? " is-active" : ""}`}
type="button"
onClick={() => setActiveTab("projects")}
>
<Icon name="folder" size={16} />
</button>
</div>
{activeTab === "users" && (
<UserManagementPage onNotify={onNotify} onConnectionChange={onConnectionChange} />
)}
{activeTab === "projects" && (
<ProjectManagementPage onNotify={onNotify} onConnectionChange={onConnectionChange} />
)}
</section>
);
}
@@ -1,15 +0,0 @@
import { useScriptWorkspaceStore } from "../platform/state/scriptWorkspaceStore";
import { useUiStore } from "../platform/state/uiStore";
import { SystemAdminPage } from "./SystemAdminPage";
export default function SystemAdminRoute() {
const setApiOnline = useScriptWorkspaceStore((s) => s.setApiOnline);
const pushToast = useUiStore((s) => s.pushToast);
return (
<SystemAdminPage
onNotify={pushToast}
onConnectionChange={setApiOnline}
/>
);
}