From bc768f4f45e5d6cabbd606bd68fb8d4415acbd82 Mon Sep 17 00:00:00 2001 From: Paul Bailey Date: Tue, 9 Dec 2025 11:53:04 +0000 Subject: [PATCH] Implement ScriptReviewSection component - Created ScriptReviewSection component with script segment display - Added speaker dropdown for each segment to allow editing assignments - Implemented Generate Audiobook and Skip Review buttons - Styled for readability and mobile responsiveness with Tailwind CSS - Text segments displayed as read-only (only speaker assignment is editable) - Follows existing component patterns from VoiceAssignmentSection - Validates Requirements 15.3, 15.4, 15.5, 15.6, 15.8 --- .kiro/specs/text-to-audiobook/tasks.md | 2 +- .../src/components/ScriptReviewSection.tsx | 111 ++++++++++++++++++ 2 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 frontend/src/components/ScriptReviewSection.tsx diff --git a/.kiro/specs/text-to-audiobook/tasks.md b/.kiro/specs/text-to-audiobook/tasks.md index b1be0df..e12135e 100644 --- a/.kiro/specs/text-to-audiobook/tasks.md +++ b/.kiro/specs/text-to-audiobook/tasks.md @@ -402,7 +402,7 @@ - Mock API responses - _Requirements: 15.1_ -- [ ] 21. Implement ScriptReviewSection component +- [x] 21. Implement ScriptReviewSection component - Create ScriptReviewSection component - Display list of script segments with text boxes - Add speaker dropdown for each segment diff --git a/frontend/src/components/ScriptReviewSection.tsx b/frontend/src/components/ScriptReviewSection.tsx new file mode 100644 index 0000000..d1ef9b3 --- /dev/null +++ b/frontend/src/components/ScriptReviewSection.tsx @@ -0,0 +1,111 @@ +import type { Role, ScriptSegment } from '../api/tts'; + +interface ScriptReviewSectionProps { + segments: ScriptSegment[]; + roles: Role[]; + onSegmentChange: (segmentId: string, newSpeaker: string) => void; + onGenerate: () => void; + onSkipReview: () => void; + isGenerating: boolean; +} + +export default function ScriptReviewSection({ + segments, + roles, + onSegmentChange, + onGenerate, + onSkipReview, + isGenerating, +}: ScriptReviewSectionProps) { + const handleSpeakerChange = (segmentId: string, newSpeaker: string) => { + onSegmentChange(segmentId, newSpeaker); + }; + + return ( +
+

Review Script

+ +

+ Review the AI-generated script and adjust speaker assignments as needed. +

+ + {/* Script Segments */} +
+ {segments.map((segment, index) => ( +
+ {/* Segment Header */} +
+ + Segment {index + 1} + + + {/* Speaker Dropdown */} +
+ + +
+
+ + {/* Segment Text */} +
+ {segment.text} +
+
+ ))} +
+ + {/* Action Buttons */} +
+ + + +
+ + {/* Info Message */} + {!isGenerating && ( +
+

💡 Tip:

+

+ Review the AI-generated speaker assignments and make any necessary corrections before generating the audiobook. +

+
+ )} +
+ ); +}