Refactor header navigation to hamburger menu

This commit is contained in:
Avery Felts 2026-01-24 13:17:23 -07:00
parent edfc978217
commit 4d65ac0360

View File

@ -22,7 +22,7 @@ import { fetchPreferences, fetchReminderSettings, saveReminderSettings, Reminder
import { useNotifications } from '@/hooks/useNotifications';
import { useEffect, useState } from 'react';
import { useRouter } from 'next/navigation';
import { Cigarette, Leaf, LogOut, Home, ChevronDown, Sun, Moon, Bell, BellOff, BellRing } from 'lucide-react';
import { Cigarette, Leaf, LogOut, Home, ChevronDown, Sun, Moon, Bell, BellOff, BellRing, Menu } from 'lucide-react';
import { useTheme } from '@/lib/theme-context';
interface UserHeaderProps {
@ -143,14 +143,15 @@ export function UserHeader({ user, preferences }: UserHeaderProps) {
<Sun className="h-5 w-5 text-yellow-400 transition-transform duration-300" />
)}
</button>
{/* Main Navigation Menu */}
<DropdownMenu>
<DropdownMenuTrigger asChild>
<button className="flex items-center gap-2 px-3 py-2 rounded-full bg-muted hover:bg-muted/80 transition-all focus:outline-none focus:ring-2 focus:ring-primary/30">
<Avatar className="h-8 w-8 ring-2 ring-primary/30">
<AvatarImage src={user.profilePictureUrl ?? undefined} alt={userName || 'User'} />
<AvatarFallback className="bg-primary/20 text-primary text-sm">{initials}</AvatarFallback>
</Avatar>
<ChevronDown className="h-4 w-4 text-muted-foreground" />
<button
className="p-2.5 sm:p-2 rounded-full bg-muted hover:bg-muted/80 transition-all duration-300 focus:outline-none focus:ring-2 focus:ring-primary/30 hover:scale-110 active:scale-95"
aria-label="Open menu"
>
<Menu className="h-5 w-5 text-muted-foreground" />
</button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end" sideOffset={8}>
@ -167,6 +168,25 @@ export function UserHeader({ user, preferences }: UserHeaderProps) {
<Leaf className="mr-3 h-4 w-4 text-green-400" />
<span>Track Marijuana Usage</span>
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<button className="flex items-center gap-2 px-3 py-2 rounded-full bg-muted hover:bg-muted/80 transition-all focus:outline-none focus:ring-2 focus:ring-primary/30">
<Avatar className="h-8 w-8 ring-2 ring-primary/30">
<AvatarImage src={user.profilePictureUrl ?? undefined} alt={userName || 'User'} />
<AvatarFallback className="bg-primary/20 text-primary text-sm">{initials}</AvatarFallback>
</Avatar>
<ChevronDown className="h-4 w-4 text-muted-foreground" />
</button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end" sideOffset={8}>
<DropdownMenuItem onClick={() => handleNavigate('/')}>
<Home className="mr-3 h-4 w-4 text-muted-foreground" />
<span>Dashboard</span>
</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem onClick={handleLogout} className="text-red-400 hover:text-red-300">
<LogOut className="mr-3 h-4 w-4" />