'use client' import { useEffect, useState } from 'react' import { useStore } from '@/lib/store' import { Sidebar } from '@/components/Sidebar' import { Toast, useToast } from '@/components/Toast' import { AuctionsTab } from '@/components/hunt/AuctionsTab' import { DropsTab } from '@/components/hunt/DropsTab' import { SearchTab } from '@/components/hunt/SearchTab' import { TrendSurferTab } from '@/components/hunt/TrendSurferTab' import { BrandableForgeTab } from '@/components/hunt/BrandableForgeTab' import { Eye, Gavel, Crosshair, Zap, Target, TrendingUp, Settings, Sparkles, Menu, Tag, Coins, Shield, LogOut, Crown, X, Briefcase, Search, Download, Flame, Wand2, } from 'lucide-react' import clsx from 'clsx' import Link from 'next/link' import Image from 'next/image' // ============================================================================ // TYPES // ============================================================================ type HuntTab = 'auctions' | 'drops' | 'search' | 'trends' | 'forge' // ============================================================================ // TAB CONFIG // ============================================================================ const TABS: Array<{ key: HuntTab; label: string; shortLabel: string; icon: any; color: string }> = [ { key: 'auctions', label: 'Auctions', shortLabel: 'Auctions', icon: Gavel, color: 'accent' }, { key: 'drops', label: 'Drops', shortLabel: 'Drops', icon: Download, color: 'blue' }, { key: 'search', label: 'Search', shortLabel: 'Search', icon: Search, color: 'white' }, { key: 'trends', label: 'Trends', shortLabel: 'Trends', icon: Flame, color: 'orange' }, { key: 'forge', label: 'Forge', shortLabel: 'Forge', icon: Wand2, color: 'purple' }, ] // ============================================================================ // MAIN PAGE // ============================================================================ export default function HuntPage() { const { user, subscription, logout, checkAuth, domains } = useStore() const { toast, showToast, hideToast } = useToast() const [tab, setTab] = useState('auctions') // Mobile Menu State const [menuOpen, setMenuOpen] = useState(false) // Check auth on mount useEffect(() => { checkAuth() }, [checkAuth]) // Computed const availableDomains = domains?.filter((d) => d.is_available) || [] const totalDomains = domains?.length || 0 // Nav Items for Mobile Bottom Bar const mobileNavItems = [ { href: '/terminal/hunt', label: 'Hunt', icon: Crosshair, active: true }, { href: '/terminal/watchlist', label: 'Watch', icon: Eye, active: false }, { href: '/terminal/portfolio', label: 'Portfolio', icon: Briefcase, active: false }, { href: '/terminal/intel', label: 'Intel', icon: TrendingUp, active: false }, ] // Full Navigation for Drawer const tierName = subscription?.tier_name || subscription?.tier || 'Scout' const TierIcon = tierName === 'Tycoon' ? Crown : tierName === 'Trader' ? TrendingUp : Zap const drawerNavSections = [ { title: 'Discover', items: [ { href: '/terminal/hunt', label: 'Hunt', icon: Crosshair }, { href: '/terminal/intel', label: 'Intel', icon: TrendingUp }, ], }, { title: 'Manage', items: [ { href: '/terminal/watchlist', label: 'Watchlist', icon: Eye }, { href: '/terminal/portfolio', label: 'Portfolio', icon: Briefcase }, { href: '/terminal/sniper', label: 'Sniper', icon: Target }, ], }, { title: 'Monetize', items: [ { href: '/terminal/yield', label: 'Yield', icon: Coins, isNew: true }, { href: '/terminal/listing', label: 'For Sale', icon: Tag }, ], }, ] const activeTab = TABS.find((t) => t.key === tab)! return (
{/* Desktop Sidebar */}
{/* Main Content */}
{/* ═══════════════════════════════════════════════════════════════════════ */} {/* MOBILE HEADER */} {/* ═══════════════════════════════════════════════════════════════════════ */}
{/* Top Row */}
Domain Hunt
{totalDomains} tracked · {availableDomains.length} available
{/* Tab Bar - Scrollable */}
{TABS.map((t) => { const isActive = tab === t.key return ( ) })}
{/* ═══════════════════════════════════════════════════════════════════════ */} {/* DESKTOP HEADER + TAB BAR */} {/* ═══════════════════════════════════════════════════════════════════════ */}
Discovery Hub

Domain Hunt

Search domains, browse auctions, discover drops, ride trends, or generate brandables.

{totalDomains}
Tracked
{availableDomains.length}
Available
{/* Desktop Tab Bar */}
{TABS.map((t) => { const isActive = tab === t.key const colorClasses: Record = { accent: { active: 'border-accent bg-accent/10 text-accent', inactive: 'border-white/[0.08] text-white/50 hover:text-white hover:bg-white/[0.02]' }, blue: { active: 'border-blue-500 bg-blue-500/10 text-blue-400', inactive: 'border-white/[0.08] text-white/50 hover:text-white hover:bg-white/[0.02]' }, white: { active: 'border-white/40 bg-white/10 text-white', inactive: 'border-white/[0.08] text-white/50 hover:text-white hover:bg-white/[0.02]' }, orange: { active: 'border-orange-500 bg-orange-500/10 text-orange-400', inactive: 'border-white/[0.08] text-white/50 hover:text-white hover:bg-white/[0.02]' }, purple: { active: 'border-purple-500 bg-purple-500/10 text-purple-400', inactive: 'border-white/[0.08] text-white/50 hover:text-white hover:bg-white/[0.02]' }, } const classes = colorClasses[t.color] || colorClasses.white return ( ) })}
{/* ═══════════════════════════════════════════════════════════════════════ */} {/* TAB CONTENT */} {/* ═══════════════════════════════════════════════════════════════════════ */}
{tab === 'auctions' && } {tab === 'drops' && } {tab === 'search' && } {tab === 'trends' && } {tab === 'forge' && }
{/* ═══════════════════════════════════════════════════════════════════════ */} {/* MOBILE BOTTOM NAV */} {/* ═══════════════════════════════════════════════════════════════════════ */} {/* ═══════════════════════════════════════════════════════════════════════ */} {/* MOBILE DRAWER */} {/* ═══════════════════════════════════════════════════════════════════════ */} {menuOpen && (
setMenuOpen(false)} />
Pounce

POUNCE

Terminal v1.0

{drawerNavSections.map((section) => (
{section.title}
{section.items.map((item: any) => ( setMenuOpen(false)} className="flex items-center gap-3 px-4 py-2.5 text-white/60 active:text-white active:bg-white/[0.03] transition-colors border-l-2 border-transparent active:border-accent" > {item.label} {item.isNew && NEW} ))}
))}
setMenuOpen(false)} className="flex items-center gap-3 py-2.5 text-white/50 active:text-white transition-colors" > Settings {user?.is_admin && ( setMenuOpen(false)} className="flex items-center gap-3 py-2.5 text-amber-500/70 active:text-amber-400 transition-colors" > Admin )}

{user?.name || user?.email?.split('@')[0] || 'User'}

{tierName}

{tierName === 'Scout' && ( setMenuOpen(false)} className="flex items-center justify-center gap-2 w-full py-2.5 bg-accent text-black text-xs font-bold uppercase tracking-wider active:scale-[0.98] transition-all mb-2" > Upgrade )}
)}
{/* Toast */} {toast && }
) }