From 1a6954a591e86fa789f15e73891133226b5262ee Mon Sep 17 00:00:00 2001 From: zhangtao25 Date: Sat, 16 Nov 2024 22:53:28 +0800 Subject: [PATCH] chore: repo overall update --- .../canyon-platform/app/dashboard/page.tsx | 55 +++++ packages/canyon-platform/app/layout.tsx | 11 +- .../components/app-sidebar.tsx | 189 ++++++++++++++++++ .../canyon-platform/components/nav-main.tsx | 73 +++++++ .../components/nav-projects.tsx | 89 +++++++++ .../canyon-platform/components/nav-user.tsx | 114 +++++++++++ .../components/team-switcher.tsx | 89 +++++++++ 7 files changed, 615 insertions(+), 5 deletions(-) create mode 100644 packages/canyon-platform/app/dashboard/page.tsx create mode 100644 packages/canyon-platform/components/app-sidebar.tsx create mode 100644 packages/canyon-platform/components/nav-main.tsx create mode 100644 packages/canyon-platform/components/nav-projects.tsx create mode 100644 packages/canyon-platform/components/nav-user.tsx create mode 100644 packages/canyon-platform/components/team-switcher.tsx diff --git a/packages/canyon-platform/app/dashboard/page.tsx b/packages/canyon-platform/app/dashboard/page.tsx new file mode 100644 index 00000000..5abc6207 --- /dev/null +++ b/packages/canyon-platform/app/dashboard/page.tsx @@ -0,0 +1,55 @@ +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 Page() { + return ( + + + +
+
+
+ {/**/} + {/**/} + + + + + Building Your Application + + + + + Data Fetching + + + +
+
+
+
+
+
+
+
+
+
+
+ + + ) +} diff --git a/packages/canyon-platform/app/layout.tsx b/packages/canyon-platform/app/layout.tsx index 09fe3051..88450ef7 100644 --- a/packages/canyon-platform/app/layout.tsx +++ b/packages/canyon-platform/app/layout.tsx @@ -1,9 +1,10 @@ import { AntdRegistry } from "@ant-design/nextjs-registry"; import type React from "react"; import "./globals.css"; -import MainBox from "@/components/main-box"; +// import MainBox from "@/components/main-box"; import localFont from "next/font/local"; -import {SidebarProvider} from "canyon-ui/components/ui/sidebar"; +import {SidebarProvider} from "@/components/ui/sidebar"; +// import {SidebarProvider} from "canyon-ui/components/ui/sidebar"; // import 'antd/dist/reset.css' const geistSans = localFont({ @@ -23,12 +24,12 @@ const RootLayout = ({ children }: React.PropsWithChildren) => ( - + <> - {children} + <>{children} - + ); diff --git a/packages/canyon-platform/components/app-sidebar.tsx b/packages/canyon-platform/components/app-sidebar.tsx new file mode 100644 index 00000000..82f61ce3 --- /dev/null +++ b/packages/canyon-platform/components/app-sidebar.tsx @@ -0,0 +1,189 @@ +"use client" + +import * as React from "react" +import { + AudioWaveform, + BookOpen, + Bot, + Command, + Frame, + GalleryVerticalEnd, + Map, + PieChart, + Settings2, + SquareTerminal, +} from "lucide-react" + +import { NavMain } from "@/components/nav-main" +import { NavProjects } from "@/components/nav-projects" +import { NavUser } from "@/components/nav-user" +import { TeamSwitcher } from "@/components/team-switcher" +import { + Sidebar, + SidebarContent, + SidebarFooter, + SidebarHeader, SidebarMenu, SidebarMenuButton, SidebarMenuItem, + SidebarRail, +} from "@/components/ui/sidebar" + +// This is sample data. +const data = { + user: { + name: "shadcn", + email: "m@example.com", + avatar: "/avatars/shadcn.jpg", + }, + teams: [ + { + name: "Acme Inc", + logo: GalleryVerticalEnd, + plan: "Enterprise", + }, + { + name: "Acme Corp.", + logo: AudioWaveform, + plan: "Startup", + }, + { + name: "Evil Corp.", + logo: Command, + plan: "Free", + }, + ], + navMain: [ + { + title: "Playground", + url: "#", + icon: SquareTerminal, + isActive: true, + items: [ + { + title: "History", + url: "#", + }, + { + title: "Starred", + url: "#", + }, + { + title: "Settings", + url: "#", + }, + ], + }, + { + title: "Models", + url: "#", + icon: Bot, + items: [ + { + title: "Genesis", + url: "#", + }, + { + title: "Explorer", + url: "#", + }, + { + title: "Quantum", + url: "#", + }, + ], + }, + { + title: "Documentation", + url: "#", + icon: BookOpen, + items: [ + { + title: "Introduction", + url: "#", + }, + { + title: "Get Started", + url: "#", + }, + { + title: "Tutorials", + url: "#", + }, + { + title: "Changelog", + url: "#", + }, + ], + }, + { + title: "Settings", + url: "#", + icon: Settings2, + items: [ + { + title: "General", + url: "#", + }, + { + title: "Team", + url: "#", + }, + { + title: "Billing", + url: "#", + }, + { + title: "Limits", + url: "#", + }, + ], + }, + ], + projects: [ + { + name: "Design Engineering", + url: "#", + icon: Frame, + }, + { + name: "Sales & Marketing", + url: "#", + icon: PieChart, + }, + { + name: "Travel", + url: "#", + icon: Map, + }, + ], +} + +export function AppSidebar({ ...props }: React.ComponentProps) { + return ( + + + + + + +
+ +
+
+ Acme Inc + Enterprise +
+
+
+
+
+
+ + + + + + + + +
+ ) +} diff --git a/packages/canyon-platform/components/nav-main.tsx b/packages/canyon-platform/components/nav-main.tsx new file mode 100644 index 00000000..1d71af13 --- /dev/null +++ b/packages/canyon-platform/components/nav-main.tsx @@ -0,0 +1,73 @@ +"use client" + +import { ChevronRight, type LucideIcon } from "lucide-react" + +import { + Collapsible, + CollapsibleContent, + CollapsibleTrigger, +} from "@/components/ui/collapsible" +import { + SidebarGroup, + SidebarGroupLabel, + SidebarMenu, + SidebarMenuButton, + SidebarMenuItem, + SidebarMenuSub, + SidebarMenuSubButton, + SidebarMenuSubItem, +} from "@/components/ui/sidebar" + +export function NavMain({ + items, +}: { + items: { + title: string + url: string + icon?: LucideIcon + isActive?: boolean + items?: { + title: string + url: string + }[] + }[] +}) { + return ( + + Platform + + {items.map((item) => ( + + + + + {item.icon && } + {item.title} + + + + + + {item.items?.map((subItem) => ( + + + + {subItem.title} + + + + ))} + + + + + ))} + + + ) +} diff --git a/packages/canyon-platform/components/nav-projects.tsx b/packages/canyon-platform/components/nav-projects.tsx new file mode 100644 index 00000000..f50b20de --- /dev/null +++ b/packages/canyon-platform/components/nav-projects.tsx @@ -0,0 +1,89 @@ +"use client" + +import { + Folder, + Forward, + MoreHorizontal, + Trash2, + type LucideIcon, +} from "lucide-react" + +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuSeparator, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu" +import { + SidebarGroup, + SidebarGroupLabel, + SidebarMenu, + SidebarMenuAction, + SidebarMenuButton, + SidebarMenuItem, + useSidebar, +} from "@/components/ui/sidebar" + +export function NavProjects({ + projects, +}: { + projects: { + name: string + url: string + icon: LucideIcon + }[] +}) { + const { isMobile } = useSidebar() + + return ( + + Projects + + {projects.map((item) => ( + + + + + {item.name} + + + + + + + More + + + + + + View Project + + + + Share Project + + + + + Delete Project + + + + + ))} + + + + More + + + + + ) +} diff --git a/packages/canyon-platform/components/nav-user.tsx b/packages/canyon-platform/components/nav-user.tsx new file mode 100644 index 00000000..d12ef780 --- /dev/null +++ b/packages/canyon-platform/components/nav-user.tsx @@ -0,0 +1,114 @@ +"use client" + +import { + BadgeCheck, + Bell, + ChevronsUpDown, + CreditCard, + LogOut, + Sparkles, +} from "lucide-react" + +import { + Avatar, + AvatarFallback, + AvatarImage, +} from "@/components/ui/avatar" +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuGroup, + DropdownMenuItem, + DropdownMenuLabel, + DropdownMenuSeparator, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu" +import { + SidebarMenu, + SidebarMenuButton, + SidebarMenuItem, + useSidebar, +} from "@/components/ui/sidebar" + +export function NavUser({ + user, +}: { + user: { + name: string + email: string + avatar: string + } +}) { + const { isMobile } = useSidebar() + + return ( + + + + + + + + CN + +
+ {user.name} + {user.email} +
+ +
+
+ + +
+ + + CN + +
+ {user.name} + {user.email} +
+
+
+ + + + + Upgrade to Pro + + + + + + + Account + + + + Billing + + + + Notifications + + + + + + Log out + +
+
+
+
+ ) +} diff --git a/packages/canyon-platform/components/team-switcher.tsx b/packages/canyon-platform/components/team-switcher.tsx new file mode 100644 index 00000000..2808e0a4 --- /dev/null +++ b/packages/canyon-platform/components/team-switcher.tsx @@ -0,0 +1,89 @@ +"use client" + +import * as React from "react" +import { ChevronsUpDown, Plus } from "lucide-react" + +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuLabel, + DropdownMenuSeparator, + DropdownMenuShortcut, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu" +import { + SidebarMenu, + SidebarMenuButton, + SidebarMenuItem, + useSidebar, +} from "@/components/ui/sidebar" + +export function TeamSwitcher({ + teams, +}: { + teams: { + name: string + logo: React.ElementType + plan: string + }[] +}) { + const { isMobile } = useSidebar() + const [activeTeam, setActiveTeam] = React.useState(teams[0]) + + return ( + + + + + +
+ +
+
+ + {activeTeam.name} + + {activeTeam.plan} +
+ +
+
+ + + Teams + + {teams.map((team, index) => ( + setActiveTeam(team)} + className="gap-2 p-2" + > +
+ +
+ {team.name} + ⌘{index + 1} +
+ ))} + + +
+ +
+
Add team
+
+
+
+
+
+ ) +}