import React from 'react'; import './StepSequencePanel.css'; /** * StepSequencePanel — fixed panel shown when the AI is guiding the user * through a multi-step task sequence. * * @param {object|null} activeSequence - { id, taskName, steps, currentIndex, completed } * @param {function} onSendMessage - callback to send a chat message */ function StepSequencePanel({ activeSequence, onSendMessage }) { if (!activeSequence) return null; const { taskName, steps, currentIndex } = activeSequence; const totalSteps = steps?.length ?? 0; const safeIndex = Math.max(0, Math.min(currentIndex ?? 0, totalSteps - 1)); const currentStep = steps?.[safeIndex] ?? ''; const isLastStep = safeIndex >= totalSteps - 1; const stepNumber = safeIndex + 1; const handleNext = () => { if (isLastStep) { onSendMessage("I'm finished!"); } else { onSendMessage('Done, next step!'); } }; const handleHelp = () => { onSendMessage('I need help with this step'); }; return (
{/* Header */}
{taskName} Step {stepNumber} of {totalSteps}
{/* Progress bar */}
{Array.from({ length: totalSteps }, (_, i) => (
))}
{/* Current step */}

{currentStep}

{/* Action buttons */}
); } export default StepSequencePanel;