Rework the jukebox page: live updates, Discord login, progress, batch uploads
- Follow the queue live through /api/events (read with fetch so the key can be sent), reconnect with backoff and reload the state meanwhile; an indicator shows whether the page is live. - Log in with Discord when enabled, the password stays available as a fallback; explain failed logins and expired sessions. - Show a progress bar and durations, the queue length and total time, and a hint when the queue waits for listeners. - Shuffle and loop buttons; search, rename and add the whole library, optionally shuffled. - Upload several files at once with per-file progress (XMLHttpRequest), add a direct link, drag and drop files; allow 40 uploads per 15 minutes. - Style password, URL and search fields, focus rings, and the phone layout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
399e851178
commit
03c410973e
5 changed files with 1019 additions and 401 deletions
|
|
@ -93,6 +93,19 @@ export function formatBytes(bytes = 0) {
|
|||
return `${(bytes / Math.pow(1024, index)).toFixed(1)} ${units[index]}`;
|
||||
}
|
||||
|
||||
// Durée lisible : 3:07, 1:05:09. null si inconnue.
|
||||
export function formatDuration(seconds) {
|
||||
const value = Number(seconds);
|
||||
if (!Number.isFinite(value) || value < 0 || seconds === null) return null;
|
||||
const total = Math.round(value);
|
||||
const hours = Math.floor(total / 3600);
|
||||
const minutes = Math.floor((total % 3600) / 60);
|
||||
const secs = String(total % 60).padStart(2, "0");
|
||||
return hours > 0
|
||||
? `${hours}:${String(minutes).padStart(2, "0")}:${secs}`
|
||||
: `${minutes}:${secs}`;
|
||||
}
|
||||
|
||||
export function formatDate(value) {
|
||||
if (!value) return "?";
|
||||
try {
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue