import { useEffect, useRef } from 'react' import { useStore } from '../store' const LOG_COLOUR = { info: 'text-[#7fc4f0]', success: 'text-[#5fe0a0]', warn: 'text-[#f5c563]', error: 'text-[#f68c82]' } export function RunPanel() { const { step, log } = useStore() const active = !step ? -1 : step.pct >= 100 ? STEPS.length : STEPS.indexOf(step.label) const logBox = useRef(null) useEffect(() => { logBox.current?.scrollTo(0, logBox.current.scrollHeight) }, [log.length]) return (
Run automation
{step?.label ?? 'Waiting to start'} {step?.pct ?? 0}%
    {STEPS.map((s, i) => { const c = i < active ? 'done' : i === active ? 'active' : 'pending' return (
  1. {c === 'done' ? '✓' : i + 1} {s}
  2. ) })}
{/* OPTIONAL: checkpoint tracker goes here */}
{log.map((l, i) =>
{l.msg}
)}
) }