feat(patches): reclip history cards match UI design; thumbnails persisted
History section now renders reclip's own card components (thumbnail, serif title, meta line with date/size, Save/Transcript pill buttons). Frontend passes the video thumbnail to /api/download so history cards show real artwork; pre-thumbnail entries keep the placeholder icon.
This commit is contained in:
1 parent
b8773b8fc2
commit
10f5811d7f
3 files changed
+162
-97
No files matched your search
+28
-40
@@ -343,41 +343,16 @@
|
||||
.dl-all-btn:hover { background: #2d2d2a; }
|
||||
.dl-all-btn:disabled { opacity: 0.4; cursor: not-allowed; }
|
||||
|
||||
/* History */
|
||||
/* History — same card language as the fetch results */
|
||||
.hist-h {
|
||||
font-family: 'Instrument Serif', serif;
|
||||
font-size: 1.4rem;
|
||||
font-size: 1.9rem;
|
||||
font-weight: 400;
|
||||
margin: 32px 0 10px;
|
||||
letter-spacing: -0.02em;
|
||||
margin: 44px 0 14px;
|
||||
color: var(--fg);
|
||||
}
|
||||
.hist-row {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
border: 1.5px solid var(--card-border);
|
||||
border-radius: 10px;
|
||||
background: var(--card);
|
||||
padding: 10px 12px;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
.hist-main { flex: 1; min-width: 0; }
|
||||
.hist-title {
|
||||
font-size: 0.8rem;
|
||||
color: var(--fg);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.hist-meta {
|
||||
font-size: 0.65rem;
|
||||
color: var(--muted);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.03em;
|
||||
margin-top: 2px;
|
||||
}
|
||||
.hist-meta .t-flag { color: var(--success); }
|
||||
.hist-actions { display: flex; gap: 6px; }
|
||||
#history .card { animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
|
||||
a.card-dl-btn { text-decoration: none; display: inline-block; }
|
||||
|
||||
.spin {
|
||||
@@ -673,6 +648,7 @@
|
||||
format: currentFormat,
|
||||
format_id: c.selectedFormatId,
|
||||
title: c.title || '',
|
||||
thumbnail: c.thumbnail || '',
|
||||
}),
|
||||
});
|
||||
const data = await res.json();
|
||||
@@ -763,17 +739,29 @@
|
||||
const rows = await res.json();
|
||||
const box = document.getElementById('history');
|
||||
if (!Array.isArray(rows) || !rows.length) return;
|
||||
const items = rows.map(r => `
|
||||
<div class="hist-row">
|
||||
<div class="hist-main">
|
||||
<div class="hist-title">${esc(r.title || r.filename || r.url || '')}</div>
|
||||
<div class="hist-meta">${esc(r.date || '')}${r.size ? ' · ' + fmtSize(r.size) : ''} · ${r.has_transcript ? '<span class="t-flag">transcript ✓</span>' : 'no transcript'}</div>
|
||||
const items = rows.map(r => {
|
||||
let thumbHtml;
|
||||
if (r.thumbnail) {
|
||||
thumbHtml = `<img src="${r.thumbnail}" alt="">`;
|
||||
} else {
|
||||
thumbHtml = `<div class="no-thumb"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="2" width="20" height="20" rx="2"/><circle cx="8" cy="8" r="1.5"/><path d="m21 15-5-5L5 21"/></svg></div>`;
|
||||
}
|
||||
const flag = r.has_transcript
|
||||
? `<span class="card-status done">transcript ✓</span>`
|
||||
: `<span class="card-status">no transcript</span>`;
|
||||
return `
|
||||
<div class="card">
|
||||
<div class="card-thumb">${thumbHtml}</div>
|
||||
<div class="card-body">
|
||||
<div class="card-title">${esc(r.title || r.filename || r.url || 'Untitled')}</div>
|
||||
<div class="card-meta">${esc(r.date || '')}${r.size ? ' · ' + fmtSize(r.size) : ''} · <span class="${r.has_transcript ? 'card-status done' : ''}">${r.has_transcript ? 'transcript ✓' : 'no transcript'}</span></div>
|
||||
<div class="card-actions">
|
||||
<a class="card-dl-btn" href="/api/file/${r.job_id}" download>Save</a>
|
||||
${r.has_transcript ? `<a class="card-dl-btn" href="/api/transcript/${r.job_id}" download>Transcript</a>` : ''}
|
||||
</div>
|
||||
</div>
|
||||
<div class="hist-actions">
|
||||
<a class="card-dl-btn" href="/api/file/${r.job_id}" download>${esc(r.filename || 'Save').replace(/\.[^.]+$/, '')}</a>
|
||||
${r.has_transcript ? `<a class="card-dl-btn" href="/api/transcript/${r.job_id}" download>Transcript</a>` : ''}
|
||||
</div>
|
||||
</div>`).join('');
|
||||
</div>`;
|
||||
}).join('');
|
||||
box.innerHTML = `<h2 class="hist-h">History</h2>${items}`;
|
||||
} catch { /* history unavailable */ }
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user