import { ActionLabel } from '@/client/ui/action-label.tsx'; import { TrackMetadata } from './track-metadata.tsx'; import type { Track } from '@/shared/contracts/track.ts'; import type { ConnectionPhase } from '@/client/radio/session-state.ts'; import { formatTime } from '@/client/ui/format.ts'; import { Icon } from '@/client/ui/icons.tsx'; import { BranchPanel } from '@/client/exhibit/branch-panel.tsx'; import type { ExplanationTrigger } from '@/client/exhibit/diagram/diagram-model.ts'; const connectionLabels = ['Start listening', 'Cancel connection', 'Disconnect'] as const; const soundLabels = ['Mute', 'Unmute', 'Enable sound'] as const; type Props = ExplanationTrigger & { phase: ConnectionPhase; available: boolean; track?: Track; position: number; duration: number; kbps: number; live: boolean; muted: boolean; volume: number; audioBlocked: boolean; onConnect: () => void; onDisconnect: () => void; onToggleAudio: () => void; onVolumeChange: (volume: number) => void; }; export function AudioPanel({ phase, available, track, position, duration, kbps, live, muted, volume, audioBlocked, onConnect, onDisconnect, onToggleAudio, onVolumeChange, ...explanation }: Props) { const connected = phase === 'connected', connecting = phase === 'connecting'; const soundLabel = audioBlocked ? 'Enable sound' : muted ? 'Unmute' : 'Mute'; return (
{live ? `${Math.round(kbps)} kb/s` : 'FROM FLASH'}
{formatTime(position)} / {duration ? formatTime(duration) : 'โ€“:โ€“โ€“'}
); }