-
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathapp-sidebar.tsx
More file actions
123 lines (117 loc) · 2.4 KB
/
app-sidebar.tsx
File metadata and controls
123 lines (117 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
"use client"
import * as React from "react"
import {
LayoutDashboard,
Lightbulb,
FileVideo,
Handshake,
Settings,
ClipboardCheck,
Activity,
Cog,
} from "lucide-react"
import { NavMain } from "@/components/nav-main"
import { NavUser } from "@/components/nav-user"
import {
Sidebar,
SidebarContent,
SidebarFooter,
SidebarHeader,
SidebarMenu,
SidebarMenuButton,
SidebarMenuItem,
SidebarRail,
} from "@/components/ui/sidebar"
import Link from "next/link"
const navItems = [
{
title: "Dashboard",
url: "/dashboard",
icon: LayoutDashboard,
},
{
title: "Review Queue",
url: "/dashboard/review",
icon: ClipboardCheck,
},
{
title: "Pipeline",
url: "/dashboard/pipeline",
icon: Activity,
},
{
title: "Content",
url: "/dashboard/content",
icon: Lightbulb,
},
{
title: "Videos",
url: "/dashboard/videos",
icon: FileVideo,
},
{
title: "Sponsors",
url: "/dashboard/sponsors",
icon: Handshake,
},
{
title: "Config",
url: "/dashboard/config",
icon: Cog,
},
{
title: "Settings",
url: "/dashboard/settings",
icon: Settings,
},
]
const defaultUser = {
name: "CodingCat",
email: "admin@codingcat.dev",
avatar: "",
}
export function AppSidebar({
user,
...props
}: React.ComponentProps<typeof Sidebar> & {
user?: { email?: string; user_metadata?: Record<string, string> }
}) {
const userData = user
? {
name:
user.user_metadata?.full_name ||
user.email?.split("@")[0] ||
"User",
email: user.email || "",
avatar: user.user_metadata?.avatar_url || "",
}
: defaultUser
return (
<Sidebar collapsible="icon" {...props}>
<SidebarHeader>
<SidebarMenu>
<SidebarMenuItem>
<SidebarMenuButton size="lg" asChild>
<Link href="/dashboard">
<div className="flex aspect-square size-8 items-center justify-center rounded-lg bg-primary text-primary-foreground">
<LayoutDashboard className="size-4" />
</div>
<div className="grid flex-1 text-left text-sm leading-tight">
<span className="truncate font-semibold">CodingCat.dev</span>
<span className="truncate text-xs">Content Ops</span>
</div>
</Link>
</SidebarMenuButton>
</SidebarMenuItem>
</SidebarMenu>
</SidebarHeader>
<SidebarContent>
<NavMain items={navItems} />
</SidebarContent>
<SidebarFooter>
<NavUser user={userData} />
</SidebarFooter>
<SidebarRail />
</Sidebar>
)
}