Skip to content

Commit d7d3972

Browse files
committed
feat(site): count CPU engineering samples in the homepage stats
Reads the satellite repo's published catalog.json and adds its record count as a stat tile; the footer link from #174 is removed. Refs #19
1 parent 0fe5125 commit d7d3972

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

site/src/pages/index.astro

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,9 +330,7 @@ const endpoints = [
330330
<div class="foot-links">
331331
<a href={ghUrl} target="_blank" rel="noopener">GitHub</a>
332332
<a href={`${base}docs`}>API reference</a>
333-
<a href="#playground">Playground</a>
334-
<a href="https://gettechapi.github.io/cpu-engineering-samples/" target="_blank" rel="noopener">CPU engineering samples</a>
335-
</div>
333+
<a href="#playground">Playground</a> </div>
336334
</div>
337335
<p class="foot-warn">⚠ Curated, growing dataset — not yet an exhaustive catalog of every device.</p>
338336
<p class="foot-engine">Validated, scored &amp; served by <a href={engineUrl} target="_blank" rel="noopener"><span class="mark">T</span>TechEngine</a> — the open data + scoring engine.</p>

site/src/scripts/techapi.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,15 @@ async function loadList(resource) {
182182
// The hero is already in view at first paint. Animate immediately so the
183183
// counters do not remain at zero when IntersectionObserver is delayed.
184184
el.querySelectorAll(".num").forEach((n) => countUp(n, +n.dataset.n));
185+
// Satellite data repos publish their own catalog; count them alongside.
186+
fetch("https://gettechapi.github.io/cpu-engineering-samples/catalog.json")
187+
.then((r) => (r.ok ? r.json() : Promise.reject()))
188+
.then((list) => {
189+
el.insertAdjacentHTML("beforeend",
190+
`<div class="stat"><div class="n"><span class="num">0</span></div><div class="l">cpu eng. samples</div></div>`);
191+
countUp(el.lastElementChild.querySelector(".num"), list.length);
192+
})
193+
.catch(() => {});
185194
}).catch(() => {
186195
el.innerHTML = '<div class="stat"><div class="n">—</div><div class="l">build data first</div></div>';
187196
});

0 commit comments

Comments
 (0)