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

@@ -108,16 +108,15 @@
.container {
max-width: 800px;
margin: 0 auto;
padding: 2rem;
padding: 2rem 2rem 0.5rem;
}
header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 2rem;
padding-bottom: 1rem;
border-bottom: 1px solid var(--border);
margin-bottom: 0.75rem;
padding-bottom: 0.5rem;
}
h1 {
@@ -148,27 +147,27 @@
}
.theme-toggle {
background: var(--bg-tertiary);
border: 1px solid var(--border);
border-radius: 8px;
padding: 0.5rem;
background: transparent;
border: none;
padding: 0.3rem;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.3s;
width: 40px;
height: 40px;
transition: opacity 0.3s;
width: 32px;
height: 32px;
opacity: 0.7;
}
.theme-toggle:hover {
background: var(--border);
opacity: 1;
}
.theme-toggle svg {
width: 20px;
height: 20px;
fill: var(--text-primary);
width: 16px;
height: 16px;
fill: currentColor;
}
#locale-select {
@@ -176,9 +175,9 @@
border: 1px solid var(--border);
color: var(--text-primary);
border-radius: 6px;
padding: 6px 12px;
padding: 4px 8px;
cursor: pointer;
font-size: 14px;
font-size: 12px;
font-weight: 500;
transition: all 0.3s ease;
}
@@ -343,11 +342,11 @@
}
.album-art-container.vinyl.spinning #album-art {
animation: vinylSpin 4s linear infinite;
animation: vinylSpin 12s linear infinite;
}
.album-art-container.vinyl.paused #album-art {
animation: vinylSpin 4s linear infinite;
animation: vinylSpin 12s linear infinite;
animation-play-state: paused;
}
@@ -471,6 +470,7 @@
button:hover:not(:disabled) {
background: var(--accent);
color: #fff;
transform: scale(1.05);
}
@@ -487,6 +487,7 @@
button.primary:hover:not(:disabled) {
background: var(--accent-hover);
color: #fff;
transform: scale(1.1);
}
@@ -640,6 +641,7 @@
.script-btn:hover:not(:disabled) {
background: var(--accent);
border-color: var(--accent);
color: #fff;
transform: translateY(-2px);
}
@@ -657,6 +659,11 @@
font-size: 0.75rem;
color: var(--text-secondary);
text-align: center;
transition: color 0.2s;
}
.script-btn:hover:not(:disabled) .script-description {
color: rgba(255, 255, 255, 0.85);
}
.script-btn.executing {
@@ -679,28 +686,38 @@
color: var(--text-primary);
}
.script-management-header {
.add-card {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 1.5rem;
}
.add-script-btn {
padding: 0.5rem 1.5rem;
border-radius: 6px;
background: var(--accent);
border: none;
color: var(--text-primary);
justify-content: center;
border: 2px dashed var(--border);
border-radius: 8px;
padding: 1.5rem;
margin-top: 1rem;
cursor: pointer;
font-size: 0.875rem;
font-weight: 600;
transition: background 0.2s;
min-width: 140px;
transition: border-color 0.2s, background 0.2s;
}
.add-script-btn:hover {
background: var(--accent-hover);
.add-card:hover {
border-color: var(--text-muted);
background: var(--bg-tertiary);
}
.add-card-icon {
font-size: 1.5rem;
color: var(--text-muted);
font-weight: 300;
line-height: 1;
}
.add-card-grid {
border: 2px dashed var(--border);
background: transparent;
}
.add-card-grid:hover:not(:disabled) {
border-color: var(--text-muted);
background: var(--bg-tertiary);
}
.scripts-table {
@@ -762,12 +779,14 @@
.action-btn:hover {
background: var(--accent);
border-color: var(--accent);
color: #fff;
transform: translateY(-1px);
}
.action-btn.delete:hover {
background: var(--error);
border-color: var(--error);
color: #fff;
}
.action-buttons {
@@ -779,6 +798,7 @@
.action-btn.execute:hover {
background: #3b82f6;
border-color: #3b82f6;
color: #fff;
}
/* Execution Result Dialog */
@@ -862,6 +882,7 @@
/* Dialog Styles */
dialog {
background: var(--bg-secondary);
color: var(--text-primary);
border: 1px solid var(--border);
border-radius: 12px;
padding: 0;
@@ -882,7 +903,7 @@
.dialog-header {
padding: 1.5rem;
background: var(--bg-tertiary);
background: var(--bg-secondary);
border-bottom: 1px solid var(--border);
}
@@ -1135,9 +1156,9 @@
.clear-token-btn {
width: auto;
height: auto;
padding: 6px 12px;
padding: 4px 10px;
border-radius: 6px;
font-size: 14px;
font-size: 12px;
font-weight: 500;
background: var(--bg-tertiary);
color: var(--text-secondary);
@@ -1317,6 +1338,7 @@
.mini-control-btn:hover {
background: var(--accent);
border-color: var(--accent);
color: #fff;
transform: scale(1.05);
}
@@ -1415,11 +1437,10 @@
/* Footer */
footer {
text-align: center;
padding: 2rem 1rem;
margin-top: 3rem;
border-top: 1px solid var(--border);
color: var(--text-secondary);
font-size: 0.875rem;
padding: 0.75rem 1rem;
margin-top: 0.5rem;
color: var(--text-muted);
font-size: 0.75rem;
transition: padding-bottom 0.3s ease-in-out;
}
@@ -2092,6 +2113,7 @@
.pagination button:hover:not(:disabled) {
background: var(--accent);
border-color: var(--accent);
color: #fff;
transform: none;
}

View File

@@ -65,7 +65,7 @@
<span class="status-dot" id="status-dot"></span>
<span class="version-label" id="version-label"></span>
</div>
<div style="display: flex; align-items: center; gap: 1rem;">
<div style="display: flex; align-items: center; gap: 0.5rem;">
<button class="theme-toggle" onclick="toggleTheme()" data-i18n-title="player.theme" title="Toggle theme" id="theme-toggle">
<svg id="theme-icon-sun" viewBox="0 0 24 24" style="display: none;">
<path d="M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zM2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1zm18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1zM11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1zm0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1zM5.99 4.58c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41L5.99 4.58zm12.37 12.37c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0 .39-.39.39-1.03 0-1.41l-1.06-1.06zm1.06-10.96c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06zM7.05 18.36c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06z"/>
@@ -177,8 +177,6 @@
<!-- Media Browser Section -->
<div class="browser-container" data-tab-content="browser" >
<h2 data-i18n="browser.title">Media Browser</h2>
<!-- Breadcrumb Navigation -->
<div class="breadcrumb" id="breadcrumb"></div>
@@ -246,21 +244,19 @@
<!-- Scripts Section (Quick Actions) -->
<div class="scripts-container" id="scripts-container" data-tab-content="quick-actions" >
<h2 data-i18n="scripts.quick_actions">Quick Actions</h2>
<div class="scripts-grid" id="scripts-grid">
<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 data-i18n="scripts.no_scripts">No scripts configured</p>
</div>
<div class="script-btn add-card-grid" onclick="showAddScriptDialog()">
<span class="add-card-icon">+</span>
</div>
</div>
</div>
<!-- Script Management Section -->
<div class="script-management" data-tab-content="scripts" >
<div class="script-management-header">
<h2 data-i18n="scripts.management">Script Management</h2>
<button class="add-script-btn" onclick="showAddScriptDialog()" data-i18n="scripts.add">+ Add</button>
</div>
<table class="scripts-table">
<thead>
<tr>
@@ -282,14 +278,13 @@
</tr>
</tbody>
</table>
<div class="add-card" onclick="showAddScriptDialog()">
<span class="add-card-icon">+</span>
</div>
</div>
<!-- Callback Management Section -->
<div class="script-management" id="callbacksSection" data-tab-content="callbacks" >
<div class="script-management-header">
<h2 data-i18n="callbacks.management">Callback Management</h2>
<button class="add-script-btn" onclick="showAddCallbackDialog()" data-i18n="callbacks.add">+ Add</button>
</div>
<p style="color: var(--text-secondary); font-size: 0.875rem; margin-bottom: 1rem;" data-i18n="callbacks.description">
Callbacks are scripts triggered automatically by media control events (play, pause, stop, etc.)
</p>
@@ -313,6 +308,9 @@
</tr>
</tbody>
</table>
<div class="add-card" onclick="showAddCallbackDialog()">
<span class="add-card-icon">+</span>
</div>
</div>
</div>

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) {