part: the asset checklist must reflect the data, not assert it

Every part rendered "✓ 3D model ✓ Schematic ✓ Footprint ✓ SPICE" as literal markup,
regardless of what it actually had. footprint_pads is absent from all 80 parts, so
the Footprint tab says "no footprint data" while the checklist two inches away
claims a tick — which is how a missing footprint reads as a rendering bug rather
than missing data.

Each item now derives from the field the corresponding tab actually reads.
This commit is contained in:
gator 2026-08-16 14:46:13 +00:00
parent b08b6b7648
commit 0ceb862eeb

View file

@ -85,7 +85,13 @@ window.ppcbReady(async () => {
<a class="btn ghost" href="${esc(p.datasheet_url)}" target="_blank" rel="noopener">Datasheet ↗</a>
<button class="btn ghost" id="lib">+ My library</button>
</div>
<div class="assets"><span><span class="ok">✓</span> 3D model</span><span><span class="ok">✓</span> Schematic</span><span><span class="ok">✓</span> Footprint</span><span><span class="ok">✓</span> SPICE</span><span><span class="ok">✓</span> ${(p.pins || []).length} pins</span></div>
<div class="assets">${[
['3D model', !!p.model_3d],
['Schematic', !!(p.pins || []).length], // schematicSVG() draws from pins
['Footprint', !!(p.footprint_pads || []).length], // footprintSVG() draws from footprint_pads
['SPICE', !!p.spice],
[`${(p.pins || []).length} pins`, !!(p.pins || []).length],
].map(([label, have]) => `<span><span class="${have ? 'ok' : 'hint'}">${have ? '✓' : '—'}</span> ${label}</span>`).join('')}</div>
${p.when_to_use ? `<div class="section"><h3>When to use</h3><p style="color:var(--text);line-height:1.6;margin:0">${esc(p.when_to_use)}</p></div>` : ''}
${ucs ? `<div class="section"><h3>What it's used for</h3>${ucs}</div>` : ''}
${params ? `<div class="section"><h3>Specifications</h3><table class="ptable">${params}</table></div>` : ''}