Skip to content

Commit e4a0cdf

Browse files
committed
fix(site): make the History timeline about growth, not commit names
The dump-history list led with each commit's title, but almost every dump commit is the same boilerplate ("chore(site): refresh public dump for X import"), so the list read as a wall of near-identical names. Rework each row to lead with what the section is actually about — date, record count, and the delta — with the per-category changes as the detail. shortTitle() strips the conventional-commit prefix and the dump-refresh boilerplate, keeping only a distinctive tag (e.g. "GSMArena Kaggle") or nothing. The chart still shows every sync; the list is capped to the recent 8 with a "N earlier syncs" link to the full commit history. Refs #1
1 parent b58ae99 commit e4a0cdf

2 files changed

Lines changed: 52 additions & 8 deletions

File tree

site/src/scripts/techapi.js

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,20 @@ function countUp(node, target, opts = {}) {
263263
return "no change";
264264
}
265265

266+
// Most dump commits share one boilerplate title ("chore(site): refresh public
267+
// dump for X import"). The timeline is about growth, not commit messages, so we
268+
// strip the conventional-commit prefix and the dump-refresh boilerplate and keep
269+
// only the distinctive bit (e.g. "GSMArena Kaggle"), or "" when there is none.
270+
function shortTitle(raw) {
271+
let t = String(raw || "").trim();
272+
if (/^revert\b/i.test(t)) return "reverted";
273+
t = t.replace(/^[a-z]+(\([^)]*\))?:\s*/i, ""); // drop "chore(site): "
274+
const m = t.match(/\bdump\s+(?:for|after)\s+(.+?)(?:\s+imports?)?\s*$/i);
275+
if (m) return m[1].trim();
276+
if (/\b(refresh|regenerate|update)\b.*\bdump\b/i.test(t)) return ""; // pure boilerplate
277+
return t; // genuinely distinctive
278+
}
279+
266280
function renderHistory(points) {
267281
if (!points.length) throw new Error("empty history");
268282
const maxTotal = Math.max(...points.map((point) => point.total));
@@ -279,15 +293,33 @@ function countUp(node, target, opts = {}) {
279293
</a>`;
280294
}).join("");
281295

282-
listEl.innerHTML = points.slice().reverse().map((point) => {
296+
// The chart already shows every sync; the list is the recent detail — cap it
297+
// so the section stays compact, with a link to the full commit history.
298+
const LIST_MAX = 8;
299+
const recent = points.slice().reverse();
300+
const shown = recent.slice(0, LIST_MAX);
301+
const rows = shown.map((point) => {
283302
const changes = point.changes.length
284303
? point.changes.map((row) => `${shortLabel[row.key]} ${formatDelta(row.delta)}`).join(", ")
285304
: (point.baseline ? "baseline snapshot" : `total ${formatDelta(point.delta)}`);
286-
return `<li><span class="history-dot"></span><span>
287-
<a href="${esc(point.url)}" target="_blank" rel="noopener">${esc(point.title)}</a>
288-
<small>${esc(point.when)} - ${esc(point.sha)} - ${esc(changes)}</small>
305+
const tag = shortTitle(point.title);
306+
const delta = point.baseline ? "baseline" : formatDelta(point.delta);
307+
return `<li><span class="history-dot"></span><span class="history-item">
308+
<a class="history-head" href="${esc(point.url)}" target="_blank" rel="noopener">
309+
<span class="history-when">${esc(point.when)}</span>
310+
<b class="history-recs">${point.total.toLocaleString()}</b>
311+
<span class="history-delta${point.delta < 0 ? " is-negative" : ""}">${esc(delta)}</span>
312+
</a>
313+
<small>${esc(changes)}${tag ? ` · ${esc(tag)}` : ""}</small>
289314
</span></li>`;
290-
}).join("");
315+
});
316+
const hidden = recent.length - shown.length;
317+
if (hidden > 0) {
318+
rows.push(`<li class="history-more"><span class="history-dot is-faint"></span><span>
319+
<a href="https://github.com/GetTechAPI/TechAPI/commits/main/site/public/v1/index.json" target="_blank" rel="noopener">${hidden} earlier ${hidden === 1 ? "sync" : "syncs"} →</a>
320+
</span></li>`);
321+
}
322+
listEl.innerHTML = rows.join("");
291323
}
292324

293325
const fmtWhen = (date) => date

site/src/styles/techapi.css

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,18 +383,30 @@ code, .mono { font-family: var(--mono); }
383383
background: var(--accent);
384384
box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent);
385385
}
386-
.history-list a {
386+
.history-item { min-width: 0; }
387+
.history-head {
388+
display: flex;
389+
align-items: baseline;
390+
gap: 10px;
391+
flex-wrap: wrap;
387392
color: var(--fg);
388393
font-weight: 600;
389394
}
390-
.history-list a:hover { color: var(--accent-text); }
395+
.history-when { font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--muted); }
396+
.history-recs { font-family: var(--mono); font-size: 14.5px; letter-spacing: -.01em; }
397+
.history-delta { font-family: var(--mono); font-size: 12px; color: var(--accent-text); }
398+
.history-delta.is-negative { color: var(--err); }
399+
.history-head:hover .history-recs { color: var(--accent-text); }
391400
.history-list small {
392401
display: block;
393-
margin-top: 2px;
402+
margin-top: 3px;
394403
font-family: var(--mono);
395404
font-size: 11.5px;
396405
color: var(--muted);
397406
}
407+
.history-more a { font-family: var(--mono); font-size: 12px; color: var(--muted); font-weight: 500; }
408+
.history-more a:hover { color: var(--accent-text); }
409+
.history-dot.is-faint { background: var(--faint); box-shadow: none; }
398410
@media (max-width: 760px) {
399411
.history { grid-template-columns: 1fr; }
400412
.history-grid { grid-template-columns: 1fr; }

0 commit comments

Comments
 (0)