Add library sections and track covers
All checks were successful
Deploy Palico Bot / check (push) Successful in 9s
Deploy Palico Bot / deploy (push) Successful in 7s

Sections:
- The library can be split into named, ordered sections, stored in
  storage/runtime/sections.json; each track keeps its sectionId.
- Sections are created, renamed, reordered and deleted from the page
  (/api/library/sections). Deleting one keeps its tracks, without a
  section.
- A section, or the tracks without one, can be queued in one go,
  shuffled or not (enqueue-all takes a sectionId).
- The upload form (file or link) picks the section of a kept track.
- Without any section, the library stays a plain list.

Covers:
- A kept track takes the cover embedded in its file (MP3, FLAC...),
  from the web page or /play garder:. Older tracks are looked at once
  on startup; a track without one keeps cover: null.
- "Renommer" becomes "Modifier": a dialog to change the title, the
  section and the cover (upload with preview, or removal).
- ffmpeg turns covers into JPEGs of at most 512 px, stored in
  storage/covers and deleted with their track. An uploaded image is
  only passed to ffmpeg after its signature is checked (PNG, JPEG,
  WebP, GIF), with that decoder forced, so ffmpeg never guesses the
  format of an unknown file.
- Covers are served under /covers without authentication, since an
  <img> cannot send the key; their random names are only given by the
  API and never change content (one-year cache).
- The current track and the queue show the cover of their library
  track.

Docs: README lists the new data to back up; storage/covers is ignored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-12-01 21:27:49 +01:00
parent 3795ee06cb
commit 11ee972636
19 changed files with 1258 additions and 76 deletions

View file

@ -168,11 +168,12 @@
<div>
<h2 id="libraryTitle">Bibliothèque permanente</h2>
<p class="panel__subtitle">
Les fichiers conservés sont listés ici. Ajoute-les à la file,
renomme-les ou supprime-les.
Les fichiers conservés sont listés ici. Range-les en sections,
donne-leur une pochette, ajoute-les à la file.
</p>
</div>
<div class="toolbar">
<button id="newSectionBtn" class="btn btn--secondary btn--small" type="button">Nouvelle section</button>
<button id="enqueueAllBtn" class="btn btn--secondary btn--small" type="button">Tout ajouter</button>
<button id="enqueueAllShuffledBtn" class="btn btn--secondary btn--small" type="button">
Tout ajouter, mélangé
@ -186,10 +187,39 @@
placeholder="Rechercher un morceau…"
autocomplete="off"
/>
<ul id="libraryList" class="list list--stack"></ul>
<div id="libraryList" class="library"></div>
<p id="libraryEmpty" class="text--muted">Aucun fichier permanent enregistré.</p>
</section>
<dialog id="trackDialog" class="dialog" aria-labelledby="trackDialogTitle">
<form id="trackForm">
<h2 id="trackDialogTitle">Modifier le morceau</h2>
<div class="track-editor">
<div id="trackCoverPreview" class="cover cover--large cover--empty" aria-hidden="true"></div>
<div class="track-editor__cover-fields">
<label for="trackCoverInput">Pochette</label>
<input type="file" id="trackCoverInput" accept="image/png,image/jpeg,image/webp,image/gif" />
<p class="hint">PNG, JPEG, WebP ou GIF, 10 Mo au plus. Recadrée à 512 px.</p>
<button id="trackCoverRemoveBtn" class="btn btn--ghost btn--small u-mt-1" type="button">
Retirer la pochette
</button>
</div>
</div>
<label for="trackTitleInput" class="u-mt-1">Titre</label>
<input type="text" id="trackTitleInput" maxlength="200" required />
<label for="trackSectionSelect" class="u-mt-1">Section</label>
<select id="trackSectionSelect"></select>
<div class="form-actions toolbar">
<button id="trackCancelBtn" class="btn btn--ghost" type="button">Annuler</button>
<button id="trackSaveBtn" class="btn" type="submit">Enregistrer</button>
</div>
</form>
</dialog>
<section class="panel panel--glass" id="uploadSection" aria-labelledby="uploadTitle">
<div class="panel__header">
<div>
@ -213,6 +243,11 @@
</label>
</div>
<div id="uploadSectionField" class="u-mt-1" hidden>
<label for="uploadSectionSelect">Section de la bibliothèque</label>
<select id="uploadSectionSelect"></select>
</div>
<form id="uploadForm" class="u-mt-1">
<label for="musicFile">Fichiers audio</label>
<input type="file" id="musicFile" name="musicFile" accept="audio/*,video/*" multiple required />

