import { h } from 'preact'; import htm from 'htm'; import { api } from '../api.js'; const html = htm.bind(h); const SOURCE_ICONS = { TUNEIN: '📻', SPOTIFY: '🎵', AMAZON: '🛒', PANDORA: '🎶', BLUETOOTH: '📶', AUX: '🔌', OPTICAL: '💡', HDMI: '📺', IHEARTRADIO: '❤️', DEEZER: '🎼', LOCAL_INTERNET_RADIO: '📡', AIRPLAY: '📡', PRODUCT: '🔊', }; export function Sources({ deviceId, status }) { const items = status?.sources?.SourceItem ?? []; const currentSource = status?.nowPlaying?.Source; const currentAccount = status?.nowPlaying?.SourceAccount; const ready = items.filter(s => s.Status === 'READY'); if (ready.length === 0) return null; function select(src) { api.selectSource(deviceId, src.Source, src.SourceAccount ?? ''); } return html`