aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/ark.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-09-19 22:28:36 -0700
committerAdam Soltys <[email protected]>2026-09-19 22:28:36 -0700
commit1b142c92ce869a6ebe97825931ef3553255ba58e (patch)
tree4a16e864ad7a827678c5bab888b8eb1764eb4657 /src/features/ark.js
parent74152d4ae33e1ea065769d261c615885c387590a (diff)
downloadcoinosv3-1b142c92ce869a6ebe97825931ef3553255ba58e.tar.gz
coinosv3-1b142c92ce869a6ebe97825931ef3553255ba58e.zip
Zaps: tap again while one flies, hold the bolt to change the amount.
A pending zap no longer refuses the next tap: the optimistic tally keeps one entry per zap and matches each report and receipt to the oldest it can describe, so two default-amount zaps stack, settle and hand over to their receipts one at a time. Instant post zaps run off the send screen's zap slot, so a second tap can't evict the one still resolving, and send action ids are unique within a millisecond. Holding ⚡ (500ms) opens the amount screen in an edit mode — Save alone, or Save and zap this note — from the action bar and the chat chips alike; the press's timer lives on the element so a background repaint mid-press can't turn a lifted finger into a hold. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Diffstat (limited to 'src/features/ark.js')
-rw-r--r--src/features/ark.js19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/features/ark.js b/src/features/ark.js
index dbc97f6..5327a23 100644
--- a/src/features/ark.js
+++ b/src/features/ark.js
@@ -1554,11 +1554,18 @@ export function arkFeature(ctx) {
// 3. an on-chain address from the BIP-353 record
const NAMES_REGISTRAR = 'https://names.coinos.io';
function startNpubPay(pk, npub, eventId = null, autoSat = 0) {
- const z = (ui.arkZap = { npub, pk, eventId, amount: '', comment: '', status: 'lookup', autoSat });
- ui.zap = null; // a stale Lightning-zap card must not resurface behind ours
- ui.sendError = '';
- render();
- const live = () => ui.arkZap === z;
+ const z = { npub, pk, eventId, amount: '', comment: '', status: 'lookup', autoSat };
+ // A one-tap post zap has no card: it resolves and pays off-screen, so a
+ // second tap — the same post again, or another — never evicts the one
+ // already in the air. Everything else takes the send screen's zap slot.
+ const instant = !!(autoSat && eventId);
+ if (!instant) {
+ ui.arkZap = z;
+ ui.zap = null; // a stale Lightning-zap card must not resurface behind ours
+ ui.sendError = '';
+ render();
+ }
+ const live = () => instant || ui.arkZap === z;
// The tap already put a pulsing chip on the note being zapped: whichever
// way this goes, say so, so the chip settles instead of pulsing until it
// times out. (A handover to the Lightning flow doesn't report — that flow
@@ -1627,7 +1634,7 @@ export function arkFeature(ctx) {
if (profile && (profile.lud16 || profile.lud06)) {
await connectArk().catch(() => {});
if (!live()) return;
- if (ctx.hook('canLnZap')) { ui.arkZap = null; ctx.hook('lnZapNpub', pk, npub, z.eventId, z.autoSat); return; }
+ if (ctx.hook('canLnZap')) { if (ui.arkZap === z) ui.arkZap = null; ctx.hook('lnZapNpub', pk, npub, z.eventId, z.autoSat); return; }
}
// 3. on-chain fallback
if (onchain) {