diff --git a/src/components/Dashboard/Dashboard.stories.tsx b/src/components/Dashboard/Dashboard.stories.tsx index 43022ac1..e50bfc63 100644 --- a/src/components/Dashboard/Dashboard.stories.tsx +++ b/src/components/Dashboard/Dashboard.stories.tsx @@ -1453,7 +1453,7 @@ function ProfilePage({ user }: ProfilePageProps) {
void; - placeholder?: string; - transcriptionState: TranscriptionState; - streamingText?: string; - rows?: number; - className?: string; +function StateCard({ + state, + label, + description, + variant = 'default', + size = 'md', + showWaveform, + showPulse, +}: { + state: RecordButtonState; + label: string; + description: string; + variant?: RecordButtonVariant; + size?: RecordButtonSize; + showWaveform?: boolean; + showPulse?: boolean; +}) { + return ( +
+ +
+

{label}

+

+ {description} +

+
+
+ ); } -/** - * A textarea that handles transcription states gracefully. - * Shows appropriate UI for transcribing, streaming, and idle states. - */ -function TranscriptionTextarea({ - value, - onChange, - placeholder = 'Type or record a message...', - transcriptionState, - streamingText, - rows = 3, - className, -}: TranscriptionTextareaProps) { - const isTranscribing = transcriptionState === 'transcribing'; - const isStreaming = transcriptionState === 'streaming'; - const isProcessing = isTranscribing || isStreaming; - - // Display streaming text when available, otherwise show value - const displayValue = isStreaming && streamingText ? streamingText : value; - - // Determine placeholder based on state - const getPlaceholder = () => { - if (isTranscribing) return 'Transcribing your audio...'; - if (isStreaming) return ''; - return placeholder; +// ============================================================================ +// Variant Row Component +// ============================================================================ + +function VariantRow({ + variant, + label, +}: { + variant: RecordButtonVariant; + label: string; +}) { + const states: RecordButtonState[] = [ + 'idle', + 'recording', + 'processing', + 'disabled', + 'error', + 'success', + ]; + + return ( +
+
+ {label} + + variant="{variant}" + +
+
+ {states.map((state) => ( +
+ + {state} +
+ ))} +
+
+ ); +} + +// ============================================================================ +// Interactive Demo Component +// ============================================================================ + +function InteractiveDemo() { + const [state, setState] = React.useState('idle'); + const timersRef = React.useRef([]); + + const clearTimers = () => { + timersRef.current.forEach(clearTimeout); + timersRef.current = []; + }; + + const handleClick = () => { + if (state === 'idle') { + // Start recording + setState('recording'); + } else if (state === 'recording') { + // Stop recording, start processing + clearTimers(); + setState('processing'); + + // Simulate processing time + const processingTimer = setTimeout(() => { + setState('success'); + + // Reset to idle after showing success + const successTimer = setTimeout(() => { + setState('idle'); + }, 1500); + timersRef.current.push(successTimer); + }, 2000); + timersRef.current.push(processingTimer); + } }; + React.useEffect(() => { + return () => { + clearTimers(); + }; + }, []); + return ( -
-