|
1 | | -import { ExpandableNav } from "@/components/paul/expandable-nav"; |
2 | | -import { SingleNav } from "@/components/paul/single-nav"; |
| 1 | +import { NavExpandable } from "@/components/paul/nav-expandable"; |
| 2 | +import { NavLogo } from "@/components/paul/nav-logo"; |
| 3 | +import { NavUser } from "@/components/paul/nav-user"; |
3 | 4 | import { Sidebar, SidebarContent, SidebarFooter, SidebarHeader, SidebarRail } from "@/components/ui/sidebar"; |
4 | | -import { apiGetUrls } from "@/constants/api-urls"; |
| 5 | +import type { UserProps } from "@/types/user"; |
5 | 6 | import { |
6 | 7 | CircleStackIcon as Database, |
7 | 8 | DocumentChartBarIcon as FileChartLine, |
8 | | - HomeIcon as House, |
9 | | - InformationCircleIcon as Info, |
10 | 9 | SparklesIcon as Zap, |
11 | 10 | TableCellsIcon as Grid2X2Plus, |
12 | | - UsersIcon as UsersRound, |
13 | 11 | } from "@heroicons/react/24/outline"; |
14 | 12 | import * as React from "react"; |
15 | 13 | import { useTranslation } from "react-i18next"; |
16 | 14 |
|
17 | | -export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) { |
| 15 | +type AppSidebarProps = { |
| 16 | + user: UserProps | null | undefined; |
| 17 | +} & React.ComponentProps<typeof Sidebar>; |
| 18 | + |
| 19 | +export function AppSidebar({ user, ...props }: AppSidebarProps) { |
18 | 20 | const { t } = useTranslation(); |
19 | 21 |
|
20 | | - const data = { |
21 | | - navHome: [ |
22 | | - { |
23 | | - title: t("navigation.home"), |
24 | | - url: "/", |
25 | | - icon: House, |
26 | | - }, |
27 | | - ], |
28 | | - navMain: [ |
29 | | - { |
30 | | - title: t("navigation.datasets"), |
31 | | - url: "#", |
32 | | - icon: Database, |
33 | | - items: [ |
34 | | - { |
35 | | - title: t("navigation.test1"), |
36 | | - url: "#", |
37 | | - }, |
38 | | - { |
39 | | - title: t("navigation.test2"), |
40 | | - url: "#", |
41 | | - }, |
42 | | - ], |
43 | | - }, |
44 | | - { |
45 | | - title: t("navigation.processedData"), |
46 | | - url: "#", |
47 | | - icon: FileChartLine, |
48 | | - items: [ |
49 | | - { |
50 | | - title: t("navigation.test1"), |
51 | | - url: "#", |
52 | | - }, |
53 | | - { |
54 | | - title: t("navigation.test2"), |
55 | | - url: "#", |
56 | | - }, |
57 | | - ], |
58 | | - }, |
59 | | - { |
60 | | - title: t("navigation.actions"), |
61 | | - url: "#", |
62 | | - icon: Zap, |
63 | | - items: [ |
64 | | - { |
65 | | - title: t("navigation.test1"), |
66 | | - url: "#", |
67 | | - }, |
68 | | - { |
69 | | - title: t("navigation.test2"), |
70 | | - url: "#", |
71 | | - }, |
72 | | - ], |
73 | | - }, |
74 | | - { |
75 | | - title: t("navigation.apps"), |
76 | | - url: "#", |
77 | | - icon: Grid2X2Plus, |
78 | | - items: [ |
79 | | - { |
80 | | - title: t("navigation.test1"), |
81 | | - url: "#", |
82 | | - }, |
83 | | - { |
84 | | - title: t("navigation.test2"), |
85 | | - url: "#", |
86 | | - }, |
87 | | - ], |
88 | | - }, |
89 | | - ], |
90 | | - navMore: [ |
91 | | - { |
92 | | - title: t("navigation.team"), |
93 | | - url: apiGetUrls.teamIndex, |
94 | | - icon: UsersRound, |
95 | | - }, |
96 | | - { |
97 | | - title: t("navigation.help"), |
98 | | - url: "#", |
99 | | - icon: Info, |
100 | | - }, |
101 | | - ], |
102 | | - }; |
| 22 | + const navMain = [ |
| 23 | + { |
| 24 | + title: t("navigation.datasets"), |
| 25 | + url: "#", |
| 26 | + icon: Database, |
| 27 | + items: [ |
| 28 | + { |
| 29 | + title: t("navigation.test1"), |
| 30 | + url: "#", |
| 31 | + }, |
| 32 | + { |
| 33 | + title: t("navigation.test2"), |
| 34 | + url: "#", |
| 35 | + }, |
| 36 | + ], |
| 37 | + }, |
| 38 | + { |
| 39 | + title: t("navigation.processedData"), |
| 40 | + url: "#", |
| 41 | + icon: FileChartLine, |
| 42 | + items: [ |
| 43 | + { |
| 44 | + title: t("navigation.test1"), |
| 45 | + url: "#", |
| 46 | + }, |
| 47 | + { |
| 48 | + title: t("navigation.test2"), |
| 49 | + url: "#", |
| 50 | + }, |
| 51 | + ], |
| 52 | + }, |
| 53 | + { |
| 54 | + title: t("navigation.actions"), |
| 55 | + url: "#", |
| 56 | + icon: Zap, |
| 57 | + items: [ |
| 58 | + { |
| 59 | + title: t("navigation.test1"), |
| 60 | + url: "#", |
| 61 | + }, |
| 62 | + { |
| 63 | + title: t("navigation.test2"), |
| 64 | + url: "#", |
| 65 | + }, |
| 66 | + ], |
| 67 | + }, |
| 68 | + { |
| 69 | + title: t("navigation.apps"), |
| 70 | + url: "#", |
| 71 | + icon: Grid2X2Plus, |
| 72 | + items: [ |
| 73 | + { |
| 74 | + title: t("navigation.test1"), |
| 75 | + url: "#", |
| 76 | + }, |
| 77 | + { |
| 78 | + title: t("navigation.test2"), |
| 79 | + url: "#", |
| 80 | + }, |
| 81 | + ], |
| 82 | + }, |
| 83 | + ]; |
103 | 84 |
|
104 | 85 | return ( |
105 | 86 | <Sidebar collapsible="icon" {...props}> |
106 | | - <SidebarHeader></SidebarHeader> |
| 87 | + <SidebarHeader> |
| 88 | + <NavLogo /> |
| 89 | + </SidebarHeader> |
107 | 90 | <SidebarContent> |
108 | | - <SingleNav items={data.navHome} /> |
109 | | - <ExpandableNav items={data.navMain} /> |
| 91 | + <NavExpandable items={navMain} /> |
110 | 92 | </SidebarContent> |
111 | | - <SidebarFooter> |
112 | | - <SingleNav items={data.navMore} /> |
113 | | - </SidebarFooter> |
| 93 | + <SidebarFooter>{user && <NavUser user={user} />}</SidebarFooter> |
114 | 94 | <SidebarRail /> |
115 | 95 | </Sidebar> |
116 | 96 | ); |
|
0 commit comments