"use client"; import { useState, useEffect } from "react"; import { useRouter } from "next/navigation"; import { useDictionary } from "@/lib/dictionary"; import { useOmni } from "@/components/OmniSyncProvider"; export default function Dashboard() { const { t } = useDictionary(); const { theme, setTheme, currency, setCurrency, locale, setLocale } = useOmni(); const [email, setEmail] = useState(""); const [role, setRole] = useState("user"); const [licenses, setLicenses] = useState>({}); const [, setEngineStrategy] = useState("XCU_GLOBAL_MESH"); const router = useRouter(); useEffect(() => { (async () => { try { const resp = await fetch("/api/auth/me"); const data = await resp.json(); if (data.error) { window.location.href = "/"; } else { setEmail(data.email); setRole(data.role); setLicenses(data.licenses || {}); if (data.mediaEngineStrategy) { setEngineStrategy(data.mediaEngineStrategy); } } } catch (_e) { window.location.href = "/"; } })(); }, []); const handleLogout = async () => { try { await fetch('/api/auth/logout', { method: 'POST' }); window.location.href = '/'; } catch (e) { console.error("Logout failed", e); } }; return (
{/* Dynamic Background */}
{/* Top Header - Ultra Refined */}
{email ? email.substring(0, 2).toUpperCase() : "US"}

JUMPA.ID ULTRA

{role} • node-alpha-synchronized

{/* SETTINGS MATRIX - DUAL BHS / THEME / CURRENCY */}
{t('Dashboard.mesh_sync')} 3/3 NODES READY
{/* Hero Section - Mobile First */}

{t('Dashboard.welcome')}, {email.split('@')[0]}

{t('Index.subtitle')}. Cepat, Aman, dan Tersinkronisasi secara Kuantum.

{/* Main Grid */}
{/* Chat Pilar */} {licenses['chat'] !== 'HIDDEN' && ( )} {/* VC Pilar */} {licenses['vc'] !== 'HIDDEN' && ( )}
{/* Admin Section if authorized */} {(role === 'admin' || role === 'superadmin') && (
)}
{/* Mobile Bottom Navigation - 100% Mobile Compatible */} {/* Ultra Footer */}
); }