js/css cleanup

This commit is contained in:
Julien Maille 2026-01-02 23:22:39 +01:00
parent c4feb35c45
commit 06c649de7b
2 changed files with 115 additions and 132 deletions

View file

@ -1,4 +1,3 @@
//js/app.js //js/app.js
import { LosslessAPI } from './api.js'; import { LosslessAPI } from './api.js';
import { apiSettings, themeManager, nowPlayingSettings, trackListSettings } from './storage.js'; import { apiSettings, themeManager, nowPlayingSettings, trackListSettings } from './storage.js';
@ -350,16 +349,17 @@ document.addEventListener('DOMContentLoaded', async () => {
btn.disabled = false; btn.disabled = false;
btn.innerHTML = originalHTML; btn.innerHTML = originalHTML;
} }
} }
if (e.target.closest('#create-playlist-btn')) { if (e.target.closest('#create-playlist-btn')) {
const modal = document.getElementById('playlist-modal'); const modal = document.getElementById('playlist-modal');
document.getElementById('playlist-modal-title').textContent = 'Create Playlist'; document.getElementById('playlist-modal-title').textContent = 'Create Playlist';
document.getElementById('playlist-name-input').value = ''; document.getElementById('playlist-name-input').value = '';
modal.style.display = 'flex'; modal.style.display = 'flex';
document.getElementById('playlist-name-input').focus(); document.getElementById('playlist-name-input').focus();
} }
if (e.target.closest('#playlist-modal-save')) { if (e.target.closest('#playlist-modal-save')) {
const name = document.getElementById('playlist-name-input').value.trim(); const name = document.getElementById('playlist-name-input').value.trim();
if (name) { if (name) {
const modal = document.getElementById('playlist-modal'); const modal = document.getElementById('playlist-modal');
@ -385,14 +385,13 @@ if (e.target.closest('#playlist-modal-save')) {
}); });
} }
} }
} }
if (e.target.closest('#playlist-modal-cancel')) {
if (e.target.closest('#playlist-modal-cancel')) {
document.getElementById('playlist-modal').style.display = 'none'; document.getElementById('playlist-modal').style.display = 'none';
} }
if (e.target.closest('.edit-playlist-btn')) { if (e.target.closest('.edit-playlist-btn')) {
const card = e.target.closest('.user-playlist'); const card = e.target.closest('.user-playlist');
const playlistId = card.dataset.playlistId; const playlistId = card.dataset.playlistId;
db.getPlaylist(playlistId).then(playlist => { db.getPlaylist(playlistId).then(playlist => {
@ -405,8 +404,9 @@ if (e.target.closest('.edit-playlist-btn')) {
document.getElementById('playlist-name-input').focus(); document.getElementById('playlist-name-input').focus();
} }
}); });
} }
if (e.target.closest('.delete-playlist-btn')) {
if (e.target.closest('.delete-playlist-btn')) {
const card = e.target.closest('.user-playlist'); const card = e.target.closest('.user-playlist');
const playlistId = card.dataset.playlistId; const playlistId = card.dataset.playlistId;
if (confirm('Are you sure you want to delete this playlist?')) { if (confirm('Are you sure you want to delete this playlist?')) {
@ -415,9 +415,9 @@ if (e.target.closest('.delete-playlist-btn')) {
ui.renderLibraryPage(); ui.renderLibraryPage();
}); });
} }
} }
if (e.target.closest('#edit-playlist-btn')) { if (e.target.closest('#edit-playlist-btn')) {
const playlistId = window.location.hash.split('/')[1]; const playlistId = window.location.hash.split('/')[1];
db.getPlaylist(playlistId).then(playlist => { db.getPlaylist(playlistId).then(playlist => {
if (playlist) { if (playlist) {
@ -429,18 +429,16 @@ if (e.target.closest('#edit-playlist-btn')) {
document.getElementById('playlist-name-input').focus(); document.getElementById('playlist-name-input').focus();
} }
}); });
} }
if (e.target.closest('#delete-playlist-btn')) { if (e.target.closest('#delete-playlist-btn')) {
const playlistId = window.location.hash.split('/')[1]; const playlistId = window.location.hash.split('/')[1];
if (confirm('Are you sure you want to delete this playlist?')) { if (confirm('Are you sure you want to delete this playlist?')) {
db.deletePlaylist(playlistId).then(() => { db.deletePlaylist(playlistId).then(() => {
window.location.hash = '#library'; window.location.hash = '#library';
}); });
} }
} }
if (e.target.closest('.remove-from-playlist-btn')) { if (e.target.closest('.remove-from-playlist-btn')) {
const btn = e.target.closest('.remove-from-playlist-btn'); const btn = e.target.closest('.remove-from-playlist-btn');
@ -453,8 +451,7 @@ if (e.target.closest('#delete-playlist-btn')) {
ui.renderPlaylistPage(playlistId); ui.renderPlaylistPage(playlistId);
} }
}); });
} }
if (e.target.closest('#play-playlist-btn')) { if (e.target.closest('#play-playlist-btn')) {
const btn = e.target.closest('#play-playlist-btn'); const btn = e.target.closest('#play-playlist-btn');

View file

@ -1125,20 +1125,6 @@ body.has-page-background .track-item:hover {
flex-shrink: 0; flex-shrink: 0;
} }
#like-album-btn,
#like-playlist-btn,
#like-artist-btn {
width: auto;
height: auto;
padding: 0.875rem;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
flex-shrink: 0;
aspect-ratio: 1/1;
}
.btn-secondary { .btn-secondary {
padding: 0.5rem 1rem; padding: 0.5rem 1rem;
background-color: var(--secondary); background-color: var(--secondary);
@ -2804,7 +2790,7 @@ input:checked + .slider::before {
} }
.track-item { .track-item {
grid-template-columns: 32px 1fr 40px 28px; grid-template-columns: 32px 1fr 40px auto;
gap: 0.375rem; gap: 0.375rem;
padding: var(--spacing-xs); padding: var(--spacing-xs);
} }
@ -2929,7 +2915,7 @@ input:checked + .slider::before {
} }
.track-item { .track-item {
grid-template-columns: 32px 1fr 40px 36px; grid-template-columns: 32px 1fr 32px auto;
} }
.player-controls .buttons button { .player-controls .buttons button {