mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-11 23:32:31 +00:00
zaps: fix badge never showing (array pointers) + zap total in the player modal
The zap-totals store's pointerKey only understood {type,value} objects, but
deriveVideoPointerInfo produces tag-style ARRAYS (["a", value, relay?]) — so
every card-badge lookup keyed to nothing, no receipt fetch was ever
scheduled, and the Most Zapped ranking metric silently read 0 for every
video. pointerKey now normalizes both shapes; tests use the array shape the
app actually passes.
Also adds the orange sats badge to the video player modal's meta row
(right side via the row's existing justify-between; views stay left),
driven by the same cache/change-signal as the cards and torn down with the
view-count subscription.
Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
1 parent
ad62205afd
commit
cbe894969d
7 files changed
+106
-5
No files matched your search
@@ -60,7 +60,8 @@ test("binder: zero stays hidden, receipts reveal and format, prune drops detache
|
||||
const badge = card.querySelector("[data-zap-total]");
|
||||
const wrapper = card.querySelector(".video-card__zaps");
|
||||
|
||||
const pointerInfo = { key: `a:${A1}`, pointer: { type: "a", value: A1 } };
|
||||
// Tag-style ARRAY pointer — the shape VideoListView actually passes.
|
||||
const pointerInfo = { key: `a:${A1}`, pointer: ["a", A1] };
|
||||
binder.bind(card, pointerInfo);
|
||||
assert.equal(wrapper.classList.contains("hidden"), true, "unknown total stays hidden");
|
||||
assert.equal(badge.textContent, "");
|
||||
|
||||
@@ -65,7 +65,14 @@ test("amount extraction: bolt11 first, zap-request amount fallback, garbage →
|
||||
);
|
||||
});
|
||||
|
||||
test("pointerKey normalizes and rejects unusable pointers", () => {
|
||||
test("pointerKey accepts BOTH app shapes and rejects unusable pointers", () => {
|
||||
// Tag-style ARRAY — what deriveVideoPointerInfo/resolveVideoPointer actually
|
||||
// produce (regression: the object-only version silently zeroed every card
|
||||
// badge and the Most Zapped ranking).
|
||||
assert.equal(pointerKey(["a", A1]), `a:${A1}`);
|
||||
assert.equal(pointerKey(["e", "evt1", "wss://relay.example"]), "e:evt1");
|
||||
assert.equal(pointerKey(["x", "nope"]), "");
|
||||
// Object form.
|
||||
assert.equal(pointerKey({ type: "a", value: A1 }), `a:${A1}`);
|
||||
assert.equal(pointerKey({ type: "e", value: "evt1" }), "e:evt1");
|
||||
assert.equal(pointerKey({ type: "x", value: "nope" }), "");
|
||||
|
||||
Reference in new issue
Block a user