import React, { useEffect, useState } from 'react'; const SPINNER = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']; const PHRASES = [ 'Thinking', 'Sketching layout', 'Choosing colors', 'Writing copy', 'Picking components', 'Wiring up the hero', 'Polishing typography', 'Arranging sections', 'Composing the layout', 'Adding finishing touches', ]; /** * Animated "AI is working" indicator. Modeled after Claude Code's bottom-bar * status: a Braille-cycle spinner, a phrase that rotates every few seconds, * and an elapsed-seconds counter. Mounts only while a request is in flight. */ export const WorkingIndicator: React.FC = () => { const [frame, setFrame] = useState(0); const [phrase, setPhrase] = useState('Thinking'); const [elapsed, setElapsed] = useState(0); const [startTime] = useState(() => Date.now()); useEffect(() => { const spinnerTimer = window.setInterval(() => { setFrame((f) => (f + 1) % SPINNER.length); }, 80); const phraseTimer = window.setInterval(() => { setPhrase(PHRASES[Math.floor(Math.random() * PHRASES.length)]); }, 2500); const elapsedTimer = window.setInterval(() => { setElapsed(Math.floor((Date.now() - startTime) / 1000)); }, 1000); return () => { window.clearInterval(spinnerTimer); window.clearInterval(phraseTimer); window.clearInterval(elapsedTimer); }; }, [startTime]); return (