Skip to content

Commit 4322b73

Browse files
authored
Merge pull request #123 from Logannford/amends/dashboard-style-changes
first round of dashboard changes
2 parents 0605fc2 + 53ec29a commit 4322b73

File tree

8 files changed

+134
-66
lines changed

8 files changed

+134
-66
lines changed

src/app/(default_layout)/dashboard/page.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,22 @@ import { Separator } from '@/components/ui/separator';
55

66
export default async function Dashboard() {
77
return (
8-
<div className="text-white flex flex-col gap-y-4">
8+
<div className="text-white flex flex-col gap-y-4 h-full">
99
<div className="flex w-full justify-between">
1010
<h1 className="text-xl md:text-4xl font-satoshi font-semibold">
11-
Welcome back!
11+
Overview
1212
</h1>
1313
<div className="flex item-center gap-x-3">
1414
<LanguageSwitcher />
1515
<div className="lg:hidden flex">
1616
<UserProfileDropdown />
1717
</div>
1818
</div>
19-
{/** userData?.userLevel === 'ADMIN' && <AdminButton /> */}
2019
</div>
2120
<Separator className="bg-black-50" />
22-
<DashboardBentoGrid />
21+
<div className=" h-full">
22+
<DashboardBentoGrid />
23+
</div>
2324
</div>
2425
);
2526
}

