merchant landing: recent activity split GOA/CHF, 5 each

Stats script emits recent_activity_by_currency (limit 5); UI shows
side-by-side columns instead of one long mixed list.
This commit is contained in:
Hernâni Marques 2026-07-10 20:19:59 +02:00
parent f22158e369
commit 458472e177
No known key found for this signature in database
2 changed files with 183 additions and 82 deletions

View file

@ -181,21 +181,47 @@
}
.cur-panel .amt-secondary strong { color: var(--val); font-weight: 700; }
/* Recent activity */
/* Recent activity — split by currency */
.act-pair {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 0.75rem;
margin-top: 0.35rem;
}
@media (max-width: 480px) {
.act-pair { grid-template-columns: 1fr; }
}
.act-col {
background: rgba(24, 18, 40, 0.45);
border: 1px solid rgba(167, 139, 250, 0.22);
border-radius: 12px;
padding: 0.55rem 0.55rem 0.35rem;
min-width: 0;
}
.act-col-h {
margin: 0 0 0.35rem;
font-size: 0.78rem;
font-weight: 750;
letter-spacing: 0.06em;
text-transform: uppercase;
color: var(--goa);
text-align: center;
}
.act-col.chf .act-col-h { color: var(--chf); }
.act-list { list-style: none; margin: 0; padding: 0; }
.act-item {
display: grid;
grid-template-columns: auto 1fr auto;
gap: 0.35rem 0.65rem;
gap: 0.25rem 0.45rem;
align-items: center;
padding: 0.55rem 0.35rem;
padding: 0.4rem 0.2rem;
border-bottom: 1px solid rgba(255,255,255,0.06);
font-size: 0.88rem;
font-size: 0.82rem;
}
.act-item:last-child { border-bottom: 0; }
.act-kind {
font-size: 0.65rem; font-weight: 800; letter-spacing: 0.06em;
text-transform: uppercase; padding: 0.18rem 0.4rem; border-radius: 6px;
font-size: 0.58rem; font-weight: 800; letter-spacing: 0.05em;
text-transform: uppercase; padding: 0.14rem 0.32rem; border-radius: 6px;
align-self: center;
}
.act-kind.payment { color: #14532d; background: rgba(134, 239, 172, 0.85); }
@ -204,17 +230,17 @@
.act-main { min-width: 0; }
.act-amt {
font-weight: 800; font-variant-numeric: tabular-nums; color: var(--val);
font-size: 0.95rem;
font-size: 0.88rem;
}
.act-sum {
color: var(--muted); font-size: 0.78rem; white-space: nowrap;
color: var(--muted); font-size: 0.72rem; white-space: nowrap;
overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.act-meta {
text-align: right; font-size: 0.68rem; color: var(--muted);
text-align: right; font-size: 0.62rem; color: var(--muted);
font-variant-numeric: tabular-nums; white-space: nowrap;
}
.empty { text-align: center; color: var(--muted); font-size: 0.85rem; padding: 0.5rem; }
.empty { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 0.45rem 0.2rem; }
.stats-foot {
margin: 0.75rem 0 0; font-size: 0.72rem; color: var(--muted); text-align: center;
@ -509,10 +535,21 @@
<section class="stats" id="activity" aria-labelledby="act-title">
<h2 id="act-title">Recent activity</h2>
<p class="note">Latest payments &amp; refunds across instances</p>
<ul class="act-list" id="st-activity">
<li class="empty">Loading…</li>
</ul>
<p class="note">Latest 5 payments &amp; refunds per currency</p>
<div class="act-pair" id="st-activity-pair">
<div class="act-col goa" aria-labelledby="act-goa-h">
<h3 class="act-col-h" id="act-goa-h">GOA</h3>
<ul class="act-list" id="st-activity-goa">
<li class="empty">Loading…</li>
</ul>
</div>
<div class="act-col chf" aria-labelledby="act-chf-h">
<h3 class="act-col-h" id="act-chf-h">CHF</h3>
<ul class="act-list" id="st-activity-chf">
<li class="empty">Loading…</li>
</ul>
</div>
</div>
</section>
<section class="step-card">
@ -637,12 +674,14 @@
fillCurrency("goa", by.GOA);
fillCurrency("chf", by.CHF);
var list = document.getElementById("st-activity");
list.innerHTML = "";
var acts = d.recent_activity || [];
if (!acts.length) {
list.innerHTML = '<li class="empty">No recent payments or refunds</li>';
} else {
function fillActivityList(el, acts) {
if (!el) return;
el.innerHTML = "";
acts = acts || [];
if (!acts.length) {
el.innerHTML = '<li class="empty">No recent payments or refunds</li>';
return;
}
acts.forEach(function (a) {
var kind = (a.kind || "other").toLowerCase();
var li = document.createElement("li");
@ -659,9 +698,27 @@
'<div class="act-meta">' +
"<span>" + esc(a.ts_human || a.ts || "") + "</span>" +
"</div>";
list.appendChild(li);
el.appendChild(li);
});
}
// Prefer split-by-currency (≤5 each); fall back to flat list split by amount prefix
var byCur = {};
(d.recent_activity_by_currency || []).forEach(function (block) {
byCur[(block.currency || "").toUpperCase()] = block.items || [];
});
if (!Object.keys(byCur).length && (d.recent_activity || []).length) {
byCur.GOA = [];
byCur.CHF = [];
(d.recent_activity || []).forEach(function (a) {
var cur = String(a.amount || "").split(":")[0].toUpperCase();
if (cur === "GOA") byCur.GOA.push(a);
else if (cur === "CHF") byCur.CHF.push(a);
});
byCur.GOA = byCur.GOA.slice(0, 5);
byCur.CHF = byCur.CHF.slice(0, 5);
}
fillActivityList(document.getElementById("st-activity-goa"), byCur.GOA);
fillActivityList(document.getElementById("st-activity-chf"), byCur.CHF);
if (foot) {
foot.textContent = (d.dual_currency ? "Dual-currency · " : "") +
@ -725,8 +782,10 @@
})
.catch(function () {
if (foot) foot.innerHTML = 'Stats offline · <a href="https://bank.hacktivism.ch/intro/" style="color:#e8c878">bank.hacktivism.ch</a>';
var list = document.getElementById("st-activity");
if (list) list.innerHTML = '<li class="empty">Stats offline</li>';
["st-activity-goa", "st-activity-chf"].forEach(function (id) {
var list = document.getElementById(id);
if (list) list.innerHTML = '<li class="empty">Stats offline</li>';
});
});
}
load();