Update media-server: UI polish and bug fixes

- Compact header and footer (reduced padding, margins, font sizes)
- Remove separator borders from header and footer
- Fix color contrast on hover states (white text on accent backgrounds)
- Fix album art not updating on track change (composite cache key)
- Slow vinyl spin animation (4s → 12s)
- Replace Add buttons with dashed-border add-cards
- Fix dialog header text color
- Make theme toggle button transparent

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-23 23:16:53 +03:00
parent 84b985e6df
commit 65b513ca17
3 changed files with 108 additions and 81 deletions

View File

@@ -364,7 +364,7 @@
let volumeUpdateTimer = null; // Timer for throttling volume updates
let scripts = [];
let lastStatus = null; // Store last status for locale switching
let lastArtworkSource = null; // Track artwork source to skip redundant loads
let lastArtworkKey = null; // Track artwork identity to skip redundant loads
// Dialog dirty state tracking
let scriptFormDirty = false;
@@ -656,11 +656,12 @@
currentState = status.state;
updatePlaybackState(status.state);
// Update album art (skip if same source to avoid redundant network requests)
// Update album art (skip if same track to avoid redundant network requests)
const artworkSource = status.album_art_url || null;
const artworkKey = `${status.title || ''}|${status.artist || ''}|${artworkSource || ''}`;
if (artworkSource !== lastArtworkSource) {
lastArtworkSource = artworkSource;
if (artworkKey !== lastArtworkKey) {
lastArtworkKey = artworkKey;
const artworkUrl = artworkSource
? `/api/media/artwork?token=${encodeURIComponent(localStorage.getItem('media_server_token'))}&_=${Date.now()}`
: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 300'%3E%3Crect fill='%23282828' width='300' height='300'/%3E%3Cpath fill='%236a6a6a' d='M150 80c-38.66 0-70 31.34-70 70s31.34 70 70 70 70-31.34 70-70-31.34-70-70-70zm0 20c27.614 0 50 22.386 50 50s-22.386 50-50 50-50-22.386-50-50 22.386-50 50-50zm0 30a20 20 0 100 40 20 20 0 000-40z'/%3E%3C/svg%3E";
@@ -886,33 +887,39 @@
const container = document.getElementById('scripts-container');
const grid = document.getElementById('scripts-grid');
if (scripts.length === 0) {
grid.innerHTML = `<div class="scripts-empty empty-state-illustration"><svg viewBox="0 0 64 64"><path d="M20 8l-8 48"/><path d="M44 8l8 48"/><path d="M10 24h44"/><path d="M8 40h44"/></svg><p>${t('scripts.no_scripts')}</p></div>`;
return;
}
grid.innerHTML = '';
scripts.forEach(script => {
const button = document.createElement('button');
button.className = 'script-btn';
button.onclick = () => executeScript(script.name, button);
if (scripts.length === 0) {
grid.innerHTML = `<div class="scripts-empty empty-state-illustration"><svg viewBox="0 0 64 64"><path d="M20 8l-8 48"/><path d="M44 8l8 48"/><path d="M10 24h44"/><path d="M8 40h44"/></svg><p>${t('scripts.no_scripts')}</p></div>`;
} else {
scripts.forEach(script => {
const button = document.createElement('button');
button.className = 'script-btn';
button.onclick = () => executeScript(script.name, button);
const label = document.createElement('div');
label.className = 'script-label';
label.textContent = script.label || script.name;
const label = document.createElement('div');
label.className = 'script-label';
label.textContent = script.label || script.name;
button.appendChild(label);
button.appendChild(label);
if (script.description) {
const description = document.createElement('div');
description.className = 'script-description';
description.textContent = script.description;
button.appendChild(description);
}
if (script.description) {
const description = document.createElement('div');
description.className = 'script-description';
description.textContent = script.description;
button.appendChild(description);
}
grid.appendChild(button);
});
grid.appendChild(button);
});
}
// Add "+" card at the end
const addCard = document.createElement('div');
addCard.className = 'script-btn add-card-grid';
addCard.onclick = () => showAddScriptDialog();
addCard.innerHTML = '<span class="add-card-icon">+</span>';
grid.appendChild(addCard);
}
async function executeScript(scriptName, buttonElement) {