View file

@ -1,6 +1,6 @@
/**
* @file Page du jukebox : connexion (Discord ou mot de passe), lecteur, file d'attente, bibliothèque
* et ajout de morceaux.
* (sections, pochettes) et ajout de morceaux.
*
* Contexte : servi tel quel au navigateur (module ES, sans compilation) ; ne parle qu'à l'API de
* src/web/.
@ -12,6 +12,10 @@
* - Le flux est lu avec fetch, et non EventSource, qui ne permet pas d'envoyer la clé.
* - Connecté avec Discord, la session (cookie) remplace la clé : pas d'en-tête Authorization.
* - Tout texte venu de l'API passe par escapeHtml avant d'aller dans innerHTML.
* - Les morceaux de la file n'ont pas de pochette : elle est prise sur leur morceau de bibliothèque
* (libraryTrackId), d'où le nouvel affichage de la file à chaque changement de la bibliothèque.
* - L'aperçu d'une pochette choisie passe par une URL data: ; la politique de sécurité des contenus
* (helmet) refuse les URL blob:.
* @see README.md#jukebox
*/
@ -44,6 +48,10 @@ const state = {
queue: [],
current: null,
library: [],
libraryById: new Map(),
sections: [],
// Sections repliées par la personne ("" : les morceaux sans section).
collapsedSections: new Set(),
status: "idle",
loop: false,
// Position du morceau en cours (ms) au moment où l'état a été reçu.
@ -81,6 +89,7 @@ const elements = {
libraryList: $("libraryList"),
libraryEmpty: $("libraryEmpty"),
librarySearch: $("librarySearch"),
newSectionBtn: $("newSectionBtn"),
enqueueAllBtn: $("enqueueAllBtn"),
enqueueAllShuffledBtn: $("enqueueAllShuffledBtn"),
uploadSection: $("uploadSection"),
@ -90,6 +99,8 @@ const elements = {
notesInput: $("uploadNotes"),
permanentCheckbox: $("permanentFile"),
enqueueCheckbox: $("enqueueFile"),
uploadSectionField: $("uploadSectionField"),
uploadSectionSelect: $("uploadSectionSelect"),
uploadList: $("uploadList"),
urlForm: $("urlForm"),
urlInput: $("musicUrl"),
@ -97,6 +108,15 @@ const elements = {
heroUploadBtn: $("heroUploadBtn"),
heroQueueBtn: $("heroQueueBtn"),
queueSection: $("queueSection"),
trackDialog: $("trackDialog"),
trackForm: $("trackForm"),
trackCoverPreview: $("trackCoverPreview"),
trackCoverInput: $("trackCoverInput"),
trackCoverRemoveBtn: $("trackCoverRemoveBtn"),
trackTitleInput: $("trackTitleInput"),
trackSectionSelect: $("trackSectionSelect"),
trackCancelBtn: $("trackCancelBtn"),
trackSaveBtn: $("trackSaveBtn"),
};
const { setStatus, clearStatus } = createStatusManager(elements.status);
@ -137,7 +157,7 @@ async function performRefresh() {
apiFetch("/library"),
]);
applySnapshot(queueData);
applyLibrary(libraryData.tracks || []);
applyLibrary(libraryData);
} catch (error) {
handleApiError(error);
}
@ -145,8 +165,7 @@ async function performRefresh() {
async function refreshLibrary() {
try {
const libraryData = await apiFetch("/library");
applyLibrary(libraryData.tracks || []);
applyLibrary(await apiFetch("/library"));
} catch (error) {
handleApiError(error);
}
@ -189,9 +208,14 @@ function applySnapshot(snapshot) {
renderProgress();
}
function applyLibrary(tracks) {
function applyLibrary({ tracks = [], sections = [] }) {
state.library = tracks;
state.libraryById = new Map(tracks.map((track) => [track.id, track]));
state.sections = sections;
renderLibrary();
renderSectionChoices();
renderCurrentTrack();
renderQueue();
}
// ---------------------------------------------------------------------------
@ -284,6 +308,19 @@ async function connectEvents() {
// ---------------------------------------------------------------------------
// Affichage
// Pochette d'un morceau : la sienne (bibliothèque), sinon celle de son morceau de bibliothèque.
function coverUrlOf(track) {
return track.coverUrl ?? state.libraryById.get(track.libraryTrackId)?.coverUrl ?? null;
}
// Les adresses viennent du serveur (/covers/<nom aléatoire>) mais passent quand même par escapeHtml.
function coverHtml(url, modifier = "") {
const className = `cover ${modifier}`.trim();
return url
? `<img class="${className}" src="${escapeHtml(url)}" alt="" loading="lazy" />`
: `<div class="${className} cover--empty" aria-hidden="true"></div>`;
}
function trackMeta(track) {
const parts = [];
const duration = formatDuration(track.duration);
@ -307,9 +344,12 @@ function renderCurrentTrack() {
elements.currentTrack.classList.remove("player-current--empty");
elements.currentTrack.innerHTML = `
<div class="media-item__title">${escapeHtml(track.title || track.originalName)}</div>
<div class="media-item__meta">${trackMeta(track)}</div>
<div class="media-item__meta">Commencé à ${formatDate(track.startedAt || track.createdAt)}</div>
${coverHtml(coverUrlOf(track), "cover--large")}
<div class="media-item__info">
<div class="media-item__title">${escapeHtml(track.title || track.originalName)}</div>
<div class="media-item__meta">${trackMeta(track)}</div>
<div class="media-item__meta">Commencé à ${formatDate(track.startedAt || track.createdAt)}</div>
</div>
`;
}
@ -350,6 +390,7 @@ function renderQueue() {
const li = document.createElement("li");
li.className = "media-item media-item--queue";
li.innerHTML = `
${coverHtml(coverUrlOf(track))}
<div class="media-item__info">
<div class="media-item__title">${index + 1}. ${escapeHtml(track.title || track.originalName)}</div>
<div class="media-item__meta">${trackMeta(track)}</div>
@ -369,28 +410,114 @@ function renderQueue() {
});
}
// Groupes de la bibliothèque, dans l'ordre des sections ; « Sans section » en dernier.
function libraryGroups() {
const groups = state.sections.map((section) => ({ section, tracks: [] }));
const bySection = new Map(groups.map((group) => [group.section.id, group]));
const unsorted = { section: null, tracks: [] };
for (const track of state.library) {
(bySection.get(track.sectionId) ?? unsorted).tracks.push(track);
}
return [...groups, unsorted];
}
function renderLibrary() {
const query = elements.librarySearch.value.trim().toLowerCase();
const tracks = state.library.filter((track) =>
const matches = (track) =>
`${track.title || ""} ${track.originalName || ""} ${track.artist || ""}`
.toLowerCase()
.includes(query)
);
.includes(query);
const matchCount = state.library.filter(matches).length;
elements.libraryList.replaceChildren();
elements.libraryEmpty.hidden = tracks.length > 0;
elements.libraryEmpty.textContent =
state.library.length === 0
? "Aucun fichier permanent enregistré."
: "Aucun morceau ne correspond à la recherche.";
const isEmpty = state.library.length === 0 && state.sections.length === 0;
elements.libraryEmpty.hidden = !isEmpty && (matchCount > 0 || !query);
elements.libraryEmpty.textContent = isEmpty
? "Aucun fichier permanent enregistré."
: "Aucun morceau ne correspond à la recherche.";
elements.enqueueAllBtn.disabled = state.library.length === 0;
elements.enqueueAllShuffledBtn.disabled = state.library.length === 0;
tracks.forEach((track) => {
// Sans section créée, la bibliothèque reste une simple liste.
if (state.sections.length === 0) {
elements.libraryList.append(renderTrackList(state.library.filter(matches)));
return;
}
const groups = libraryGroups();
groups.forEach((group, index) => {
const shown = group.tracks.filter(matches);
if (shown.length === 0 && (query || !group.section)) return;
elements.libraryList.append(
renderSection(group, shown, {
index,
last: state.sections.length - 1,
searching: Boolean(query),
})
);
});
}
function renderSection({ section, tracks }, shown, { index, last, searching }) {
const key = section?.id ?? "";
const details = document.createElement("details");
details.className = "library-section";
details.open = searching || !state.collapsedSections.has(key);
details.addEventListener("toggle", () => {
if (searching) return;
if (details.open) state.collapsedSections.delete(key);
else state.collapsedSections.add(key);
});
const total = tracks.reduce((sum, track) => sum + (track.duration || 0), 0);
const count = searching ? `${shown.length} sur ${tracks.length}` : String(tracks.length);
const disabledIfEmpty = tracks.length === 0 ? "disabled" : "";
details.innerHTML = `
<summary class="library-section__summary">
<span class="library-section__name">${escapeHtml(section?.name ?? "Sans section")}</span>
<span class="library-section__count">
${count} morceau(x)${total ? ` • ${formatDuration(total)}` : ""}
</span>
</summary>
<div class="library-section__toolbar toolbar">
<button class="btn btn--secondary btn--small" type="button" data-action="enqueue" ${disabledIfEmpty}>Tout ajouter</button>
<button class="btn btn--secondary btn--small" type="button" data-action="shuffle" ${disabledIfEmpty}>Mélangé</button>
${
section
? `<button class="btn btn--secondary btn--small" type="button" data-action="rename">Renommer</button>
<button class="btn btn--secondary btn--small" type="button" data-action="up" aria-label="Monter la section" title="Monter" ${index === 0 ? "disabled" : ""}>▲</button>
<button class="btn btn--secondary btn--small" type="button" data-action="down" aria-label="Descendre la section" title="Descendre" ${index === last ? "disabled" : ""}>▼</button>
<button class="btn btn--danger btn--small" type="button" data-action="delete">Supprimer</button>`
: ""
}
</div>
`;
details.querySelectorAll(".library-section__toolbar button").forEach((button) => {
button.addEventListener("click", () =>
handleSectionAction(button.dataset.action, section, index, button)
);
});
if (tracks.length === 0) {
const empty = document.createElement("p");
empty.className = "hint library-section__empty";
empty.textContent = "Aucun morceau dans cette section : choisis-la avec « Modifier » sur un morceau.";
details.append(empty);
} else {
details.append(renderTrackList(shown));
}
return details;
}
function renderTrackList(tracks) {
const list = document.createElement("ul");
list.className = "list list--stack";
for (const track of tracks) {
const li = document.createElement("li");
li.className = "media-item media-item--library";
const duration = formatDuration(track.duration);
li.innerHTML = `
${coverHtml(track.coverUrl)}
<div class="media-item__info">
<div class="media-item__title">${escapeHtml(track.title || track.originalName)}</div>
<div class="media-item__meta">
@ -399,7 +526,7 @@ function renderLibrary() {
</div>
<div class="media-item__actions">
<button class="btn btn--small" type="button" data-action="enqueue">Ajouter</button>
<button class="btn btn--secondary btn--small" type="button" data-action="rename">Renommer</button>
<button class="btn btn--secondary btn--small" type="button" data-action="edit">Modifier</button>
<button class="btn btn--danger btn--small" type="button" data-action="delete">Supprimer</button>
</div>
`;
@ -408,8 +535,23 @@ function renderLibrary() {
handleLibraryAction(button.dataset.action, track, button)
);
});
elements.libraryList.appendChild(li);
});
list.append(li);
}
return list;
}
// Listes de sections du formulaire d'ajout et de la fenêtre de modification.
function renderSectionChoices() {
for (const select of [elements.uploadSectionSelect, elements.trackSectionSelect]) {
const selected = select.value;
select.replaceChildren(new Option("Sans section", ""));
for (const section of state.sections) {
select.append(new Option(section.name, section.id));
}
select.value = state.sections.some((section) => section.id === selected) ? selected : "";
}
elements.uploadSectionField.hidden =
state.sections.length === 0 || !elements.permanentCheckbox.checked;
}
function renderControls() {
@ -480,13 +622,9 @@ async function handleLibraryAction(action, track, button) {
})
);
setStatus(`« ${track.title || track.originalName} » ajouté à la file`, "success");
} else if (action === "rename") {
const title = prompt("Nouveau titre", track.title || track.originalName);
if (!title || !title.trim()) return;
await withBusyButton(button, () =>
apiFetch(`/library/${track.id}`, { method: "PATCH", body: { title: title.trim() } })
);
if (!state.live) await refreshLibrary();
} else if (action === "edit") {
openTrackEditor(track);
return;
} else if (action === "delete") {
if (!confirm(`Supprimer « ${track.title || track.originalName} » de la bibliothèque ?`)) {
return;
@ -502,12 +640,13 @@ async function handleLibraryAction(action, track, button) {
}
}
async function enqueueAll(shuffle, button) {
// sectionId : undefined pour toute la bibliothèque, null pour les morceaux sans section.
async function enqueueAll(shuffle, button, sectionId) {
try {
const { tracks } = await withBusyButton(button, () =>
apiFetch("/library/enqueue-all", {
method: "POST",
body: { shuffle, requestedBy: requesterName() },
body: { shuffle, sectionId, requestedBy: requesterName() },
})
);
setStatus(`${tracks.length} morceau(x) ajouté(s) à la file`, "success");
@ -517,8 +656,143 @@ async function enqueueAll(shuffle, button) {
}
}
async function createSection(button) {
const name = prompt("Nom de la nouvelle section");
if (!name || !name.trim()) return;
try {
await withBusyButton(button, () =>
apiFetch("/library/sections", { method: "POST", body: { name: name.trim() } })
);
if (!state.live) await refreshLibrary();
} catch (error) {
setStatus(`Création de la section impossible : ${error.message}`, "error");
}
}
// section vaut null pour le groupe « Sans section », qui n'a que les actions d'ajout.
async function handleSectionAction(action, section, index, button) {
try {
if (action === "enqueue" || action === "shuffle") {
await enqueueAll(action === "shuffle", button, section?.id ?? null);
return;
}
if (action === "rename") {
const name = prompt("Nouveau nom de la section", section.name);
if (!name || !name.trim()) return;
await withBusyButton(button, () =>
apiFetch(`/library/sections/${section.id}`, {
method: "PATCH",
body: { name: name.trim() },
})
);
} else if (action === "up" || action === "down") {
const position = index + (action === "up" ? -1 : 1);
await withBusyButton(button, () =>
apiFetch(`/library/sections/${section.id}`, { method: "PATCH", body: { position } })
);
} else if (action === "delete") {
if (
!confirm(
`Supprimer la section « ${section.name} » ? Ses morceaux restent dans la bibliothèque, sans section.`
)
) {
return;
}
await withBusyButton(button, () =>
apiFetch(`/library/sections/${section.id}`, { method: "DELETE" })
);
}
if (!state.live) await refreshLibrary();
} catch (error) {
setStatus(`Action sur la section impossible : ${error.message}`, "error");
}
}
// ---------------------------------------------------------------------------
// Fenêtre de modification d'un morceau (titre, section, pochette)
const MAX_COVER_SIZE = 10 * 1024 * 1024;
let editedTrack = null;
let removeCover = false;
function showCoverPreview(url) {
const preview = elements.trackCoverPreview;
preview.classList.toggle("cover--empty", !url);
preview.style.backgroundImage = url ? `url("${url}")` : "";
}
function openTrackEditor(track) {
editedTrack = track;
removeCover = false;
elements.trackTitleInput.value = track.title || track.originalName;
renderSectionChoices();
elements.trackSectionSelect.value = track.sectionId ?? "";
elements.trackCoverInput.value = "";
elements.trackCoverRemoveBtn.hidden = !track.coverUrl;
showCoverPreview(track.coverUrl);
elements.trackDialog.showModal();
}
function previewChosenCover() {
const file = elements.trackCoverInput.files[0];
if (!file) {
showCoverPreview(removeCover ? null : editedTrack?.coverUrl);
return;
}
if (file.size > MAX_COVER_SIZE) {
setStatus("Image trop lourde : 10 Mo au plus", "error");
elements.trackCoverInput.value = "";
return;
}
const reader = new FileReader();
reader.addEventListener("load", () => showCoverPreview(reader.result));
reader.readAsDataURL(file);
elements.trackCoverRemoveBtn.hidden = false;
}
function clearChosenCover() {
removeCover = true;
elements.trackCoverInput.value = "";
elements.trackCoverRemoveBtn.hidden = true;
showCoverPreview(null);
}
async function saveTrackEditor(event) {
event.preventDefault();
const track = editedTrack;
if (!track) return;
const changes = {};
const title = elements.trackTitleInput.value.trim();
if (title && title !== (track.title || track.originalName)) changes.title = title;
const sectionId = elements.trackSectionSelect.value || null;
if (sectionId !== (track.sectionId ?? null)) changes.sectionId = sectionId;
const coverFile = elements.trackCoverInput.files[0];
try {
await withBusyButton(elements.trackSaveBtn, async () => {
if (Object.keys(changes).length > 0) {
await apiFetch(`/library/${track.id}`, { method: "PATCH", body: changes });
}
if (coverFile) {
const data = new FormData();
data.append("cover", coverFile);
await apiFetch(`/library/${track.id}/cover`, { method: "PUT", body: data });
} else if (removeCover && track.coverUrl) {
await apiFetch(`/library/${track.id}/cover`, { method: "DELETE" });
}
});
elements.trackDialog.close();
if (!state.live) await refreshLibrary();
} catch (error) {
// La fenêtre reste ouverte : la personne peut corriger (autre image…) et réessayer.
setStatus(`Modification impossible : ${error.message}`, "error");
if (!state.live) await refreshLibrary();
}
}
// Envoi avec XMLHttpRequest : contrairement à fetch, il indique la progression de l'envoi.
function uploadFile(file, { permanent, enqueue, title, onProgress }) {
function uploadFile(file, { permanent, enqueue, section, title, onProgress }) {
return new Promise((resolve, reject) => {
const data = new FormData();
data.append("file", file);
@ -526,6 +800,7 @@ function uploadFile(file, { permanent, enqueue, title, onProgress }) {
data.append("enqueue", String(enqueue));
data.append("uploader", requesterName());
if (title) data.append("notes", title);
if (permanent && section) data.append("section", section);
const request = new XMLHttpRequest();
request.open("POST", "/api/uploads");
@ -584,6 +859,7 @@ async function handleUpload(event) {
const options = {
permanent: elements.permanentCheckbox.checked,
enqueue: elements.enqueueCheckbox.checked,
section: elements.uploadSectionSelect.value,
};
if (!options.permanent && !options.enqueue) {
setStatus("Un fichier temporaire doit être ajouté à la file d'attente", "error");
@ -638,6 +914,7 @@ async function handleUrlSubmit(event) {
url,
permanent: elements.permanentCheckbox.checked,
enqueue: elements.enqueueCheckbox.checked,
section: elements.uploadSectionSelect.value || undefined,
uploader: requesterName(),
},
})
@ -737,6 +1014,16 @@ function bindEvents() {
});
elements.librarySearch.addEventListener("input", renderLibrary);
elements.newSectionBtn.addEventListener("click", () => createSection(elements.newSectionBtn));
elements.permanentCheckbox.addEventListener("change", renderSectionChoices);
elements.trackForm.addEventListener("submit", saveTrackEditor);
elements.trackCancelBtn.addEventListener("click", () => elements.trackDialog.close());
elements.trackCoverInput.addEventListener("change", previewChosenCover);
elements.trackCoverRemoveBtn.addEventListener("click", clearChosenCover);
elements.trackDialog.addEventListener("close", () => {
editedTrack = null;
});
elements.enqueueAllBtn.addEventListener("click", () =>
enqueueAll(false, elements.enqueueAllBtn)
);

View file

@ -434,6 +434,12 @@ a.btn {
text-align: center;
}
.player-current:not(.player-current--empty) {
display: flex;
align-items: center;
gap: 1.1rem;
}
.progress {
margin-top: 0.9rem;
}
@ -588,6 +594,131 @@ a.btn {
gap: 0.4rem;
}
/* Pochette d'un morceau : <img>, ou <div> vide (note de musique) ou à image de fond (aperçu). */
.cover {
flex-shrink: 0;
width: 48px;
height: 48px;
border-radius: 10px;
object-fit: cover;
background: var(--surface-soft) center / cover no-repeat;
border: 1px solid var(--border);
}
.cover--large {
width: 96px;
height: 96px;
border-radius: 14px;
}
.cover--empty {
display: grid;
place-items: center;
color: var(--muted-dark);
&::after {
content: "♪";
font-size: 1.4rem;
}
&.cover--large::after {
font-size: 2.4rem;
}
}
/* ------------------------------------------------------------------------------------------------
* Bibliothèque : sections repliables et fenêtre de modification d'un morceau
*/
.library {
margin-top: 1rem;
}
.library-section {
border: 1px solid var(--border);
border-radius: 14px;
padding: 0 1rem;
margin-bottom: 0.75rem;
background: var(--surface-soft);
& .list--stack > li:last-child {
border-bottom: none;
}
}
.library-section__summary {
display: flex;
align-items: baseline;
flex-wrap: wrap;
gap: 0.25rem 0.75rem;
padding: 0.85rem 0;
cursor: pointer;
list-style: none;
&::-webkit-details-marker {
display: none;
}
&::before {
content: "▸";
color: var(--accent);
transition: transform 0.15s ease;
}
[open] > &::before {
transform: rotate(90deg);
}
}
.library-section__name {
font-weight: 600;
font-size: 1.05rem;
}
.library-section__count {
color: var(--muted);
font-size: 0.9rem;
}
.library-section__toolbar {
padding-bottom: 0.5rem;
border-bottom: 1px solid var(--border);
}
.library-section__empty {
padding: 0.75rem 0 1rem;
}
.dialog {
width: min(520px, calc(100% - 2rem));
padding: 1.75rem;
border-radius: 18px;
border: 1px solid var(--border-strong);
background: var(--bg-card);
color: var(--text);
box-shadow: 0 20px 38px var(--shadow);
&::backdrop {
background: color-mix(in srgb, var(--bg) 70%, transparent);
backdrop-filter: blur(4px);
}
& h2 {
margin-bottom: 1.25rem;
}
}
.track-editor {
display: flex;
gap: 1rem;
align-items: flex-start;
}
.track-editor__cover-fields {
flex: 1;
min-width: 0;
}
/* ------------------------------------------------------------------------------------------------
* Page d'accueil : cartes vers les pages du site
*/
@ -674,12 +805,26 @@ a.btn {
gap: 0.25rem;
}
/* Pochette et titre côte à côte, boutons en dessous sur toute la largeur. */
.media-item {
flex-direction: column;
align-items: stretch;
flex-wrap: wrap;
}
.media-item__actions .btn {
.media-item__info {
flex: 1 1 0;
min-width: 0;
}
.media-item__actions {
flex-basis: 100%;
}
.track-editor {
flex-direction: column;
}
.media-item__actions .btn,
.library-section__toolbar .btn {
width: auto;
flex: 1;
}