Skip to content

Commit

Permalink
refactor: 优化侧边栏
Browse files Browse the repository at this point in the history
  • Loading branch information
pipijoe committed Jan 20, 2025
1 parent bf8b4a9 commit bb1b92a
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 15 deletions.
1 change: 1 addition & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ function App() {
<Routes>
<Route path="/login" element={<Login />} />
<Route path="/" element={<Home/>}/>
<Route path="/welcome" element={<Home/>}/>
<Route path="/dashboard" element={<Dashboard/>}/>
<Route path="/403" element={<Forbidden />} />
<Route path="/500" element={<ErrorPage />} />
Expand Down
26 changes: 13 additions & 13 deletions src/components/app-sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
BookOpen,
Bot,
BriefcaseBusiness,
CircleUserRound,
CircleUserRound, House,
Landmark,
LayoutDashboard,
Mail,
Expand Down Expand Up @@ -40,7 +40,7 @@ import {useVisitorStore} from "@/store/visitorStore";
const data = {
navMain: [
{
title: "Playground",
title: "playground",
url: "/chat",
icon: SquareTerminal,
isActive: true,
Expand All @@ -50,30 +50,26 @@ const data = {
url: "/chat",
},
{
title: "Starred",
url: "#",
},
{
title: "Settings",
title: "settings",
url: "#",
},
],
},
{
title: "Models",
title: "models",
url: "#",
icon: Bot,
items: [
{
title: "Genesis",
title: "explorer",
url: "#",
},
{
title: "Explorer",
title: "members",
url: "#",
},
{
title: "Quantum",
title: "bill",
url: "#",
},
],
Expand Down Expand Up @@ -103,6 +99,11 @@ const data = {
},
],
workplace: [
{
name: 'welcome',
url: "/welcome",
icon: House,
},
{
name: 'dashboard',
url: "/dashboard",
Expand Down Expand Up @@ -190,7 +191,6 @@ export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
</div>
<div className="flex flex-row gap-0.5 leading-none">
<span className="text-2xl font-bold bg-gradient-to-r from-blue-500 via-purple-500 to-indigo-500 bg-clip-text text-transparent">X.Ryder</span>
<span className="text-sm">v1.1.2</span>
</div>
</a>
</SidebarMenuButton>
Expand All @@ -199,7 +199,7 @@ export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
</SidebarHeader>
<SidebarContent className={'custom-scrollbar'}>
<NavSystem projects={data.workplace} label={'workplace'}/>
<NavMain items={data.navMain} />
<NavMain items={data.navMain} label={'platform'}/>
{
account.permissions && account.permissions.filter((p: string) => p.startsWith('system')).length > 0 &&
<NavSystem projects={data.system} label={'system'}/>
Expand Down
4 changes: 2 additions & 2 deletions src/components/nav-main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {NavLink} from "react-router-dom";
import {useTranslation} from "react-i18next";

export function NavMain({
items,
items, label
}: {
items: {
title: any
Expand All @@ -37,7 +37,7 @@ export function NavMain({
const {t} = useTranslation();
return (
<SidebarGroup>
<SidebarGroupLabel>Platform</SidebarGroupLabel>
<SidebarGroupLabel>{t(label)}</SidebarGroupLabel>
<SidebarMenu>
{items.map((item) => (
<Collapsible
Expand Down
8 changes: 8 additions & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"welcome": "Welcome",
"dashboard": "Dashboard",
"monitor": "Monitor",
"workplace": "Workplace",
Expand All @@ -9,7 +10,14 @@
"message": "Site Message",
"log": "Operate Log",
"login-log": "Login Log",
"platform": "Platform",
"aichat": "AiChat",
"settings": "Settings",
"playground": "Playground",
"models": "Models",
"explorer": "Explorer",
"members": "Members",
"bill": "Bill",
"docs": "docs",
"system": "System"
}
8 changes: 8 additions & 0 deletions src/locales/zh.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"welcome": "欢迎",
"dashboard": "仪表盘",
"monitor": "智能监控",
"workplace": "工作台",
Expand All @@ -9,7 +10,14 @@
"message": "站内信",
"log": "操作日志",
"login-log": "登录日志",
"platform": "平台",
"aichat": "智能助手",
"settings": "设置",
"playground": "练习场",
"models": "模型",
"explorer": "探索",
"members": "成员",
"bill": "账单",
"docs": "文档",
"system": "系统"
}

0 comments on commit bb1b92a

Please sign in to comment.