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:
Shinuwa 2026-11-29 12:21:43 +01:00
parent 399e851178
commit 03c410973e
5 changed files with 1019 additions and 401 deletions

View file

@ -19,6 +19,25 @@
box-sizing: border-box;
}
[hidden] {
display: none !important;
}
.visually-hidden {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip: rect(0 0 0 0);
white-space: nowrap;
}
code {
background: rgba(255, 255, 255, 0.08);
border-radius: 6px;
padding: 0.1rem 0.35rem;
}
body {
margin: 0;
min-height: 100vh;
@ -182,6 +201,9 @@ label {
}
input[type="text"],
input[type="password"],
input[type="url"],
input[type="search"],
input[type="file"],
select,
textarea {
@ -260,6 +282,149 @@ select:focus {
font-size: 0.9rem;
}
a.btn {
display: inline-block;
text-decoration: none;
text-align: center;
}
.btn--discord {
background: #5865f2;
color: #fff;
}
.btn--discord:hover {
box-shadow: 0 10px 25px rgba(88, 101, 242, 0.4);
}
.btn[aria-pressed="true"] {
background: linear-gradient(120deg, var(--accent), var(--accent-strong));
color: #08010f;
}
.btn:focus-visible {
outline: 2px solid #fff;
outline-offset: 2px;
}
.toolbar {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
}
.key-login summary {
cursor: pointer;
color: var(--muted);
margin: 1rem 0 0.75rem;
}
.live-indicator {
display: inline-flex;
align-items: center;
gap: 0.45rem;
font-size: 0.85rem;
color: var(--muted-dark);
white-space: nowrap;
}
.live-indicator::before {
content: "";
width: 0.55rem;
height: 0.55rem;
border-radius: 50%;
background: var(--muted-dark);
}
.live-indicator[data-live="true"] {
color: var(--success);
}
.live-indicator[data-live="true"]::before {
background: var(--success);
box-shadow: 0 0 0 4px rgba(89, 255, 167, 0.15);
}
.progress {
margin-top: 0.9rem;
}
.progress__track {
height: 6px;
border-radius: 999px;
background: rgba(255, 255, 255, 0.1);
overflow: hidden;
}
.progress__bar {
height: 100%;
width: 0;
background: linear-gradient(120deg, var(--accent), var(--accent-strong));
transition: width 0.9s linear;
}
.progress__times {
display: flex;
justify-content: space-between;
color: var(--muted);
font-size: 0.85rem;
margin-top: 0.35rem;
font-variant-numeric: tabular-nums;
}
.upload-list {
margin-top: 1rem;
}
.upload-list__item {
display: grid;
grid-template-columns: minmax(0, 1fr) 140px minmax(0, 1fr);
align-items: center;
gap: 0.75rem;
padding: 0.4rem 0;
font-size: 0.9rem;
}
.upload-list__name {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.upload-list__item progress {
width: 100%;
accent-color: var(--accent);
}
.upload-list__state {
color: var(--muted);
}
.upload-list__item[data-state="ok"] .upload-list__state {
color: var(--success);
}
.upload-list__item[data-state="error"] .upload-list__state {
color: var(--danger);
}
.url-form {
border-top: 1px solid var(--border);
padding-top: 1.25rem;
margin-top: 1.5rem;
}
.url-form__row {
display: flex;
gap: 0.75rem;
}
.hint {
color: var(--muted-dark);
font-size: 0.85rem;
margin: 0.5rem 0 0;
}
.control-group {
display: flex;
flex-wrap: wrap;
@ -418,4 +583,23 @@ select:focus {
.control-group {
flex-direction: column;
}
.url-form__row {
flex-direction: column;
}
.upload-list__item {
grid-template-columns: 1fr;
gap: 0.25rem;
}
.media-item {
flex-direction: column;
align-items: stretch;
}
.media-item__actions .btn {
width: auto;
flex: 1;
}
}