From 5bfa0811dbb4f49f3ea3b0b467b51ede0b2d829d Mon Sep 17 00:00:00 2001 From: Script Generator Date: Mon, 8 Jun 2026 12:28:14 +0800 Subject: [PATCH] =?UTF-8?q?feat(layout):=20=E6=B7=BB=E5=8A=A0=E5=B7=A6?= =?UTF-8?q?=E4=BE=A7=E5=AF=BC=E8=88=AA=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 包含与我相关、产品、项目、版本主导航和成员管理入口,路由高亮当前页面。 Co-Authored-By: Claude Opus 4.7 (1M context) --- .gitignore | 2 + apps/web/app/layout.tsx | 6 ++- apps/web/components/layout/Sidebar.tsx | 64 ++++++++++++++++++++++++++ apps/web/tsconfig.json | 29 ++++++++++-- 4 files changed, 95 insertions(+), 6 deletions(-) create mode 100644 apps/web/components/layout/Sidebar.tsx diff --git a/.gitignore b/.gitignore index 58fe590..fdc2dea 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,5 @@ dist/ .turbo/ coverage/ .DS_Store +next-env.d.ts +*.tsbuildinfo diff --git a/apps/web/app/layout.tsx b/apps/web/app/layout.tsx index 5c8fcb4..64d3b6f 100644 --- a/apps/web/app/layout.tsx +++ b/apps/web/app/layout.tsx @@ -1,5 +1,6 @@ import './globals.css'; import type { Metadata } from 'next'; +import { Sidebar } from '@/components/layout/Sidebar'; export const metadata: Metadata = { title: 'FTB 项目管理', @@ -13,7 +14,10 @@ export default function RootLayout({ }) { return ( - {children} + + +
{children}
+ ); } diff --git a/apps/web/components/layout/Sidebar.tsx b/apps/web/components/layout/Sidebar.tsx new file mode 100644 index 0000000..568e278 --- /dev/null +++ b/apps/web/components/layout/Sidebar.tsx @@ -0,0 +1,64 @@ +'use client'; + +import { usePathname, useRouter } from 'next/navigation'; + +const NAV_ITEMS = [ + { label: '与我相关', path: '/workspace', icon: '📋' }, + { label: '产品', path: '/products', icon: '📦' }, + { label: '项目', path: '/projects', icon: '📁' }, + { label: '版本', path: '/versions', icon: '🏷️' }, +]; + +const ADMIN_ITEMS = [ + { label: '成员管理', path: '/admin/members', icon: '👥' }, +]; + +export function Sidebar() { + const pathname = usePathname(); + const router = useRouter(); + + const isActive = (path: string) => pathname.startsWith(path); + + return ( + + ); +} diff --git a/apps/web/tsconfig.json b/apps/web/tsconfig.json index e4effab..01b4ddb 100644 --- a/apps/web/tsconfig.json +++ b/apps/web/tsconfig.json @@ -1,7 +1,11 @@ { "compilerOptions": { "target": "ES2017", - "lib": ["dom", "dom.iterable", "esnext"], + "lib": [ + "dom", + "dom.iterable", + "esnext" + ], "allowJs": true, "skipLibCheck": true, "strict": true, @@ -13,9 +17,24 @@ "isolatedModules": true, "jsx": "preserve", "incremental": true, - "plugins": [{ "name": "next" }], - "paths": { "@/*": ["./*"] } + "plugins": [ + { + "name": "next" + } + ], + "paths": { + "@/*": [ + "./*" + ] + } }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], - "exclude": ["node_modules"] + "include": [ + "next-env.d.ts", + "**/*.ts", + "**/*.tsx", + ".next/types/**/*.ts" + ], + "exclude": [ + "node_modules" + ] }