src/app/(default_layout)/layout.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ export default function Layout({
2525
>
2626
<SidebarProvider>
2727
{/* Fixed background gradient */}
28-
<div className="fixed inset-0 bg-gradient-to-t from-[#f0db4f]/5 via-transparent to-transparent pointer-events-none"></div>
28+
{/* <div className="fixed inset-0 bg-gradient-to-t from-[#f0db4f]/5 via-transparent to-transparent pointer-events-none"></div> */}
2929

3030
{/* Scrollable content */}
3131
<AppSidebar />
32-
<main className="w-full pr-6 py-6 lg:pt-8 lg:pb-3 lg:ml-break-out pl-break-out">
32+
<main className="w-full pr-6 py-6 lg:pt-8 lg:pb-3">
3333
<div className="lg:pl-4 h-full">
34-
<SidebarTrigger className="size-4 h-full flex items-center my-auto -top-2.5 relative" />
34+
{/* <SidebarTrigger className="size-4 h-full flex items-center my-auto -top-2.5 relative" /> */}
3535
{children}
3636
</div>
3737
</main>

src/components/global/navigation/sidebar-footer.tsx

Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,28 @@
22
import {
33
SidebarFooter,
44
SidebarMenu,
5-
SidebarMenuButton,
65
SidebarMenuItem,
76
} from '@/components/ui/sidebar';
8-
import {
9-
DropdownMenu,
10-
DropdownMenuContent,
11-
DropdownMenuItem,
12-
DropdownMenuTrigger,
13-
} from '@/components/ui/dropdown-menu';
14-
import { ChevronUp, User2 } from 'lucide-react';
157
import { useUser } from '@/hooks/useUser';
16-
import { getUserDisplayName } from '@/utils/user';
17-
import LoadingSpinner from '@/components/ui/loading';
18-
import LogoutButton from '../logout';
19-
import Link from 'next/link';
20-
21-
export default function SidebarFooterComponent() {
22-
const { user, isError, isLoading } = useUser();
8+
import { Button } from '@/components/ui/button';
239

24-
return (
25-
<SidebarFooter>
26-
<SidebarMenu>
27-
<SidebarMenuItem>
28-
<DropdownMenu>
29-
<DropdownMenuTrigger asChild>
30-
<SidebarMenuButton>
10+
{
11+
/* <DropdownMenu>
12+
{/* <DropdownMenuTrigger asChild>
13+
<SidebarMenuButton
14+
variant="outline"
15+
className="bg-black-100 text-white"
16+
>
3117
<User2 />
3218
{isLoading && <LoadingSpinner />}
3319
{isError && 'Error'}
3420
{user && getUserDisplayName(user)}
3521
<ChevronUp className="ml-auto" />
3622
</SidebarMenuButton>
37-
</DropdownMenuTrigger>
38-
<DropdownMenuContent
23+
</DropdownMenuTrigger> */
24+
}
25+
{
26+
/* <DropdownMenuContent
3927
side="top"
4028
className="w-[--radix-popper-anchor-width] bg-black-75 border-black-50 text-white"
4129
>
@@ -58,8 +46,29 @@ export default function SidebarFooterComponent() {
5846
<LogoutButton variant="ghost" padding="none" />
5947
</DropdownMenuItem>
6048
</DropdownMenuContent>
61-
</DropdownMenu>
62-
</SidebarMenuItem>
49+
</DropdownMenu> */
50+
}
51+
52+
export default function SidebarFooterComponent() {
53+
const { user, isError, isLoading } = useUser();
54+
55+
return (
56+
<SidebarFooter>
57+
<SidebarMenu>
58+
{user?.userLevel !== 'PREMIUM' && (
59+
<SidebarMenuItem className="font-semibold font-ubuntu text-center flex flex-col gap-y-1 items-center justify-center rounded-lg border border-black-75 py-4 px-2">
60+
<p className="text-sm">
61+
Upgrade to{' '}
62+
{user?.userLevel !== 'STANDARD' ? 'Standard' : 'Premium'}
63+
</p>
64+
<p className="text-xs font-light">
65+
Elevate your development skills
66+
</p>
67+
<Button variant="accent" fullWidth className="mt-2" href="/upgrade">
68+
Upgrade
69+
</Button>
70+
</SidebarMenuItem>
71+
)}
6372
</SidebarMenu>
6473
</SidebarFooter>
6574
);

src/components/global/navigation/sidebar-submenu-item.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,28 @@ import {
55
} from '@/components/ui/sidebar';
66
import type { SidebarItem } from '@/types/Sidebar';
77
import Link from 'next/link';
8+
import { usePathname } from 'next/navigation';
89

910
export default function AppSidebarSubMenuItem(opts: { item: SidebarItem }) {
11+
const pathname = usePathname();
12+
1013
const { item } = opts;
1114
if (!item.subItems) return null;
1215

1316
return (
1417
<SidebarMenuSub>
1518
{item?.subItems.map((subItem) => (
16-
<SidebarMenuSubItem key={subItem.title}>
19+
<SidebarMenuSubItem key={subItem.url}>
1720
<SidebarMenuSubButton asChild>
18-
<Link href={subItem.url} prefetch className="font-ubuntu text-lg">
21+
<Link
22+
href={subItem.url}
23+
prefetch
24+
className={`flex items-center font-ubuntu text-sm py-2 ${
25+
pathname === subItem.url
26+
? 'bg-white !text-black border border-black-75'
27+
: ''
28+
}`}
29+
>
1930
{subItem.title}
2031
</Link>
2132
</SidebarMenuSubButton>

src/components/global/navigation/sidebar.tsx

Lines changed: 66 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import {
1010
User,
1111
Bell,
1212
CreditCard,
13+
RouteIcon,
14+
HelpCircle,
1315
} from 'lucide-react';
1416
import {
1517
Sidebar,
@@ -20,6 +22,7 @@ import {
2022
SidebarMenu,
2123
SidebarMenuButton,
2224
SidebarMenuItem,
25+
SidebarSeparator,
2326
SidebarTrigger,
2427
} from '@/components/ui/sidebar';
2528
import {
@@ -51,7 +54,10 @@ export function AppSidebar() {
5154
// Menu items
5255
const standardItems: SidebarItemType[] = [
5356
{
54-
title: 'Home',
57+
groupLabel: 'menu',
58+
},
59+
{
60+
title: 'Dashboard',
5561
url: '/dashboard',
5662
icon: Home,
5763
},
@@ -75,8 +81,27 @@ export function AppSidebar() {
7581
],
7682
},
7783
{
78-
title: 'Stats',
84+
title: (
85+
<>
86+
{user?.userLevel === 'ADMIN' ||
87+
(user?.userLevel === 'PREMIUM' &&
88+
!pathname.startsWith('/settings')) ? (
89+
<p>Roadmap</p>
90+
) : (
91+
<div className="flex items-center gap-3">
92+
<p>Roadmap</p>
93+
<LockIcon className="size-4" />
94+
</div>
95+
)}
96+
</>
97+
),
7998
url: '#',
99+
icon: RouteIcon,
100+
disabled: user?.userLevel !== 'ADMIN' && user?.userLevel !== 'PREMIUM',
101+
},
102+
{
103+
title: 'Stats',
104+
url: '/',
80105
icon: ChartBarIncreasing,
81106
chip: ComingSoonChip,
82107
},
@@ -85,6 +110,14 @@ export function AppSidebar() {
85110
url: '/leaderboard/today',
86111
icon: Award,
87112
},
113+
{
114+
groupLabel: 'Support',
115+
},
116+
{
117+
title: 'Help',
118+
url: '/help',
119+
icon: HelpCircle,
120+
},
88121
{
89122
title: 'Settings',
90123
url: '/settings/profile',
@@ -139,25 +172,23 @@ export function AppSidebar() {
139172
const renderSidebarItem = (item: SidebarItemType) => {
140173
if ('groupLabel' in item) {
141174
return (
142-
<SidebarGroup key={item.groupLabel}>
143-
<SidebarGroupLabel className="px-0 h-fit text-base xl:text-lg font-ubuntutoshi">
175+
<SidebarGroup key={item.groupLabel} className="mt-2">
176+
<SidebarGroupLabel className="px-0 py-0 h-fit text-sm font-ubuntutoshi">
144177
{item.groupLabel}
145178
</SidebarGroupLabel>
146179
</SidebarGroup>
147180
);
148181
}
149182

150183
return (
151-
<SidebarMenuItem key={item.title}>
184+
<SidebarMenuItem key={item.url}>
152185
{item.subItems ? (
153186
<Collapsible defaultOpen className="group/collapsible">
154187
<CollapsibleTrigger asChild>
155188
<SidebarMenuButton asChild>
156189
<div className="flex items-center w-full">
157190
{item.icon && <item.icon />}
158-
<span className="text-base xl:text-lg font-ubuntutoshi">
159-
{item.title}
160-
</span>
191+
<span className="text-sm font-ubuntutoshi">{item.title}</span>
161192
<div className="ms-auto">{item.chip && <item.chip />}</div>
162193
</div>
163194
</SidebarMenuButton>
@@ -168,37 +199,49 @@ export function AppSidebar() {
168199
</Collapsible>
169200
) : (
170201
<SidebarMenuButton asChild>
171-
<Link
172-
href={item.url}
173-
prefetch
174-
className={`flex items-center font-ubuntutoshi text-base ${
175-
pathname === item.url ? 'bg-black' : ''
176-
}`}
177-
>
178-
{item.icon && <item.icon />}
179-
<span className="text-base xl:text-lg">{item.title}</span>
180-
<div className="ms-auto">{item.chip && <item.chip />}</div>
181-
</Link>
202+
{item.disabled ? (
203+
<SidebarMenuItem className="flex items-center font-ubuntu text-sm p-2 gap-x-2 opacity-50 hover:cursor-not-allowed h-8">
204+
{item.icon && <item.icon />}
205+
<span className="text-sm font-ubuntutoshi">{item.title}</span>
206+
<div className="ms-auto">{item.chip && <item.chip />}</div>
207+
</SidebarMenuItem>
208+
) : (
209+
<Link
210+
href={item.url}
211+
prefetch
212+
className={`flex items-center font-ubuntu text-sm py-2 ${
213+
pathname === item.url
214+
? 'bg-white text-black border border-black-75'
215+
: ''
216+
}`}
217+
>
218+
{item.icon && <item.icon />}
219+
<span className="text-sm">
220+
<>{item.title}</>
221+
</span>
222+
<div className="ms-auto">{item.chip && <item.chip />}</div>
223+
</Link>
224+
)}
182225
</SidebarMenuButton>
183226
)}
184227
</SidebarMenuItem>
185228
);
186229
};
187230

188231
return (
189-
<Sidebar className="p-3 rounded-xl">
190-
<SidebarContent className="p-2">
232+
<Sidebar>
233+
<SidebarContent className="py-6">
191234
<SidebarGroup>
192235
<SidebarGroupLabel className="w-full flex items-center justify-between">
193236
<Link
194237
href="/dashboard"
195-
className="text-base xl:text-lg lg:text-3xl font-bold font-ubuntu hover:text-white duration-300"
238+
className="text-sm xl:text-2xl font-ubuntu hover:text-white duration-300"
196239
prefetch
197240
>
198241
meerge
199242
</Link>
200243
</SidebarGroupLabel>
201-
<SidebarGroupContent className="mt-4">
244+
<SidebarGroupContent className="mt-5">
202245
<SidebarMenu>
203246
{items.map((item) => renderSidebarItem(item))}
204247
</SidebarMenu>

src/components/ui/bento-grid.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const BentoGrid = ({
99
children?: React.ReactNode;
1010
}) => {
1111
return (
12-
<div className={cn('grid grid-cols-1 md:grid-cols-3 gap-4 ', className)}>
12+
<div className={cn('grid grid-cols-1 md:grid-cols-3 gap-6 ', className)}>
1313
{children}
1414
</div>
1515
);

src/components/ui/sidebar.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121

2222
const SIDEBAR_COOKIE_NAME = 'sidebar:state';
2323
const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
24-
const SIDEBAR_WIDTH = '17rem';
24+
const SIDEBAR_WIDTH = '15rem';
2525
const SIDEBAR_WIDTH_MOBILE = '18rem';
2626
const SIDEBAR_WIDTH_ICON = '3rem';
2727
const SIDEBAR_KEYBOARD_SHORTCUT = 'b';
@@ -199,7 +199,7 @@ const Sidebar = React.forwardRef<
199199
<SheetContent
200200
data-sidebar="sidebar"
201201
data-mobile="true"
202-
className="w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden"
202+
className="w-[--sidebar-width] p-0 text-sidebar-foreground [&>button]:hidden"
203203
style={
204204
{
205205
'--sidebar-width': SIDEBAR_WIDTH_MOBILE,
@@ -249,7 +249,7 @@ const Sidebar = React.forwardRef<
249249
>
250250
<div
251251
data-sidebar="sidebar"
252-
className="flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-black-50 group-data-[variant=floating]:shadow rounded-xl"
252+
className="flex h-full w-full flex-col border-r border-black-50 group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-black-50 group-data-[variant=floating]:shadow"
253253
>
254254
{children}
255255
</div>
@@ -422,7 +422,10 @@ const SidebarGroup = React.forwardRef<
422422
<div
423423
ref={ref}
424424
data-sidebar="group"
425-
className={cn('relative flex w-full min-w-0 flex-col p-2', className)}
425+
className={cn(
426+
'relative flex w-full min-w-0 flex-col px-2 py-0',
427+
className
428+
)}
426429
{...props}
427430
/>
428431
);

src/types/Sidebar.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
export interface SidebarItem {
2-
title: string;
2+
title: string | React.ReactNode;
33
url: string;
44
icon?: React.ComponentType;
55
subItems?: SidebarItem[];
66
chip?: React.ComponentType;
7-
groupLabel?: string
7+
groupLabel?: string;
8+
disabled?: boolean;
89
}
910

1011
export interface SidebarGroupItem {
1112
groupLabel: string;
1213
}
1314

14-
export type SidebarItemType = SidebarItem | SidebarGroupItem;
15+
export type SidebarItemType = SidebarItem | SidebarGroupItem;

0 commit comments

Comments
 (0)