'use client'; import React from 'react'; import Image from 'next/image'; import Link from 'next/link'; import { useAudioPlayer } from '@/app/components/AudioPlayerContext'; import { Button } from '@/components/ui/button'; import { Separator } from '@/components/ui/separator'; import { ScrollArea } from '@/components/ui/scroll-area'; import { Play, X, Disc, Trash2, SkipForward } from 'lucide-react'; const QueuePage: React.FC = () => { const { queue, currentTrack, removeTrackFromQueue, clearQueue, skipToTrackInQueue } = useAudioPlayer(); const formatDuration = (seconds: number): string => { const minutes = Math.floor(seconds / 60); const remainingSeconds = seconds % 60; return `${minutes}:${remainingSeconds.toString().padStart(2, '0')}`; }; return (
{/* Header */}

Queue

{currentTrack ? `Now playing • ${queue.length} songs up next` : `${queue.length} songs in queue`}

{/* Currently Playing */} {currentTrack && (

Now Playing

{/* Album Art */}
{currentTrack.album}
{/* Song Info */}

{currentTrack.name}

{currentTrack.artist}
{/* Duration */}
{formatDuration(currentTrack.duration)}
)} {/* Queue */}

Up Next

{queue.length > 0 && (

{queue.length} song{queue.length !== 1 ? 's' : ''}

)}
{queue.length === 0 ? (

No songs in queue

Add songs to your queue to see them here

) : (
{queue.map((track, index) => (
skipToTrackInQueue(index)} > {/* Album Art with Play Indicator */}
{track.album}
{/* Song Info */}

{track.name}

e.stopPropagation()} > {track.artist}
{/* Duration */}
{formatDuration(track.duration)}
{/* Actions */}
))}
)}
); }; export default QueuePage;