text representation and disambiguation to releases

This commit is contained in:
Gabe Farrell 2026-04-10 10:18:19 -04:00
parent a937f4a38e
commit b910e32d6c
3 changed files with 552 additions and 391 deletions

View file

@ -26,10 +26,14 @@ type mbMedia struct {
}
type mbRelease struct {
ID string `json:"id"`
Title string `json:"title"`
Date string `json:"date"`
Country string `json:"country"`
ID string `json:"id"`
Title string `json:"title"`
Date string `json:"date"`
Country string `json:"country"`
Disambiguation string `json:"disambiguation"`
TextRepresentation struct {
Language string `json:"language"`
} `json:"text-representation"`
Media []mbMedia `json:"media"`
ArtistCredit []mbArtistCredit `json:"artist-credit"`
ReleaseGroup struct {

View file

@ -1,9 +1,9 @@
'use strict';
"use strict";
// IDs of fetch cards we've already created, so we don't duplicate them.
const knownFetchIds = new Set();
document.addEventListener('DOMContentLoaded', () => {
document.addEventListener("DOMContentLoaded", () => {
initTabs();
initSearch();
initFetchList();
@ -12,105 +12,124 @@ document.addEventListener('DOMContentLoaded', () => {
// ── Tabs ───────────────────────────────────────────────────────────────────────
function initTabs() {
document.querySelector('.tabs').addEventListener('click', e => {
const btn = e.target.closest('.tab-btn');
document.querySelector(".tabs").addEventListener("click", (e) => {
const btn = e.target.closest(".tab-btn");
if (!btn) return;
showTab(btn.dataset.tab);
});
}
function showTab(name) {
document.querySelectorAll('.tab-pane').forEach(p => p.classList.remove('active'));
document.querySelectorAll('.tab-btn').forEach(b => b.classList.remove('active'));
document.getElementById('tab-' + name).classList.add('active');
document.querySelector(`.tab-btn[data-tab="${name}"]`).classList.add('active');
document
.querySelectorAll(".tab-pane")
.forEach((p) => p.classList.remove("active"));
document
.querySelectorAll(".tab-btn")
.forEach((b) => b.classList.remove("active"));
document.getElementById("tab-" + name).classList.add("active");
document
.querySelector(`.tab-btn[data-tab="${name}"]`)
.classList.add("active");
}
// ── Search ─────────────────────────────────────────────────────────────────────
let searchType = 'release';
let searchType = "release";
function initSearch() {
document.querySelector('.type-toggle').addEventListener('click', e => {
const btn = e.target.closest('.type-btn');
document.querySelector(".type-toggle").addEventListener("click", (e) => {
const btn = e.target.closest(".type-btn");
if (btn) setSearchType(btn.dataset.type);
});
const searchBtn = document.getElementById('search-btn');
const searchInput = document.getElementById('search-q');
searchBtn.addEventListener('click', doSearch);
searchInput.addEventListener('keydown', e => { if (e.key === 'Enter') doSearch(); });
const searchBtn = document.getElementById("search-btn");
const searchInput = document.getElementById("search-q");
searchBtn.addEventListener("click", doSearch);
searchInput.addEventListener("keydown", (e) => {
if (e.key === "Enter") doSearch();
});
// Event delegation for dynamically rendered result buttons
document.getElementById('search-results').addEventListener('click', e => {
const btn = e.target.closest('.fetch-btn');
document.getElementById("search-results").addEventListener("click", (e) => {
const btn = e.target.closest(".fetch-btn");
if (!btn || btn.disabled) return;
if (btn.dataset.fetchType === 'artist') startArtistFetch(btn);
if (btn.dataset.fetchType === "artist") startArtistFetch(btn);
else startReleaseFetch(btn);
});
}
function setSearchType(type) {
searchType = type;
document.querySelectorAll('.type-btn').forEach(b => {
b.classList.toggle('active', b.dataset.type === type);
document.querySelectorAll(".type-btn").forEach((b) => {
b.classList.toggle("active", b.dataset.type === type);
});
}
function doSearch() {
const q = document.getElementById('search-q').value.trim();
const q = document.getElementById("search-q").value.trim();
if (!q) return;
const btn = document.getElementById('search-btn');
const resultsEl = document.getElementById('search-results');
const btn = document.getElementById("search-btn");
const resultsEl = document.getElementById("search-results");
btn.disabled = true;
btn.textContent = 'Searching\u2026';
btn.textContent = "Searching\u2026";
resultsEl.innerHTML = '<p class="search-msg">Searching MusicBrainz\u2026</p>';
fetch(`/discover/search?q=${encodeURIComponent(q)}&type=${searchType}`)
.then(r => {
if (!r.ok) return r.text().then(t => { throw new Error(t || r.statusText); });
.then((r) => {
if (!r.ok)
return r.text().then((t) => {
throw new Error(t || r.statusText);
});
return r.json();
})
.then(data => renderResults(data))
.catch(err => {
.then((data) => renderResults(data))
.catch((err) => {
resultsEl.innerHTML = `<p class="search-msg error">Error: ${esc(err.message)}</p>`;
})
.finally(() => {
btn.disabled = false;
btn.textContent = 'Search';
btn.textContent = "Search";
});
}
// ── Results rendering ──────────────────────────────────────────────────────────
function renderResults(data) {
const el = document.getElementById('search-results');
const el = document.getElementById("search-results");
if (!data || data.length === 0) {
el.innerHTML = '<p class="search-msg">No results found.</p>';
return;
}
const renderer = searchType === 'artist' ? renderArtist : renderRelease;
el.innerHTML = data.map(renderer).join('');
const renderer = searchType === "artist" ? renderArtist : renderRelease;
el.innerHTML = data.map(renderer).join("");
}
function renderRelease(r) {
const credits = r['artist-credit'] ?? [];
const artist = credits.map(c => c.name || c.artist?.name || '').join('') || 'Unknown Artist';
const year = r.date?.substring(0, 4) ?? '';
const type = r['release-group']?.['primary-type'] ?? '';
const country = r.country ?? '';
const formats = [...new Set((r.media ?? []).map(m => m.format).filter(Boolean))].join('+');
const meta = [year, type, formats, country].filter(Boolean).join(' \u00b7 ');
const credits = r["artist-credit"] ?? [];
const artist =
credits.map((c) => c.name || c.artist?.name || "").join("") ||
"Unknown Artist";
const year = r.date?.substring(0, 4) ?? "";
const type = r["release-group"]?.["primary-type"] ?? "";
const country = r.country ?? "";
const formats = [
...new Set((r.media ?? []).map((m) => m.format).filter(Boolean)),
].join("+");
const lang = r["text-representation"]?.language ?? "";
const meta = [year, type, formats, country, lang]
.filter(Boolean)
.join(" \u00b7 ");
const dis = r.disambiguation ? ` (${esc(r.disambiguation)})` : "";
const coverUrl = `https://coverartarchive.org/release/${r.id}/front-250`;
return `
<div class="result-row">
<img class="result-cover" src="${coverUrl}" onerror="this.style.display='none'" loading="lazy" alt="">
<div class="result-info">
<span class="result-title">${esc(artist)} \u2014 ${esc(r.title)}</span>
${meta ? `<span class="result-meta">${esc(meta)}</span>` : ''}
<span class="result-title">${esc(artist)} \u2014 ${esc(r.title)}<span class="result-dis">${dis}</span></span>
${meta ? `<span class="result-meta">${esc(meta)}</span>` : ""}
</div>
<button class="fetch-btn"
data-fetch-type="release"
@ -121,12 +140,12 @@ function renderRelease(r) {
}
function renderArtist(a) {
const dis = a.disambiguation ? ` (${esc(a.disambiguation)})` : '';
const dis = a.disambiguation ? ` (${esc(a.disambiguation)})` : "";
return `
<div class="result-row">
<div class="result-info">
<span class="result-title">${esc(a.name)}${dis}</span>
${a.country ? `<span class="result-meta">${esc(a.country)}</span>` : ''}
${a.country ? `<span class="result-meta">${esc(a.country)}</span>` : ""}
</div>
<button class="fetch-btn"
data-fetch-type="artist"
@ -140,24 +159,27 @@ function renderArtist(a) {
function startReleaseFetch(btn) {
const { id, artist, album } = btn.dataset;
btn.disabled = true;
btn.textContent = 'Fetching\u2026';
btn.textContent = "Fetching\u2026";
fetch('/discover/fetch', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
fetch("/discover/fetch", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ id, artist, album }),
})
.then(r => {
if (!r.ok) return r.text().then(t => { throw new Error(t || r.statusText); });
.then((r) => {
if (!r.ok)
return r.text().then((t) => {
throw new Error(t || r.statusText);
});
return r.json();
})
.then(() => {
addFetchCard(id, `${artist} \u2014 ${album}`);
pollFetch(id);
})
.catch(err => {
.catch((err) => {
btn.disabled = false;
btn.textContent = 'Fetch';
btn.textContent = "Fetch";
showFetchError(err.message);
});
}
@ -165,24 +187,27 @@ function startReleaseFetch(btn) {
function startArtistFetch(btn) {
const { id, name } = btn.dataset;
btn.disabled = true;
btn.textContent = 'Fetching\u2026';
btn.textContent = "Fetching\u2026";
fetch('/discover/fetch/artist', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
fetch("/discover/fetch/artist", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ id, name }),
})
.then(r => {
if (!r.ok) return r.text().then(t => { throw new Error(t || r.statusText); });
.then((r) => {
if (!r.ok)
return r.text().then((t) => {
throw new Error(t || r.statusText);
});
return r.json();
})
.then(() => {
addFetchCard(id, `${name} \u2014 full discography`);
pollFetch(id);
})
.catch(err => {
.catch((err) => {
btn.disabled = false;
btn.textContent = 'Fetch All';
btn.textContent = "Fetch All";
showFetchError(err.message);
});
}
@ -191,9 +216,9 @@ function startArtistFetch(btn) {
function addFetchCard(id, title) {
knownFetchIds.add(id);
const list = document.getElementById('fetch-list');
const card = document.createElement('div');
card.className = 'fetch-card';
const list = document.getElementById("fetch-list");
const card = document.createElement("div");
card.className = "fetch-card";
card.id = `fetch-${id}`;
card.innerHTML = `
<div class="fetch-header">
@ -206,28 +231,28 @@ function addFetchCard(id, title) {
function pollFetch(id) {
fetch(`/discover/fetch/status?id=${encodeURIComponent(id)}`)
.then(r => r.json())
.then(data => {
const logEl = document.getElementById(`flog-${id}`);
.then((r) => r.json())
.then((data) => {
const logEl = document.getElementById(`flog-${id}`);
const statusEl = document.getElementById(`fstatus-${id}`);
const card = document.getElementById(`fetch-${id}`);
const card = document.getElementById(`fetch-${id}`);
if (logEl && data.log) {
logEl.innerHTML = data.log
.map(l => `<div class="log-line">${esc(l)}</div>`)
.join('');
.map((l) => `<div class="log-line">${esc(l)}</div>`)
.join("");
logEl.scrollTop = logEl.scrollHeight;
}
if (data.done) {
if (data.success) {
statusEl?.setAttribute('class', 'fetch-status fetch-status-ok');
if (statusEl) statusEl.textContent = '\u2713 done';
card?.classList.add('fetch-card-ok');
statusEl?.setAttribute("class", "fetch-status fetch-status-ok");
if (statusEl) statusEl.textContent = "\u2713 done";
card?.classList.add("fetch-card-ok");
} else {
statusEl?.setAttribute('class', 'fetch-status fetch-status-err');
if (statusEl) statusEl.textContent = '\u2717 failed';
card?.classList.add('fetch-card-err');
statusEl?.setAttribute("class", "fetch-status fetch-status-err");
if (statusEl) statusEl.textContent = "\u2717 failed";
card?.classList.add("fetch-card-err");
if (data.error && logEl) {
logEl.innerHTML += `<div class="log-line log-line-err">${esc(data.error)}</div>`;
logEl.scrollTop = logEl.scrollHeight;
@ -249,9 +274,9 @@ function initFetchList() {
}
function pollFetchList() {
fetch('/discover/fetch/list')
.then(r => r.ok ? r.json() : null)
.then(items => {
fetch("/discover/fetch/list")
.then((r) => (r.ok ? r.json() : null))
.then((items) => {
if (!items) return;
for (const item of items) {
if (!knownFetchIds.has(item.id)) {
@ -268,9 +293,9 @@ function pollFetchList() {
// ── Utilities ──────────────────────────────────────────────────────────────────
function showFetchError(msg) {
const list = document.getElementById('fetch-list');
const el = document.createElement('div');
el.className = 'fetch-card fetch-card-err';
const list = document.getElementById("fetch-list");
const el = document.createElement("div");
el.className = "fetch-card fetch-card-err";
el.innerHTML = `<div class="fetch-header">
<span class="fetch-title">Fetch failed</span>
<span class="fetch-status fetch-status-err">\u2717 error</span>
@ -280,9 +305,9 @@ function showFetchError(msg) {
}
function esc(s) {
return String(s ?? '')
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;');
return String(s ?? "")
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;");
}

View file

@ -1,453 +1,585 @@
/* ── Custom properties ────────────────────────────────────────────────────── */
:root {
--bg: #111;
--surface: #1a1a1a;
--surface-hi: #222;
--border: #2a2a2a;
--border-focus: #555;
--bg: #111;
--surface: #1a1a1a;
--surface-hi: #222;
--border: #2a2a2a;
--border-focus: #555;
--text: #eee;
--text-secondary: #aaa;
--text-muted: #777;
--text-dim: #555;
--text: #eee;
--text-secondary: #aaa;
--text-muted: #777;
--text-dim: #555;
--green: #4caf50;
--green-bg: #1e4d2b;
--green-hover: #1e3d1e;
--green-border: #3a7a3a;
--amber: #f0a500;
--amber-bg: #4d3a00;
--red: #e05050;
--red-bg: #4d1a1a;
--red-text: #c0392b;
--green: #4caf50;
--green-bg: #1e4d2b;
--green-hover: #1e3d1e;
--green-border: #3a7a3a;
--amber: #f0a500;
--amber-bg: #4d3a00;
--red: #e05050;
--red-bg: #4d1a1a;
--red-text: #c0392b;
--pill-beets: #7ec8e3;
--pill-mb: #c084fc;
--pill-tags: #f0a500;
--pill-beets: #7ec8e3;
--pill-mb: #c084fc;
--pill-tags: #f0a500;
--radius-lg: 8px;
--radius: 6px;
--radius-sm: 5px;
--radius-xs: 4px;
--radius-lg: 8px;
--radius: 6px;
--radius-sm: 5px;
--radius-xs: 4px;
--max-w: 860px;
--pad-x: 24px;
--max-w: 860px;
--pad-x: 24px;
}
/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
*,
*::before,
*::after {
box-sizing: border-box;
}
body {
font-family: system-ui, -apple-system, sans-serif;
background: var(--bg);
color: var(--text);
margin: 0;
padding: 48px var(--pad-x) 80px;
text-align: center;
font-family:
system-ui,
-apple-system,
sans-serif;
background: var(--bg);
color: var(--text);
margin: 0;
padding: 48px var(--pad-x) 80px;
text-align: center;
}
h1 {
margin: 0 0 24px;
font-size: clamp(20px, 4vw, 28px);
margin: 0 0 24px;
font-size: clamp(20px, 4vw, 28px);
}
/* ── Tabs ─────────────────────────────────────────────────────────────────── */
.tabs {
display: inline-flex;
gap: 4px;
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
padding: 4px;
margin-bottom: 36px;
display: inline-flex;
gap: 4px;
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
padding: 4px;
margin-bottom: 36px;
}
.tab-btn {
font-size: 14px;
min-height: 36px;
padding: 0 24px;
border-radius: var(--radius);
border: none;
cursor: pointer;
background: transparent;
color: var(--text-muted);
transition: background 0.15s, color 0.15s;
font-size: 14px;
min-height: 36px;
padding: 0 24px;
border-radius: var(--radius);
border: none;
cursor: pointer;
background: transparent;
color: var(--text-muted);
transition:
background 0.15s,
color 0.15s;
}
.tab-btn.active {
background: var(--surface-hi);
color: var(--text);
background: var(--surface-hi);
color: var(--text);
}
.tab-pane { display: none; }
.tab-pane.active { display: block; }
.tab-pane {
display: none;
}
.tab-pane.active {
display: block;
}
/* ── Shared card / content container ─────────────────────────────────────── */
.content-box {
max-width: var(--max-w);
margin: 0 auto;
text-align: left;
max-width: var(--max-w);
margin: 0 auto;
text-align: left;
}
/* ── Import tab — run button ─────────────────────────────────────────────── */
.run-btn {
font-size: clamp(18px, 4vw, 28px);
padding: 18px 40px;
border-radius: 10px;
border: none;
cursor: pointer;
background: var(--green);
color: #fff;
transition: opacity 0.15s;
font-size: clamp(18px, 4vw, 28px);
padding: 18px 40px;
border-radius: 10px;
border: none;
cursor: pointer;
background: var(--green);
color: #fff;
transition: opacity 0.15s;
}
.run-btn:hover:not(:disabled) {
opacity: 0.88;
}
.run-btn:hover:not(:disabled) { opacity: 0.88; }
.run-btn:disabled {
background: #555;
cursor: not-allowed;
background: #555;
cursor: not-allowed;
}
/* ── Import tab — session summary ────────────────────────────────────────── */
.session { margin-top: 48px; }
.session {
margin-top: 48px;
}
.session-header {
display: flex;
justify-content: space-between;
align-items: baseline;
flex-wrap: wrap;
gap: 4px;
border-bottom: 1px solid #333;
padding-bottom: 8px;
margin-bottom: 20px;
display: flex;
justify-content: space-between;
align-items: baseline;
flex-wrap: wrap;
gap: 4px;
border-bottom: 1px solid #333;
padding-bottom: 8px;
margin-bottom: 20px;
}
.session-header h2 {
margin: 0;
font-size: 16px;
color: var(--text-secondary);
}
.session-header .duration {
font-size: 13px;
color: var(--text-dim);
}
.session-header h2 { margin: 0; font-size: 16px; color: var(--text-secondary); }
.session-header .duration { font-size: 13px; color: var(--text-dim); }
/* ── Album card ───────────────────────────────────────────────────────────── */
.album {
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
padding: 16px 20px;
margin-bottom: 12px;
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
padding: 16px 20px;
margin-bottom: 12px;
}
.album-header {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 10px;
flex-wrap: wrap;
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 10px;
flex-wrap: wrap;
}
.album-name {
font-weight: 600;
font-size: 15px;
flex: 1;
min-width: 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-weight: 600;
font-size: 15px;
flex: 1;
min-width: 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.badge {
font-size: 11px;
font-weight: 700;
padding: 2px 8px;
border-radius: var(--radius-xs);
white-space: nowrap;
flex-shrink: 0;
font-size: 11px;
font-weight: 700;
padding: 2px 8px;
border-radius: var(--radius-xs);
white-space: nowrap;
flex-shrink: 0;
}
.badge-ok {
background: var(--green-bg);
color: var(--green);
}
.badge-warn {
background: var(--amber-bg);
color: var(--amber);
}
.badge-fatal {
background: var(--red-bg);
color: var(--red);
}
.badge-ok { background: var(--green-bg); color: var(--green); }
.badge-warn { background: var(--amber-bg); color: var(--amber); }
.badge-fatal { background: var(--red-bg); color: var(--red); }
/* ── Metadata row ─────────────────────────────────────────────────────────── */
.metadata {
display: flex;
align-items: baseline;
flex-wrap: wrap;
gap: 10px;
font-size: 12px;
color: var(--text-muted);
margin-bottom: 12px;
display: flex;
align-items: baseline;
flex-wrap: wrap;
gap: 10px;
font-size: 12px;
color: var(--text-muted);
margin-bottom: 12px;
}
.metadata-title {
color: var(--text-secondary);
font-size: 13px;
}
.metadata-title { color: var(--text-secondary); font-size: 13px; }
.metadata-pill {
display: inline-flex;
align-items: center;
gap: 4px;
background: var(--surface-hi);
border-radius: var(--radius-xs);
padding: 2px 7px;
font-size: 11px;
display: inline-flex;
align-items: center;
gap: 4px;
background: var(--surface-hi);
border-radius: var(--radius-xs);
padding: 2px 7px;
font-size: 11px;
}
.pill-label {
color: var(--text-dim);
}
.pill-beets {
color: var(--pill-beets);
}
.pill-musicbrainz {
color: var(--pill-mb);
}
.pill-file_tags {
color: var(--pill-tags);
}
.pill-unknown {
color: #888;
}
.pill-label { color: var(--text-dim); }
.pill-beets { color: var(--pill-beets); }
.pill-musicbrainz { color: var(--pill-mb); }
.pill-file_tags { color: var(--pill-tags); }
.pill-unknown { color: #888; }
/* ── Info grid ────────────────────────────────────────────────────────────── */
.info-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
gap: 6px;
margin-bottom: 12px;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
gap: 6px;
margin-bottom: 12px;
}
.info-card {
background: var(--surface-hi);
border-radius: var(--radius);
padding: 8px 12px;
font-size: 12px;
background: var(--surface-hi);
border-radius: var(--radius);
padding: 8px 12px;
font-size: 12px;
}
.info-card-label {
font-size: 10px;
text-transform: uppercase;
letter-spacing: 0.06em;
color: var(--text-dim);
margin-bottom: 4px;
font-size: 10px;
text-transform: uppercase;
letter-spacing: 0.06em;
color: var(--text-dim);
margin-bottom: 4px;
}
.info-card-value {
color: var(--text-secondary);
font-size: 13px;
font-weight: 600;
}
.info-card-sub {
margin-top: 3px;
color: var(--text-dim);
font-size: 11px;
line-height: 1.4;
}
.info-card-value { color: var(--text-secondary); font-size: 13px; font-weight: 600; }
.info-card-sub { margin-top: 3px; color: var(--text-dim); font-size: 11px; line-height: 1.4; }
.info-ok { color: var(--green); }
.info-warn { color: var(--amber); }
.info-dim { color: var(--text-dim); }
.info-ok {
color: var(--green);
}
.info-warn {
color: var(--amber);
}
.info-dim {
color: var(--text-dim);
}
/* ── Pipeline steps ───────────────────────────────────────────────────────── */
.steps-label {
font-size: 10px;
text-transform: uppercase;
letter-spacing: 0.06em;
color: #444;
margin-bottom: 6px;
font-size: 10px;
text-transform: uppercase;
letter-spacing: 0.06em;
color: #444;
margin-bottom: 6px;
}
.steps {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
gap: 6px;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
gap: 6px;
}
.step {
font-size: 12px;
padding: 5px 10px;
border-radius: var(--radius-sm);
background: var(--surface-hi);
display: flex;
flex-direction: column;
gap: 2px;
font-size: 12px;
padding: 5px 10px;
border-radius: var(--radius-sm);
background: var(--surface-hi);
display: flex;
flex-direction: column;
gap: 2px;
}
.step-label {
color: #888;
}
.step-ok {
color: var(--green);
}
.step-warn {
color: var(--amber);
}
.step-fatal {
color: var(--red);
}
.step-err {
font-size: 11px;
color: var(--red-text);
margin-top: 2px;
word-break: break-word;
}
.step-label { color: #888; }
.step-ok { color: var(--green); }
.step-warn { color: var(--amber); }
.step-fatal { color: var(--red); }
.step-err { font-size: 11px; color: var(--red-text); margin-top: 2px; word-break: break-word; }
/* ── Discover tab — search form ───────────────────────────────────────────── */
.search-form {
display: flex;
gap: 8px;
align-items: stretch;
margin-bottom: 20px;
display: flex;
gap: 8px;
align-items: stretch;
margin-bottom: 20px;
}
.type-toggle {
display: flex;
border: 1px solid #333;
border-radius: var(--radius);
overflow: hidden;
flex-shrink: 0;
display: flex;
border: 1px solid #333;
border-radius: var(--radius);
overflow: hidden;
flex-shrink: 0;
}
.type-btn {
font-size: 13px;
padding: 0 16px;
border: none;
background: var(--surface);
color: var(--text-muted);
cursor: pointer;
transition: background 0.15s, color 0.15s;
white-space: nowrap;
font-size: 13px;
padding: 0 16px;
border: none;
background: var(--surface);
color: var(--text-muted);
cursor: pointer;
transition:
background 0.15s,
color 0.15s;
white-space: nowrap;
}
.type-btn.active {
background: var(--surface-hi);
color: var(--text);
background: var(--surface-hi);
color: var(--text);
}
.search-input {
flex: 1;
min-width: 0;
font-size: 14px;
padding: 0 12px;
height: 38px;
background: var(--surface);
border: 1px solid #333;
border-radius: var(--radius);
color: var(--text);
outline: none;
transition: border-color 0.15s;
flex: 1;
min-width: 0;
font-size: 14px;
padding: 0 12px;
height: 38px;
background: var(--surface);
border: 1px solid #333;
border-radius: var(--radius);
color: var(--text);
outline: none;
transition: border-color 0.15s;
}
.search-input:focus {
border-color: var(--border-focus);
}
.search-input:focus { border-color: var(--border-focus); }
.search-btn {
font-size: 14px;
padding: 0 20px;
height: 38px;
border-radius: var(--radius);
border: none;
background: var(--green);
color: #fff;
cursor: pointer;
flex-shrink: 0;
transition: opacity 0.15s;
font-size: 14px;
padding: 0 20px;
height: 38px;
border-radius: var(--radius);
border: none;
background: var(--green);
color: #fff;
cursor: pointer;
flex-shrink: 0;
transition: opacity 0.15s;
}
.search-btn:hover:not(:disabled) {
opacity: 0.88;
}
.search-btn:disabled {
background: #555;
cursor: not-allowed;
}
.search-btn:hover:not(:disabled) { opacity: 0.88; }
.search-btn:disabled { background: #555; cursor: not-allowed; }
/* ── Discover tab — search results ───────────────────────────────────────── */
.search-msg {
text-align: center;
color: var(--text-dim);
font-size: 14px;
padding: 32px 0;
text-align: center;
color: var(--text-dim);
font-size: 14px;
padding: 32px 0;
}
.search-msg.error {
color: var(--red);
}
.search-msg.error { color: var(--red); }
.result-row {
display: flex;
align-items: center;
gap: 12px;
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
padding: 12px 16px;
margin-bottom: 8px;
display: flex;
align-items: center;
gap: 12px;
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
padding: 12px 16px;
margin-bottom: 8px;
}
.result-cover {
width: 48px;
height: 48px;
object-fit: cover;
border-radius: var(--radius-sm);
flex-shrink: 0;
background: var(--surface-hi);
width: 48px;
height: 48px;
object-fit: cover;
border-radius: var(--radius-sm);
flex-shrink: 0;
background: var(--surface-hi);
}
.result-info {
flex: 1;
min-width: 0;
}
.result-info { flex: 1; min-width: 0; }
.result-title {
display: block;
font-size: 14px;
color: #ddd;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: block;
font-size: 14px;
color: #ddd;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.result-dis {
color: var(--text-dim);
}
.result-meta {
display: block;
font-size: 12px;
color: var(--text-dim);
margin-top: 2px;
display: block;
font-size: 12px;
color: var(--text-dim);
margin-top: 2px;
}
.fetch-btn {
font-size: 12px;
padding: 5px 14px;
border-radius: var(--radius-sm);
border: 1px solid var(--green-border);
background: transparent;
color: var(--green);
cursor: pointer;
flex-shrink: 0;
white-space: nowrap;
transition: background 0.15s;
font-size: 12px;
padding: 5px 14px;
border-radius: var(--radius-sm);
border: 1px solid var(--green-border);
background: transparent;
color: var(--green);
cursor: pointer;
flex-shrink: 0;
white-space: nowrap;
transition: background 0.15s;
}
.fetch-btn:hover:not(:disabled) {
background: var(--green-hover);
}
.fetch-btn:disabled {
border-color: #333;
color: var(--text-dim);
cursor: not-allowed;
}
.fetch-btn:hover:not(:disabled) { background: var(--green-hover); }
.fetch-btn:disabled { border-color: #333; color: var(--text-dim); cursor: not-allowed; }
/* ── Discover tab — fetch log cards ───────────────────────────────────────── */
.fetch-list { margin-top: 32px; }
.fetch-list {
margin-top: 32px;
}
.fetch-card {
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
padding: 14px 16px;
margin-bottom: 10px;
transition: border-color 0.3s;
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
padding: 14px 16px;
margin-bottom: 10px;
transition: border-color 0.3s;
}
.fetch-card-ok {
border-color: var(--green-bg);
}
.fetch-card-err {
border-color: var(--red-bg);
}
.fetch-card-ok { border-color: var(--green-bg); }
.fetch-card-err { border-color: var(--red-bg); }
.fetch-header {
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 6px;
margin-bottom: 8px;
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 6px;
margin-bottom: 8px;
}
.fetch-title {
font-size: 14px;
font-weight: 600;
color: var(--text-secondary);
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 14px;
font-weight: 600;
color: var(--text-secondary);
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.fetch-status {
font-size: 12px;
color: var(--text-dim);
flex-shrink: 0;
font-size: 12px;
color: var(--text-dim);
flex-shrink: 0;
}
.fetch-status-ok {
color: var(--green);
}
.fetch-status-err {
color: var(--red);
}
.fetch-status-ok { color: var(--green); }
.fetch-status-err { color: var(--red); }
.fetch-log {
font-size: 12px;
font-family: ui-monospace, "Cascadia Code", "Fira Mono", monospace;
color: var(--text-muted);
max-height: 260px;
overflow-y: auto;
scrollbar-width: thin;
scrollbar-color: #333 transparent;
font-size: 12px;
font-family: ui-monospace, "Cascadia Code", "Fira Mono", monospace;
color: var(--text-muted);
max-height: 260px;
overflow-y: auto;
scrollbar-width: thin;
scrollbar-color: #333 transparent;
}
.log-line {
padding: 1px 0;
line-height: 1.5;
}
.log-line-err {
color: var(--red-text);
}
.log-line { padding: 1px 0; line-height: 1.5; }
.log-line-err { color: var(--red-text); }
/* ── Footer ───────────────────────────────────────────────────────────────── */
footer {
position: fixed;
bottom: 14px;
left: 0;
width: 100%;
font-size: 12px;
color: #444;
text-align: center;
pointer-events: none;
position: fixed;
bottom: 14px;
left: 0;
width: 100%;
font-size: 12px;
color: #444;
text-align: center;
pointer-events: none;
}
/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
body { padding: 32px 16px 72px; }
body {
padding: 32px 16px 72px;
}
.tabs { display: flex; width: 100%; }
.tab-btn { flex: 1; padding: 0; min-height: 40px; }
.tabs {
display: flex;
width: 100%;
}
.tab-btn {
flex: 1;
padding: 0;
min-height: 40px;
}
.search-form { flex-wrap: wrap; }
.type-toggle { width: 100%; }
.type-btn { flex: 1; min-height: 38px; }
.search-btn { width: 100%; }
.search-form {
flex-wrap: wrap;
}
.type-toggle {
width: 100%;
}
.type-btn {
flex: 1;
min-height: 38px;
}
.search-btn {
width: 100%;
}
.result-title { white-space: normal; }
.result-title {
white-space: normal;
}
}