'use client'; import { useState } from 'react'; import Link from 'next/link'; import { usePathname } from 'next/navigation'; import { Menu, X, LogOut } from 'lucide-react'; import { cn } from '@/lib/utils'; import { useUser } from './useUser'; import { useLogout } from './useLogout'; import { baseNavItems } from './constants'; import { getInitials, translateTier } from './utils'; import { ThemeToggle } from '@/components/ui/theme-toggle'; import { useI18n } from '@/lib/i18n'; export function DashboardHeader() { const [mobileOpen, setMobileOpen] = useState(false); const pathname = usePathname(); const { data: user, isLoading } = useUser(); const { logout } = useLogout(); const { t } = useI18n(); const isPro = ['pro', 'business', 'enterprise'].includes(user?.tier ?? ''); const navItems = isPro ? baseNavItems : baseNavItems.filter(item => !item.proOnly); return ( <>
{/* Mobile menu button */} {/* Mobile brand */}
W
{t('auth.brandName')}
{/* Left side - desktop */}
{t('dashboard.topbar.interfaceLabel')}
{/* Right side */}
{/* Theme toggle */}
{/* User info */} {!isLoading && user && (
{user.name} {user.tier && user.tier !== 'free' ? t('dashboard.topbar.premiumAccess', { defaultValue: 'Premium Access' }) : translateTier(t, user.tier)}
{getInitials(user.name)}
)} {/* Mobile theme + avatar */} {!isLoading && user && (
{getInitials(user.name)}
)}
{/* Mobile navigation drawer */} {mobileOpen && (
)} ); }