"use client"; import { useState } from 'react'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Button } from '@/components/ui/button'; import { Badge } from '@/components/ui/badge'; import { Slider } from '@/components/ui/slider'; import { Progress } from '@/components/ui/progress'; import { ArrowLeft, ArrowRight, Play, Pause, Music, Upload, Wand2, Volume2 } from 'lucide-react'; interface AddMusicStepProps { onNext: () => void; onPrevious: () => void; } const mockChapters = [ { id: 1, title: 'Introduction', duration: 45, music: { id: 1, name: 'Uplifting Corporate', genre: 'Corporate', duration: 45, volume: 30, fadeIn: 2, fadeOut: 3, generated: true, }, }, { id: 2, title: 'Core Concepts', duration: 80, music: { id: 2, name: 'Tech Ambient', genre: 'Ambient', duration: 80, volume: 25, fadeIn: 3, fadeOut: 2, generated: true, }, }, { id: 3, title: 'Practical Applications', duration: 75, music: { id: 3, name: 'Modern Innovation', genre: 'Electronic', duration: 75, volume: 35, fadeIn: 2, fadeOut: 4, generated: true, }, }, { id: 4, title: 'Future Outlook', duration: 50, music: { id: 4, name: 'Inspiring Future', genre: 'Cinematic', duration: 50, volume: 40, fadeIn: 1, fadeOut: 5, generated: true, }, }, ]; const musicGenres = [ 'Corporate', 'Ambient', 'Electronic', 'Cinematic', 'Jazz', 'Folk', 'Rock', 'Classical' ]; export function AddMusicStep({ onNext, onPrevious }: AddMusicStepProps) { const [chapters, setChapters] = useState(mockChapters); const [playingChapter, setPlayingChapter] = useState(null); const handleVolumeChange = (chapterId: number, volume: number[]) => { setChapters(chapters.map(ch => ch.id === chapterId ? { ...ch, music: { ...ch.music, volume: volume[0] } } : ch )); }; const handleFadeChange = (chapterId: number, type: 'fadeIn' | 'fadeOut', value: number[]) => { setChapters(chapters.map(ch => ch.id === chapterId ? { ...ch, music: { ...ch.music, [type]: value[0] } } : ch )); }; const regenerateMusic = (chapterId: number) => { const randomGenre = musicGenres[Math.floor(Math.random() * musicGenres.length)]; const randomName = `AI Generated ${randomGenre} ${Math.floor(Math.random() * 100)}`; setChapters(chapters.map(ch => ch.id === chapterId ? { ...ch, music: { ...ch.music, name: randomName, genre: randomGenre, generated: true } } : ch )); }; const togglePlay = (chapterId: number) => { setPlayingChapter(playingChapter === chapterId ? null : chapterId); }; return (
Background Music

AI has automatically generated background music for each chapter. You can adjust volumes, fade effects, or replace with custom music.

{chapters.map((chapter) => (
Chapter {chapter.id}

{chapter.title}

{chapter.duration}s
{/* Music Info */}
{chapter.music.name} {chapter.music.genre} {chapter.music.generated && ( AI Generated )}
{chapter.music.duration}s
{playingChapter === chapter.id && (
0:00 {Math.floor(chapter.duration / 60)}:{(chapter.duration % 60).toString().padStart(2, '0')}
)}
{/* Controls */}
{/* Volume */}
handleVolumeChange(chapter.id, value)} max={100} step={5} className="w-full" />
{/* Fade In */}
handleFadeChange(chapter.id, 'fadeIn', value)} max={10} step={0.5} className="w-full" />
{/* Fade Out */}
handleFadeChange(chapter.id, 'fadeOut', value)} max={10} step={0.5} className="w-full" />
{/* Action Buttons */}
))}
{/* Global Music Settings */} Global Settings

Adjust overall music volume relative to voice

Smooth transitions between chapter music

{/* Action Buttons */}
); }