import { useQuery } from '@tanstack/react-query' import { fetchMe, type MeUser } from './api/client' import { EventProof } from './components/EventProof' interface HealthResponse { ok: boolean db: string } async function fetchHealth(): Promise { const res = await fetch('/health') if (!res.ok) { throw new Error(`Health check failed: ${res.status}`) } return res.json() as Promise } function ColorSwatch({ color }: { color: string }) { return ( ) } function MemberBadge({ user }: { user: MeUser }) { return (
{user.displayName ?? 'Member'}
) } export default function App() { const meQuery = useQuery({ queryKey: ['me'], queryFn: fetchMe, retry: false, // 401 triggers Authelia redirect — don't retry staleTime: 5 * 60 * 1000, // 5 min — session persists via refresh rotation }) const healthQuery = useQuery({ queryKey: ['health'], queryFn: fetchHealth, retry: 1, refetchInterval: 30_000, }) return (

FamilySync

{/* Authenticated member identity (AUTH-03) */} {meQuery.isLoading && (
Loading...
)} {meQuery.isError && (
Sign-in required
)} {meQuery.data && ( )} {/* Broker proof: one cached Fastmail event (CAL-01) */}
{/* Stack health indicator (from Plan 01) */}
{healthQuery.isLoading && 'Checking stack...'} {healthQuery.isError && 'stack: down'} {healthQuery.data && `stack: ${healthQuery.data.ok && healthQuery.data.db === 'up' ? 'up' : 'down'}`}
) }