From 5b62062cba62de641e92ee2607ff3e85ccb5fd20 Mon Sep 17 00:00:00 2001 From: ngc2207 Date: Sat, 2 Nov 2024 23:41:11 +0800 Subject: [PATCH] refactor: rename dashboard components and layout --- public/litchi.svg | 74 +++++++++++++++++++++++ src/app/dashboard/page.tsx | 52 ---------------- src/app/layout.tsx | 11 +++- src/app/page.tsx | 2 +- src/components/app-sidebar.tsx | 101 ++++++++++---------------------- src/components/header.tsx | 13 ++++ src/components/nav-main.tsx | 2 +- src/components/nav-projects.tsx | 10 ++-- src/components/nav-user.tsx | 26 ++------ 9 files changed, 138 insertions(+), 153 deletions(-) create mode 100644 public/litchi.svg delete mode 100644 src/app/dashboard/page.tsx create mode 100644 src/components/header.tsx diff --git a/public/litchi.svg b/public/litchi.svg new file mode 100644 index 0000000..8afedf9 --- /dev/null +++ b/public/litchi.svg @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/app/dashboard/page.tsx b/src/app/dashboard/page.tsx deleted file mode 100644 index 15d6c6d..0000000 --- a/src/app/dashboard/page.tsx +++ /dev/null @@ -1,52 +0,0 @@ -import { AppSidebar } from "@/components/app-sidebar"; -import { - Breadcrumb, - BreadcrumbItem, - BreadcrumbLink, - BreadcrumbList, - BreadcrumbPage, - BreadcrumbSeparator, -} from "@/components/ui/breadcrumb"; -import { Separator } from "@/components/ui/separator"; -import { - SidebarInset, - SidebarProvider, - SidebarTrigger, -} from "@/components/ui/sidebar"; - -export default function DashboardPage() { - return ( - - - -
-
- - - - - - - Building Your Application - - - - - Data Fetching - - - -
-
-
-
-
-
-
-
-
-
- - - ); -} diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 7b387d2..932930f 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -2,6 +2,9 @@ import "@/app/globals.css"; import { cn } from "@/lib/utils"; import type { Metadata } from "next"; import { Inter } from "next/font/google"; +import Header from "@/components/header"; +import { AppSidebar } from "@/components/app-sidebar"; +import { SidebarInset, SidebarProvider } from "@/components/ui/sidebar"; const inter = Inter({ subsets: ["latin"], variable: "--font-sans" }); @@ -19,7 +22,13 @@ export default function RootLayout({ return ( - {children} + + + +
+ {children} + + ); diff --git a/src/app/page.tsx b/src/app/page.tsx index bd1c25b..9f26e35 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,3 +1,3 @@ export default function HomePage() { - return
Home Page
; + return
Home Page
; } diff --git a/src/components/app-sidebar.tsx b/src/components/app-sidebar.tsx index 5cbb623..165ea91 100644 --- a/src/components/app-sidebar.tsx +++ b/src/components/app-sidebar.tsx @@ -2,18 +2,16 @@ import * as React from "react"; import { + BicepsFlexed, BookOpen, Bot, - Command, - Frame, + GraduationCap, LifeBuoy, Map, - PieChart, Send, Settings2, - SquareTerminal, + SquarePen, } from "lucide-react"; - import { NavMain } from "@/components/nav-main"; import { NavProjects } from "@/components/nav-projects"; import { NavSecondary } from "@/components/nav-secondary"; @@ -30,125 +28,86 @@ import { const data = { user: { - name: "shadcn", - email: "m@example.com", - avatar: "/avatars/shadcn.jpg", + name: "ngc2207", + email: "cfngc3109@gmail.com", + avatar: "/litchi.svg", }, navMain: [ { - title: "Playground", - url: "#", - icon: SquareTerminal, + title: "测验", + url: "/quiz", + icon: SquarePen, isActive: true, items: [ { - title: "History", - url: "#", - }, - { - title: "Starred", - url: "#", - }, - { - title: "Settings", + title: "提交记录", url: "#", }, ], }, { - title: "Models", + title: "AI助教", url: "#", icon: Bot, items: [ { - title: "Genesis", - url: "#", - }, - { - title: "Explorer", - url: "#", - }, - { - title: "Quantum", + title: "设置", url: "#", }, ], }, { - title: "Documentation", + title: "文档", url: "#", icon: BookOpen, items: [ { - title: "Introduction", + title: "简介", url: "#", }, { - title: "Get Started", + title: "入门指南", url: "#", }, { - title: "Tutorials", + title: "教程", url: "#", }, { - title: "Changelog", + title: "更新日志", url: "#", }, ], }, { - title: "Settings", + title: "应用设置", url: "#", icon: Settings2, - items: [ - { - title: "General", - url: "#", - }, - { - title: "Team", - url: "#", - }, - { - title: "Billing", - url: "#", - }, - { - title: "Limits", - url: "#", - }, - ], }, ], navSecondary: [ { - title: "Support", + title: "支持", url: "#", icon: LifeBuoy, }, { - title: "Feedback", + title: "反馈", url: "#", icon: Send, }, ], projects: [ { - name: "Design Engineering", - url: "#", - icon: Frame, - }, - { - name: "Sales & Marketing", - url: "#", - icon: PieChart, - }, - { - name: "Travel", + name: "校园助手", url: "#", icon: Map, }, + { + name: "健身俱乐部", + url: "#", + icon: BicepsFlexed, + }, ], }; @@ -159,13 +118,13 @@ export function AppSidebar({ ...props }: React.ComponentProps) { - +
- +
- Acme Inc - Enterprise + 上海电力大学 + 教育机构
diff --git a/src/components/header.tsx b/src/components/header.tsx new file mode 100644 index 0000000..43324ab --- /dev/null +++ b/src/components/header.tsx @@ -0,0 +1,13 @@ +import { Separator } from "@/components/ui/separator"; +import { SidebarTrigger } from "@/components/ui/sidebar"; + +export default function Header() { + return ( +
+
+ + +
+
+ ); +} diff --git a/src/components/nav-main.tsx b/src/components/nav-main.tsx index 9be7b11..05cbf85 100644 --- a/src/components/nav-main.tsx +++ b/src/components/nav-main.tsx @@ -35,7 +35,7 @@ export function NavMain({ }) { return ( - Platform + 学习 {items.map((item) => ( diff --git a/src/components/nav-projects.tsx b/src/components/nav-projects.tsx index 5b0bb50..a963a7e 100644 --- a/src/components/nav-projects.tsx +++ b/src/components/nav-projects.tsx @@ -38,7 +38,7 @@ export function NavProjects({ return ( - Projects + 生活 {projects.map((item) => ( @@ -62,16 +62,16 @@ export function NavProjects({ > - View Project + 查看群组 - Share Project + 分享群组 - Delete Project + 删除群组 @@ -80,7 +80,7 @@ export function NavProjects({ - More + 更多 diff --git a/src/components/nav-user.tsx b/src/components/nav-user.tsx index 2019263..55c527b 100644 --- a/src/components/nav-user.tsx +++ b/src/components/nav-user.tsx @@ -1,13 +1,6 @@ "use client"; -import { - BadgeCheck, - Bell, - ChevronsUpDown, - CreditCard, - LogOut, - Sparkles, -} from "lucide-react"; +import { Bell, LogOut, BadgeCheck, ChevronsUpDown } from "lucide-react"; import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; import { @@ -76,31 +69,20 @@ export function NavUser({
- - - - Upgrade to Pro - - - - Account - - - - Billing + 帐号 - Notifications + 通知 - Log out + 登出