'use client' import { useState, useEffect } from 'react' import Link from 'next/link' import { usePathname } from 'next/navigation' import { useAccount, useConnect, useDisconnect } from 'wagmi' import { useTranslations } from 'next-intl' // i18n shelved — LanguageSwitch hidden but kept on disk for future revival. // import LanguageSwitch from './LanguageSwitch' function BrandMark() { return α } function ThemeToggle() { const [theme, setTheme] = useState<'light' | 'dark'>('light') useEffect(() => { const stored = localStorage.getItem('theme') as 'light' | 'dark' | null const t = stored || 'light' setTheme(t) document.documentElement.dataset.theme = t }, []) function toggle() { const next = theme === 'dark' ? 'light' : 'dark' setTheme(next) localStorage.setItem('theme', next) document.documentElement.dataset.theme = next } return ( ) } export default function Navbar() { const t = useTranslations('nav') const pathname = usePathname() const { address, isConnected } = useAccount() const { connect, connectors } = useConnect() const { disconnect } = useDisconnect() const [mounted, setMounted] = useState(false) const [walletMenuOpen, setWalletMenuOpen] = useState(false) const [copied, setCopied] = useState(false) async function copyAddress(addr: string) { let ok = false try { if (navigator.clipboard?.writeText) { await navigator.clipboard.writeText(addr) ok = true } else { // Fallback for non-secure contexts where the Clipboard API is absent. const ta = document.createElement('textarea') ta.value = addr ta.style.position = 'fixed' ta.style.opacity = '0' document.body.appendChild(ta) ta.select() ok = document.execCommand('copy') document.body.removeChild(ta) } } catch { ok = false } setCopied(ok) setTimeout(() => setCopied(false), 1500) } useEffect(() => { setMounted(true) }, []) useEffect(() => { setWalletMenuOpen(false) }, [pathname, address]) const locale = pathname.split('/')[1] || 'en' const path = '/' + pathname.split('/').slice(2).join('/') // Two independent trading systems get their own top-level tabs — no // intermediate "Signals" hub. Trump = event scalp; BTC = reversal. const tabs = [ { key: '/', label: t('tabs.overview') }, { key: '/trump', label: t('tabs.trump') }, { key: '/btc', label: t('tabs.btc') }, { key: '/kol', label: t('tabs.kol') }, { key: '/trades', label: t('tabs.trades') }, { key: '/analytics', label: t('tabs.analytics') }, { key: '/settings', label: t('tabs.settings') }, ] function isActive(key: string) { if (key === '/') return path === '/' || path === '//' // /posts (legacy hub) still resolves but isn't a tab; treat it + /archive // as part of the Trump section so a tab stays highlighted there. if (key === '/trump') return path.startsWith('/trump') || path.startsWith('/posts') || path.startsWith('/archive') return path.startsWith(key) } const shortAddr = address ? `${address.slice(0, 6)}…${address.slice(-4)}` : null return ( ) }