landing: harden GOA alt display for all three sites

Ship goa-amount.js inside each landing tree, add an inline fallback when
the asset is not yet deployed, keep CHF free of GOA unit names, fix
exchange amount_full wiring, and add test-landing-stats.sh (local + live).
This commit is contained in:
Hernâni Marques 2026-07-17 08:48:00 +02:00
parent b65018cd0b
commit 9e0f85024b
No known key found for this signature in database
10 changed files with 796 additions and 16 deletions

View file

@ -446,6 +446,33 @@ sudo apt-get install -y taler-wallet-cli</pre>
</main>
<script src="/intro/goa-amount.js"></script>
<script>
/* Fallback if goa-amount.js not yet deployed (uses amount_alt from stats.json) */
(function () {
if (window.GoaAmount) return;
window.GoaAmount = {
rememberAlt: function () {},
format: function (a) {
var s = a == null || a === "" ? "—" : String(a);
return { display: s, title: s === "—" ? "" : s, raw: s, usedAlt: false };
},
pick: function (row) {
if (row && typeof row === "object") {
if (row.amount_alt) {
return {
display: String(row.amount_alt),
title: String(row.amount_full || row.amount || row.amount_alt),
raw: String(row.amount || ""),
usedAlt: true
};
}
return this.format(row.amount || row.total_amount || "—");
}
return this.format(row);
}
};
})();
</script>
<script>
(function () {
function set(id, v) {
var el = document.getElementById(id);
@ -454,17 +481,21 @@ sudo apt-get install -y taler-wallet-cli</pre>
function setAmt(id, amount, altKey, d) {
var el = document.getElementById(id);
if (!el) return;
var row = null;
var row = { amount: amount };
if (altKey && d && d[altKey]) {
row = { amount: amount, amount_alt: d[altKey], amount_full: d[altKey.replace(/_alt$/, "_full")] || d[amount + "_full"] };
row.amount_alt = d[altKey];
var fullKey = String(altKey).replace(/_alt$/, "_full");
if (d[fullKey]) row.amount_full = d[fullKey];
}
if (window.GoaAmount) {
var f = row ? GoaAmount.pick(row, d && d.alt_unit_names) : GoaAmount.format(amount, d && d.alt_unit_names);
var f = (row.amount_alt || (d && d.alt_unit_names))
? GoaAmount.pick(row, d && d.alt_unit_names)
: GoaAmount.format(amount, d && d.alt_unit_names);
el.textContent = f.display;
if (f.title && f.title !== f.display) el.setAttribute("title", f.title);
else el.removeAttribute("title");
} else {
el.textContent = (row && row.amount_alt) || amount || "—";
el.textContent = row.amount_alt || amount || "—";
}
}
function msLabel(ms, http) {