'use client'; import { useEffect, useState } from 'react'; import Link from 'next/link'; import AppLauncher from './AppLauncher'; const API_BASE = process.env.NEXT_PUBLIC_API_BASE ?? 'https://cypher.arcrun.dev'; type NavUser = { display_name: string; email: string; avatar_url?: string; }; export default function SiteNav({ currentPath }: { currentPath?: string }) { const [user, setUser] = useState(undefined); useEffect(() => { fetch(`${API_BASE}/me`, { credentials: 'include' }) .then(r => r.ok ? r.json() as Promise : null) .then(u => setUser(u)) .catch(() => setUser(null)); }, []); const logout = async () => { await fetch(`${API_BASE}/auth/logout`, { method: 'POST', credentials: 'include' }); window.location.href = '/'; }; const linkCls = (path: string) => `transition-colors text-sm ${currentPath === path ? 'text-white' : 'text-[#666] hover:text-white'}`; return ( ); }