import { For } from "solid-js"; import type { TrackState, QueueSummary, HistoryEntry, PlaylistEntry } from "./types"; interface QueueItemProps { title: string; duration: string; thumbnail: string | null; pending?: boolean; extraClass?: string; failed?: string | null; } function QueueItem(props: QueueItemProps) { const failed = props.failed; return (
{props.thumbnail && ( (e.currentTarget.hidden = true)} /> )} {props.pending ? "\u23F3 " : ""} {props.title} {props.duration} {failed && ( {failed} )}
); } interface QueueProps { currentTrack: TrackState | null; queue: QueueSummary[]; history: HistoryEntry[]; playlist: PlaylistEntry[]; autoplayEnabled: boolean; skipThreshold: number; onAddToPlaylist?: (url: string) => void; onRemoveFromPlaylist?: (id: string) => void; onSetAutoplay?: (enabled: boolean) => void; onSetSkipThreshold?: (percent: number) => void; onMoveQueueItem?: (from: number, to: number) => void; onShuffleQueue?: () => void; onRemoveQueueItem?: (itemId: string) => void; } export function Queue(props: QueueProps) { return (

Now Playing

{props.currentTrack ? ( ) : (
Paste a URL to start watching together
)}

Up Next ({props.queue.length}) {props.onShuffleQueue && props.queue.length > 1 && ( )}

{(item, index) => (
{props.onMoveQueueItem && (
)}
)}
{props.queue.length === 0 &&
Tracks you add will appear here
}

Playlist ({props.playlist.length})

{(item) => (
)}
{props.playlist.length === 0 && (
Add links to build a perpetual playlist
)}

Recently Played

{(item) => (
)}
{props.history.length === 0 && (
Recently played tracks show up here
)}
); }