|
"use client" |
|
|
|
import { useState } from "react" |
|
import Link from "next/link" |
|
import { usePathname } from "next/navigation" |
|
import { Flame, Menu, X, Wallet, Bell, User, Settings, LogOut } from "lucide-react" |
|
import { Button } from "@/components/ui/button" |
|
import { Badge } from "@/components/ui/badge" |
|
import { |
|
DropdownMenu, |
|
DropdownMenuContent, |
|
DropdownMenuItem, |
|
DropdownMenuLabel, |
|
DropdownMenuSeparator, |
|
DropdownMenuTrigger, |
|
} from "@/components/ui/dropdown-menu" |
|
import { useIsMobile } from "@/hooks/use-mobile" |
|
|
|
const AppHeader = () => { |
|
const [isMenuOpen, setIsMenuOpen] = useState(false) |
|
const [isConnected, setIsConnected] = useState(false) |
|
const pathname = usePathname() |
|
const isMobile = useIsMobile() |
|
|
|
const navigation = [ |
|
{ name: "Home", href: "/", current: pathname === "/" }, |
|
{ name: "Launch", href: "/launch", current: pathname === "/launch" }, |
|
{ name: "Analytics", href: "/analytics", current: pathname === "/analytics" }, |
|
{ name: "Community", href: "/community-pulse", current: pathname === "/community-pulse" }, |
|
{ name: "Healers", href: "/healers", current: pathname === "/healers" }, |
|
{ name: "Learn & Earn", href: "/learn-earn", current: pathname === "/learn-earn" }, |
|
] |
|
|
|
const handleConnectWallet = () => { |
|
|
|
setIsConnected(!isConnected) |
|
} |
|
|
|
return ( |
|
<header className="bg-white/95 backdrop-blur-sm border-b border-orange-100 sticky top-0 z-50"> |
|
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8"> |
|
<div className="flex justify-between items-center py-4"> |
|
{/* Logo */} |
|
<Link href="/" className="flex items-center space-x-2"> |
|
<Flame className="h-8 w-8 text-orange-500" /> |
|
<span className="text-xl font-bold text-gray-900">FlameBorn</span> |
|
<Badge variant="outline" className="hidden sm:inline-flex text-xs"> |
|
Ubuntu |
|
</Badge> |
|
</Link> |
|
|
|
{/* Desktop Navigation */} |
|
{!isMobile && ( |
|
<nav className="hidden md:flex space-x-8"> |
|
{navigation.map((item) => ( |
|
<Link |
|
key={item.name} |
|
href={item.href} |
|
className={`text-sm font-medium transition-colors ${ |
|
item.current |
|
? "text-orange-600 border-b-2 border-orange-600 pb-1" |
|
: "text-gray-700 hover:text-orange-600" |
|
}`} |
|
> |
|
{item.name} |
|
</Link> |
|
))} |
|
</nav> |
|
)} |
|
|
|
{/* Right side actions */} |
|
<div className="flex items-center space-x-4"> |
|
{/* Notifications */} |
|
<Button variant="ghost" size="sm" className="relative"> |
|
<Bell className="h-5 w-5" /> |
|
<Badge className="absolute -top-1 -right-1 h-5 w-5 rounded-full p-0 flex items-center justify-center text-xs bg-red-500"> |
|
3 |
|
</Badge> |
|
</Button> |
|
|
|
{/* Wallet Connection */} |
|
<Button |
|
onClick={handleConnectWallet} |
|
variant={isConnected ? "outline" : "default"} |
|
size="sm" |
|
className={isConnected ? "border-green-500 text-green-700" : "bg-orange-500 hover:bg-orange-600"} |
|
> |
|
<Wallet className="h-4 w-4 mr-2" /> |
|
{isConnected ? "Connected" : "Connect"} |
|
</Button> |
|
|
|
{/* User Menu */} |
|
{isConnected && ( |
|
<DropdownMenu> |
|
<DropdownMenuTrigger asChild> |
|
<Button variant="ghost" size="sm" className="relative"> |
|
<User className="h-5 w-5" /> |
|
</Button> |
|
</DropdownMenuTrigger> |
|
<DropdownMenuContent align="end" className="w-56"> |
|
<DropdownMenuLabel>Ubuntu Account</DropdownMenuLabel> |
|
<DropdownMenuSeparator /> |
|
<DropdownMenuItem asChild> |
|
<Link href="/profile"> |
|
<User className="mr-2 h-4 w-4" /> |
|
Profile |
|
</Link> |
|
</DropdownMenuItem> |
|
<DropdownMenuItem asChild> |
|
<Link href="/dashboard"> |
|
<Settings className="mr-2 h-4 w-4" /> |
|
Dashboard |
|
</Link> |
|
</DropdownMenuItem> |
|
<DropdownMenuSeparator /> |
|
<DropdownMenuItem onClick={() => setIsConnected(false)}> |
|
<LogOut className="mr-2 h-4 w-4" /> |
|
Disconnect |
|
</DropdownMenuItem> |
|
</DropdownMenuContent> |
|
</DropdownMenu> |
|
)} |
|
|
|
{/* Mobile menu button */} |
|
{isMobile && ( |
|
<Button variant="ghost" size="sm" onClick={() => setIsMenuOpen(!isMenuOpen)} className="md:hidden"> |
|
{isMenuOpen ? <X className="h-5 w-5" /> : <Menu className="h-5 w-5" />} |
|
</Button> |
|
)} |
|
</div> |
|
</div> |
|
|
|
{/* Mobile Navigation */} |
|
{isMobile && isMenuOpen && ( |
|
<div className="md:hidden border-t border-orange-100 py-4"> |
|
<nav className="space-y-2"> |
|
{navigation.map((item) => ( |
|
<Link |
|
key={item.name} |
|
href={item.href} |
|
className={`block px-3 py-2 text-sm font-medium rounded-md transition-colors ${ |
|
item.current |
|
? "bg-orange-100 text-orange-600" |
|
: "text-gray-700 hover:bg-orange-50 hover:text-orange-600" |
|
}`} |
|
onClick={() => setIsMenuOpen(false)} |
|
> |
|
{item.name} |
|
</Link> |
|
))} |
|
</nav> |
|
</div> |
|
)} |
|
</div> |
|
</header> |
|
) |
|
} |
|
|
|
export default AppHeader |
|
|