diff --git a/apps/blockwarriors-next/src/app/dashboard/(components)/DashboardSidebar.tsx b/apps/blockwarriors-next/src/app/dashboard/(components)/DashboardSidebar.tsx index 2b5d1b6..118c249 100644 --- a/apps/blockwarriors-next/src/app/dashboard/(components)/DashboardSidebar.tsx +++ b/apps/blockwarriors-next/src/app/dashboard/(components)/DashboardSidebar.tsx @@ -13,6 +13,7 @@ import { } from 'lucide-react'; import { Button } from '@/components/ui/button'; import Link from 'next/link'; +import { usePathname } from 'next/navigation'; import Image from 'next/image'; import { Tooltip, @@ -56,20 +57,30 @@ interface NavButtonProps { href: string; children: React.ReactNode; hasCompletedSetup: boolean; + isActive: boolean; } -const NavButton = ({ href, children, hasCompletedSetup }: NavButtonProps) => { +const NavButton = ({ href, children, hasCompletedSetup, isActive }: NavButtonProps) => { if (!hasCompletedSetup && href !== '/dashboard/setup') { return {children}; } return ( - ); }; export function DashboardSidebar({ className = '' }: SidebarProps) { + const pathname = usePathname(); const { data: session } = authClient.useSession(); const userId = session?.user?.id; @@ -80,6 +91,9 @@ export function DashboardSidebar({ className = '' }: SidebarProps) { const hasCompletedSetup = Boolean(userProfile?.first_name && userProfile?.team); + const isActive = (href: string) => + href === '/dashboard' ? pathname === '/dashboard' : pathname.startsWith(href); + return (
@@ -114,7 +128,7 @@ export function DashboardSidebar({ className = '' }: SidebarProps) {
{!hasCompletedSetup && ( - +
Get Started (Required) @@ -122,37 +136,37 @@ export function DashboardSidebar({ className = '' }: SidebarProps) { )} - +
Overview
- +
Matches
- +
All Teams
- +
Leaderboard
- +
Tournaments
- +
Practice @@ -161,13 +175,13 @@ export function DashboardSidebar({ className = '' }: SidebarProps) { {hasCompletedSetup && (
- +
My Profile
- +
My Team