Add shared synced lyrics, chapters and personal bookmarks with revision history, API tokens and an admin page

This commit is contained in:
Jonathan Sykes
2026-09-18 18:10:10 +08:00
parent a20dd0a3a6
commit 524db986d2
14 changed files with 2493 additions and 11 deletions

View File

@@ -1238,7 +1238,13 @@ input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.25); }
box-shadow: var(--shadow);
font-size: 13.5px;
font-weight: 500;
white-space: nowrap;
/* Short toasts stay on one line; longer ones wrap inside the viewport
instead of running off both edges on a phone. */
width: max-content;
max-width: min(560px, calc(100vw - 32px));
box-sizing: border-box;
white-space: normal;
text-align: center;
animation: toastIn 0.3s var(--ease);
pointer-events: auto;
}
@@ -3400,3 +3406,202 @@ html[data-layout="bento-hub"] .mini-bar-inner {
html[data-layout="living-hymnal"] .app { grid-template-columns: 220px 1fr; }
}
/* ============================================================================
* Lyrics · chapters · bookmarks panel (Notes in app.js)
* ========================================================================== */
.notes-panel {
margin-top: 16px;
background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
border: 1px solid var(--line);
border-radius: var(--radius);
overflow: hidden;
}
.notes-tabs {
display: flex; align-items: center; gap: 4px;
padding: 6px 10px 0;
border-bottom: 1px solid var(--line-soft);
}
.notes-tab {
background: transparent; border: none; cursor: pointer;
color: var(--text-dim);
font-family: var(--mono); font-size: 10px; font-weight: 700;
text-transform: uppercase; letter-spacing: 0.14em;
padding: 9px 8px 10px;
border-bottom: 2px solid transparent;
transition: color 0.16s, border-color 0.16s;
}
.notes-tab:hover { color: var(--text-2); }
.notes-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.notes-count {
display: inline-block; min-width: 16px; padding: 1px 5px; margin-left: 4px;
border-radius: 8px; background: var(--bg-3); color: var(--text-2);
font-size: 9px; letter-spacing: 0; text-align: center;
}
.notes-count:empty { display: none; }
.notes-status {
margin-left: auto; min-width: 0;
font-family: var(--mono); font-size: 10px; color: var(--accent-bright);
white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.notes-pane { padding: 12px 14px 14px; }
.notes-spacer { flex: 1; }
.lyrics-toolbar, .markers-toolbar {
display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
margin-bottom: 10px;
}
.lyrics-toolbar .np-btn, .markers-toolbar .np-btn, .lyrics-syncbar .np-btn { padding: 6px 10px; font-size: 12px; }
.lyr-offset {
display: inline-flex; align-items: center; gap: 2px;
border: 1px solid var(--line); border-radius: var(--radius-sm);
padding: 2px; background: var(--bg-1);
}
.lyr-off-btn {
background: transparent; border: none; color: var(--text-2); cursor: pointer;
font-family: var(--mono); font-size: 11px; padding: 4px 6px; border-radius: 6px;
}
.lyr-off-btn:hover { background: var(--bg-3); color: var(--text); }
.lyr-off-val { font-family: var(--mono); font-size: 11px; color: var(--text-dim); min-width: 38px; text-align: center; }
.lyr-off-val.nonzero { color: var(--accent-bright); }
.lyr-auto { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-2); cursor: pointer; }
.lyrics-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.lyr-tag {
font-family: var(--mono); font-size: 11px; color: var(--text-2);
background: var(--bg-3); border: 1px solid var(--line); border-radius: 999px;
padding: 3px 9px;
}
.lyrics-list {
position: relative;
max-height: min(52vh, 460px);
overflow-y: auto;
overscroll-behavior: contain;
padding: 4px 2px 40vh 2px; /* tail room so the last line can centre */
scrollbar-width: thin;
}
.lyr-section {
margin: 14px 0 6px;
font-family: var(--mono); font-size: 10px; font-weight: 700;
text-transform: uppercase; letter-spacing: 0.16em; color: var(--accent);
}
.lyr-section:first-child { margin-top: 2px; }
.lyr-section-time { color: var(--text-dim); font-weight: 400; }
.lyr-line {
display: flex; gap: 12px; align-items: baseline;
padding: 6px 8px; border-radius: var(--radius-sm);
cursor: pointer; color: var(--text-2);
transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.lyr-line:hover { background: var(--bg-3); }
.lyr-line.untimed { cursor: default; }
.lyr-time { flex: none; width: 38px; font-family: var(--mono); font-size: 10px; color: var(--text-dim); }
.lyr-text { font-size: 15px; line-height: 1.45; }
.lyr-line.active { background: var(--bg-3); color: var(--text); }
.lyr-line.active .lyr-text { font-weight: 700; font-size: 17px; }
.lyr-line.active .lyr-time { color: var(--accent-bright); }
.lyr-cue {
display: flex; justify-content: space-between; gap: 10px;
margin: 8px 0; padding: 8px 10px; border-radius: var(--radius-sm);
border: 1px dashed var(--line); color: var(--text-2);
font-family: var(--mono); font-size: 11px; cursor: pointer;
}
.lyr-cue.soon { border-color: var(--accent); color: var(--text); }
.lyr-cue-in { color: var(--accent-bright); white-space: nowrap; }
.lyrics-syncbar {
display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
margin-bottom: 10px; padding: 8px 10px;
border: 1px solid var(--accent); border-radius: var(--radius-sm);
background: var(--bg-1);
}
.lyrics-sync-hint { flex: 1 1 180px; min-width: 0; font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lyrics-syncbar .primary-btn { border-color: var(--accent); color: var(--text); background: var(--accent-deep); }
.notes-panel.syncing .lyr-line { cursor: pointer; }
.lyrics-list .sync-ptr { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--bg-3); color: var(--text); }
.notes-empty { padding: 18px 6px; text-align: center; color: var(--text-2); font-size: 13px; }
.notes-empty.small { padding: 8px 4px; text-align: left; font-size: 12px; color: var(--text-dim); }
.notes-empty-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 12px 0 8px; }
.notes-empty-hint { font-size: 11px; color: var(--text-dim); }
.marker-chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 6px; scrollbar-width: thin; }
.marker-chip {
flex: none; cursor: pointer;
border: 1px solid var(--line); background: var(--bg-1); color: var(--text-2);
border-radius: 999px; padding: 5px 11px; font-size: 12px; white-space: nowrap;
transition: border-color 0.16s, color 0.16s;
}
.marker-chip:hover { color: var(--text); border-color: var(--text-dim); }
.marker-chip.active { border-color: var(--accent); color: var(--text); background: var(--bg-3); }
.marker-chip-time { font-family: var(--mono); font-size: 10px; color: var(--accent-bright); }
.marker-chip.bookmark .marker-chip-time { color: #7ec8ff; }
.markers-section { margin-top: 12px; }
.markers-heading {
font-family: var(--mono); font-size: 10px; font-weight: 700;
text-transform: uppercase; letter-spacing: 0.14em; color: var(--text-dim);
margin-bottom: 6px;
}
.markers-scope { font-weight: 400; letter-spacing: 0.04em; text-transform: none; margin-left: 6px; }
.marker-row {
display: flex; align-items: center; gap: 8px;
padding: 7px 6px; border-bottom: 1px solid var(--line-soft);
}
.marker-row:last-child { border-bottom: none; }
.mk-time {
flex: none; width: 52px; text-align: left; cursor: pointer;
background: transparent; border: none; padding: 0;
font-family: var(--mono); font-size: 12px; color: var(--accent-bright);
}
.marker-row[data-kind="bookmark"] .mk-time { color: #7ec8ff; }
.mk-body { flex: 1; min-width: 0; }
.mk-title { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-note { font-size: 11px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-btn {
flex: none; background: transparent; border: 1px solid transparent; border-radius: 7px;
color: var(--text-dim); cursor: pointer; padding: 4px 6px; font-size: 12px;
}
.mk-btn:hover { color: var(--text); border-color: var(--line); background: var(--bg-3); }
.seek-markers { position: absolute; left: 0; right: 0; top: 0; height: 0; pointer-events: none; }
.seek-tick {
position: absolute; top: 2px; width: 2px; height: 10px; margin-left: -1px;
border-radius: 1px; background: var(--accent-bright); opacity: 0.85;
}
.seek-tick.bookmark { background: #7ec8ff; }
/* Modals opened by the notes panel */
.lyr-editor-help, .modal-text { margin: 0 0 10px; font-size: 12px; line-height: 1.5; color: var(--text-2); }
.lyr-editor-help code { font-family: var(--mono); font-size: 11px; color: var(--text); }
.lyr-editor-note { margin: 0 0 8px; font-size: 12px; color: var(--accent-bright); }
.lyr-editor-text, .mx-text {
width: 100%; min-height: min(46vh, 360px); resize: vertical; box-sizing: border-box;
background: var(--bg-1); color: var(--text); border: 1px solid var(--line);
border-radius: var(--radius-sm); padding: 10px;
font-family: var(--mono); font-size: 12px; line-height: 1.55;
}
.mx-text { min-height: 180px; }
.lyr-editor-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mx-inc { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); margin-bottom: 8px; }
.marker-form { display: flex; flex-direction: column; gap: 10px; }
.marker-form label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--text-dim); }
.marker-form input {
background: var(--bg-1); color: var(--text); border: 1px solid var(--line);
border-radius: var(--radius-sm); padding: 9px 10px; font-size: 14px;
}
.notes-history { display: flex; flex-direction: column; gap: 2px; max-height: 50vh; overflow-y: auto; }
.hist-row { display: flex; align-items: center; gap: 10px; padding: 7px 2px; border-bottom: 1px solid var(--line-soft); }
.hist-main { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-size: 12px; }
.hist-rev { font-family: var(--mono); color: var(--accent-bright); }
.hist-who { color: var(--text); }
.hist-src, .hist-when { color: var(--text-dim); font-size: 11px; }
.hist-live { font-family: var(--mono); font-size: 10px; color: #7ee0a8; }
@media (max-width: 560px) {
.notes-pane { padding: 10px 10px 12px; }
.lyr-text { font-size: 14px; }
.lyr-line.active .lyr-text { font-size: 16px; }
.lyr-auto { margin-left: auto; }
.notes-status { display: none; }
}