import { useState } from 'react' import { createPortal } from 'react-dom' import { FlameMark } from './FlameMark' import { codeburn } from '../lib/ipc' import { motionClass } from '../lib/motion' const COLLECT_URL = 'https://www.codeburn.app/telemetry' type Screen = { title: string body: string glyph: React.ReactNode } const SCREENS: Screen[] = [ { title: 'Every agent. One dashboard.', body: 'Claude Code, Codex, Cursor, Copilot and 20+ more: spend, sessions, models and quotas, side by side.', glyph: <>, }, { title: 'Local-first by design.', body: 'Usage is read from files already on your machine. No accounts, no API keys, nothing leaves your device.', glyph: <>, }, { title: 'Find the waste.', body: 'Retry tax, routing waste and task success by category: see what your agents actually deliver for the money.', glyph: <>, }, ] /** * First-launch overlay: three feature screens, then the telemetry consent * screen. The toggle's initial position comes from the region default (EU/EEA/ * UK/CH off, elsewhere on) and nothing is transmitted until the user finishes * here. Rendered only while the main process reports `onboarded: false`. */ export function Onboarding({ defaultEnabled, onDone }: { defaultEnabled: boolean; onDone: (enabled: boolean) => void }) { const [step, setStep] = useState(0) const [enabled, setEnabled] = useState(defaultEnabled) const last = SCREENS.length // consent screen index const isConsent = step === last if (typeof document === 'undefined') return null return createPortal(
{isConsent ? : {SCREENS[step].glyph}}
{isConsent ? ( <>

Help improve CodeBurn

Share anonymous usage statistics: model and provider mix, task success rates, performance and errors. Never your prompts, code, project names or anything that identifies you.

Anonymous telemetry

Tip: if a provider looks empty, grant Full Disk Access in System Settings › Privacy & Security.

) : ( <>

{SCREENS[step].title}

{SCREENS[step].body}

)}
{step > 0 ? ( ) : }
{[...SCREENS, null].map((_, index) => ( ))}
{isConsent ? ( ) : ( )}
, document.body, ) }