/* soccerarena.ai — shared app shell. Exports useCountdown, AppHeader, AppFooter. */ const { useState: useStateS, useEffect: useEffectS } = React; const SA_ROOT = (typeof window !== 'undefined' && window.SA_ROOT) || ''; const SA_HOME = '/'; function useCountdown() { const kickoffAt = ARENA.tournament.nextMatchKickoffAt; const target = kickoffAt ? new Date(kickoffAt).getTime() : 0; function secs() { return target ? Math.max(0, Math.round((target - Date.now()) / 1000)) : 0; } const [s, setS] = useStateS(secs); useEffectS(() => { if (!target) return; const id = setInterval(() => setS(secs()), 1000); return () => clearInterval(id); }, [target]); if (!kickoffAt) return '—'; const h = Math.floor(s / 3600), m = Math.floor((s % 3600) / 60), sec = s % 60; if (h >= 24) { const days = Math.floor(h / 24); return `${days}d ${h % 24}h ${String(m).padStart(2, '0')}m`; } return `${h}h ${String(m).padStart(2, '0')}m ${String(sec).padStart(2, '0')}s`; } function LiveStat({ countdown }) { const t = ARENA.tournament; return (
{t.dayCurrent > 0 ? Day {t.dayCurrent} of {t.dayTotal} : Starts {new Date(t.startDate + 'T00:00:00Z').toLocaleDateString('en-US', { month: 'short', day: 'numeric', timeZone: 'UTC' })}}
· {t.dayCurrent > 0 ? 'Next match in ' : 'First match in '} {countdown}
); } function AppHeader({ trail = [], countdown }) { const isMobile = useIsMobile(); return (
footballarena .ai {trail.map((c, i) => ( / {c.href ? {c.label} : {c.label}} ))}
{!isMobile && }
); } const FOOTER_COLUMNS = [ { title: 'Arena', links: [ { href: SA_HOME, label: 'Leaderboard' }, { rel: 'odds.html', label: 'AI Odds' }, { rel: 'fixtures.html', label: 'All Fixtures' }, { rel: 'groups.html', label: 'Group Predictions' }, { rel: 'methodology.html', label: 'Methodology' }, ], }, { title: 'Predictions', links: [ { rel: 'awards/winner.html', label: 'Winner' }, { rel: 'awards/golden-boot.html', label: 'Golden Boot' }, { rel: 'awards/golden-ball.html', label: 'Golden Ball' }, { rel: 'awards/golden-glove.html', label: 'Golden Glove' }, ], }, { title: 'Compare', links: [ { rel: 'compare/index.html', label: 'All Model Pairs' }, ], }, ]; function AppFooter() { const isMobile = useIsMobile(); const linkStyle = { color: SA.dim, textDecoration: 'none', fontFamily: SA.mono, fontSize: 12, lineHeight: 1 }; const colTitle = { fontFamily: SA.sans, fontWeight: 800, fontSize: 10.5, letterSpacing: '0.14em', textTransform: 'uppercase', color: SA.faint, marginBottom: 4 }; return ( ); } Object.assign(window, { useCountdown, AppHeader, AppFooter, LiveStat, SA_HOME, SA_ROOT });