landing: compact GOA alt display and all-account bank fallback
Wire goa-amount.js into bank/exchange/merchant intros, deploy it with the landings, and deepen the in-container bank stats fallback to scan all accounts (skip only exchange) when the host timer is down.
This commit is contained in:
parent
746d7a41af
commit
48f77139c5
8 changed files with 363 additions and 39 deletions
|
|
@ -1491,6 +1491,7 @@ tw run-until-done && tw balance</pre>
|
|||
</footer>
|
||||
</main>
|
||||
|
||||
<script src="/intro/goa-amount.js"></script>
|
||||
<script>
|
||||
(function () {
|
||||
var WEBUI = "https://bank.hacktivism.ch/webui/";
|
||||
|
|
@ -1936,16 +1937,34 @@ tw run-until-done && tw balance</pre>
|
|||
var el = document.getElementById(id);
|
||||
if (el) el.textContent = v == null || v === "" ? "—" : String(v);
|
||||
}
|
||||
function setAmt(id, rowOrAmt) {
|
||||
var el = document.getElementById(id);
|
||||
if (!el) return;
|
||||
if (window.GoaAmount) {
|
||||
var f = GoaAmount.pick(rowOrAmt, 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 {
|
||||
var raw = rowOrAmt && typeof rowOrAmt === "object"
|
||||
? (rowOrAmt.amount_alt || rowOrAmt.amount || rowOrAmt.total_amount || "—")
|
||||
: (rowOrAmt == null || rowOrAmt === "" ? "—" : String(rowOrAmt));
|
||||
el.textContent = raw;
|
||||
}
|
||||
}
|
||||
if (window.GoaAmount) GoaAmount.rememberAlt(d);
|
||||
var flow = d.flow || {};
|
||||
var fin = flow.incoming || {};
|
||||
var fwd = flow.withdraw || {};
|
||||
set("st-accounts", ba.total != null ? ba.total : "—");
|
||||
set("st-wallets", wl.unique_reserves != null ? wl.unique_reserves : "—");
|
||||
set("st-incoming", fin.amount || flow.total_in || "—");
|
||||
set("st-withdraw", fwd.amount || w.total_amount || "—");
|
||||
set("st-24h", h24.amount || "GOA:0");
|
||||
set("st-7d", h7.amount || "GOA:0");
|
||||
set("shared-balance", d.balance_explorer || "—");
|
||||
setAmt("st-incoming", fin.amount_alt ? fin : (fin.amount || flow.total_in || "—"));
|
||||
setAmt("st-withdraw", fwd.amount_alt ? fwd : (fwd.amount || w.total_amount || "—"));
|
||||
setAmt("st-24h", h24.amount_alt ? h24 : (h24.amount || "GOA:0"));
|
||||
setAmt("st-7d", h7.amount_alt ? h7 : (h7.amount || "GOA:0"));
|
||||
setAmt("shared-balance", d.balance_explorer_alt
|
||||
? { amount: d.balance_explorer, amount_alt: d.balance_explorer_alt, amount_full: d.balance_explorer_full }
|
||||
: (d.balance_explorer || "—"));
|
||||
|
||||
var list = document.getElementById("st-recent");
|
||||
if (list) {
|
||||
|
|
@ -1962,7 +1981,13 @@ tw run-until-done && tw balance</pre>
|
|||
var li = document.createElement("li");
|
||||
var amt = document.createElement("span");
|
||||
amt.className = "amt";
|
||||
amt.textContent = row.amount || "?";
|
||||
if (window.GoaAmount) {
|
||||
var af = GoaAmount.pick(row, d.alt_unit_names);
|
||||
amt.textContent = af.display;
|
||||
if (af.title && af.title !== af.display) amt.setAttribute("title", af.title);
|
||||
} else {
|
||||
amt.textContent = row.amount_alt || row.amount || "?";
|
||||
}
|
||||
var meta = document.createElement("span");
|
||||
meta.className = "meta";
|
||||
var when = fmtCest(row.at_unix, row.at || row.at_iso) || "";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue