'use client'; import { useState } from 'react'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Progress } from '@/components/ui/progress'; import { Play, Pause, RotateCcw, Volume2 } from 'lucide-react'; interface Message { id: string; speaker: 'host1' | 'host2'; text: string; timestamp: string; } export default function Home() { const [url, setUrl] = useState(''); const [isLoading, setIsLoading] = useState(false); const [messages, setMessages] = useState([]); const [isPlaying, setIsPlaying] = useState(false); const [currentTime, setCurrentTime] = useState(0); const [duration, setDuration] = useState(0); const [progressInterval, setProgressInterval] = useState(null); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setIsLoading(true); // Simulate API call setTimeout(() => { setMessages(mockMessages); setIsLoading(false); setDuration(320); // 5 minutes 20 seconds }, 2000); }; const togglePlay = () => { if (isPlaying) { setIsPlaying(false); if (progressInterval) { clearInterval(progressInterval); setProgressInterval(null); } } else { setIsPlaying(true); const interval = setInterval(() => { setCurrentTime(prev => { if (prev >= duration) { setIsPlaying(false); clearInterval(interval); setProgressInterval(null); return duration; } return prev + 1; }); }, 1000); setProgressInterval(interval); } }; const restartAudio = () => { setCurrentTime(0); setIsPlaying(false); if (progressInterval) { clearInterval(progressInterval); setProgressInterval(null); } }; return (
{/* Header */}

AI Podcast Generator

{/* Main Content */}
{/* Left Column - URL Input */}
Generate Podcast
setUrl(e.target.value)} placeholder="https://example.com" required />
{messages.length > 0 && (

Podcast generated successfully! Listen to the conversation below.

)}
{/* Middle Column - Conversation */}
Podcast Conversation {messages.length === 0 ? (

Enter a URL and generate a podcast to see the conversation here.

) : ( messages.map((message) => (
{message.speaker === 'host1' ? 'Alex' : 'Sarah'}

{message.text}

{message.timestamp}
)) )}
{/* Right Column - Audio Player */}
Audio Player {messages.length === 0 ? (

Generate a podcast to enable audio playback.

) : (
{/* Audio Controls */}
{/* Progress Bar */}
{formatTime(currentTime)} {formatTime(duration)}
{/* Volume Control */}
{/* Episode Info */}

Episode Details

Duration: {formatTime(duration)}

Speakers: Alex & Sarah

)}
); } // Helper function to format time function formatTime(seconds: number): string { const mins = Math.floor(seconds / 60); const secs = Math.floor(seconds % 60); return `${mins}:${secs.toString().padStart(2, '0')}`; } // Mock conversation data const mockMessages: Message[] = [ { id: '1', speaker: 'host1', text: "Hey Sarah! Today we're discussing this fascinating article about artificial intelligence and its impact on creative industries.", timestamp: '0:15' }, { id: '2', speaker: 'host2', text: "That's really interesting, Alex! I've been following this topic closely. The article mentions some really compelling points about AI-generated art and music.", timestamp: '0:45' }, { id: '3', speaker: 'host1', text: "Exactly! What I found most surprising was the section about how AI is actually helping human creators become more productive rather than replacing them entirely.", timestamp: '1:20' }, { id: '4', speaker: 'host2', text: "That's a crucial distinction. The article highlights several case studies where artists are using AI as a collaborative tool to enhance their creative process.", timestamp: '1:55' }, { id: '5', speaker: 'host1', text: "I particularly loved the example about the musician who used AI to generate backing tracks and then added their own creative twist on top.", timestamp: '2:30' }, { id: '6', speaker: 'host2', text: "And what about the ethical considerations? The article raises some important questions about copyright and attribution when AI is involved in the creative process.", timestamp: '3:05' }, { id: '7', speaker: 'host1', text: "That's definitely something we need to think about. The author suggests that we might need new frameworks for understanding creativity in the age of AI.", timestamp: '3:40' }, { id: '8', speaker: 'host2', text: "I agree. It's not about rejecting AI, but finding ways to integrate it responsibly into our creative workflows while maintaining human oversight and artistic vision.", timestamp: '4:15' }, { id: '9', speaker: 'host1', text: "The future looks really exciting! Imagine what we'll be able to create when we embrace these technologies as tools rather than threats.", timestamp: '4:50' }, { id: '10', speaker: 'host2', text: "Absolutely! Thanks for sharing this article with our listeners. It really gives us a lot to think about regarding the future of creativity and AI.", timestamp: '5:20' } ];