fixed visually

This commit is contained in:
2026-01-02 17:16:53 +01:00
parent a2753bcf66
commit c3f594d102
3 changed files with 39 additions and 9 deletions

View File

@@ -13,6 +13,8 @@ const audio = new Audio();
const stationNameEl = document.getElementById('station-name');
const stationSubtitleEl = document.getElementById('station-subtitle');
const nowPlayingEl = document.getElementById('now-playing');
const nowArtistEl = document.getElementById('now-artist');
const nowTitleEl = document.getElementById('now-title');
const statusTextEl = document.getElementById('status-text');
const statusDotEl = document.querySelector('.status-dot');
const playBtn = document.getElementById('play-btn');
@@ -215,12 +217,14 @@ function updateNowPlayingUI() {
const station = stations[currentIndex];
if (!station) return;
if (nowPlayingEl) {
if (nowPlayingEl && nowArtistEl && nowTitleEl) {
if (station.currentSongInfo && station.currentSongInfo.artist && station.currentSongInfo.title) {
nowPlayingEl.textContent = `${station.currentSongInfo.artist}${station.currentSongInfo.title}`;
nowArtistEl.textContent = station.currentSongInfo.artist;
nowTitleEl.textContent = station.currentSongInfo.title;
nowPlayingEl.classList.remove('hidden');
} else {
nowPlayingEl.textContent = '';
nowArtistEl.textContent = '';
nowTitleEl.textContent = '';
nowPlayingEl.classList.add('hidden');
}
}
@@ -419,10 +423,9 @@ function loadStation(index) {
stationNameEl.textContent = station.name;
stationSubtitleEl.textContent = currentMode === 'cast' ? `Casting to ${currentCastDevice}` : 'Live Stream';
// clear now playing when loading a new station; will be updated by poller if available
if (nowPlayingEl) {
nowPlayingEl.textContent = '';
nowPlayingEl.classList.add('hidden');
}
if (nowPlayingEl) nowPlayingEl.classList.add('hidden');
if (nowArtistEl) nowArtistEl.textContent = '';
if (nowTitleEl) nowTitleEl.textContent = '';
// Update Logo Text (First letter or number)
// Simple heuristic: if name has a number, use it, else first letter