Recipe inputs show have / need

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-10-20 19:49:30 +01:00
parent 8dd33cbb40
commit 0d33e09799
2 changed files with 10 additions and 1 deletions

View file

@ -400,9 +400,10 @@ function pageHtml() {
return ({ town, council, orders, board, roster, bank }[page] || town)();
}
// Recipe input as "have / need"; without `have`, just the quantity.
function itemChip(id, qty, have) {
const short = have !== undefined && have < qty;
return `<span class="item-chip ${short ? "short" : ""}" title="${esc([item(id).name, itemStats(id)].filter(Boolean).join(": "))}">${item(id).icon} ${fmt(qty)}${have !== undefined ? ` <span class="have">/ ${fmt(have)}</span>` : ""}</span>`;
return `<span class="item-chip ${short ? "short" : ""}" title="${esc([item(id).name, itemStats(id)].filter(Boolean).join(": "))}">${item(id).icon} ${have !== undefined ? `${fmt(have)} <span class="have">/ ${fmt(qty)}</span>` : fmt(qty)}</span>`;
}
// Progress towards a building cost: "have / need".