import { useEffect, useState } from 'react' import { apiHealth } from '../services/api.js' const ASCII_LOGO = ` _ _ ____ _ _ ____ ____ _ ____ ___ ____ ____ |\ | |___ | | |__/ |__| | |___ | \ | __ |___ | \| |___ |__| | \ | | |___ |___ |__/ |__] |___ ` export default function TopBar({ obs, round }) { const [online, setOnline] = useState(false) const [tick, setTick] = useState(true) useEffect(() => { const check = async () => setOnline(await apiHealth()) check() const id = setInterval(check, 15_000) return () => clearInterval(id) }, []) // blinking colon in clock-style indicator useEffect(() => { const t = setInterval(() => setTick(v => !v), 500) return () => clearInterval(t) }, []) const score = obs?.state?.profitability_score ?? null const scoreClass = score === null ? '' : score >= 60 ? 'good' : score >= 35 ? 'warn' : 'bad' return (