aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-10-01 16:36:25 -0700
committerAdam Soltys <[email protected]>2026-10-01 16:36:42 -0700
commit62b6b80d9c8d03d6caadb0648059ba94e34f8b1d (patch)
tree5b000d01723975b091fdaa1bda20e6ff84139dd8 /src
parentbf42c148664cc97c6b3fd0c66014883de875adc7 (diff)
downloadcoinosv3-62b6b80d9c8d03d6caadb0648059ba94e34f8b1d.tar.gz
coinosv3-62b6b80d9c8d03d6caadb0648059ba94e34f8b1d.zip
Clear abandoned payments, reset profile Pay and restore native messaging Back
Diffstat (limited to 'src')
-rw-r--r--src/app.js32
-rw-r--r--src/features/ark.js7
-rw-r--r--src/features/messages.js17
-rw-r--r--src/features/names.js1
-rw-r--r--src/features/zaps.js1
-rw-r--r--src/recipient-search.js2
-rw-r--r--src/style.css12
7 files changed, 55 insertions, 17 deletions
diff --git a/src/app.js b/src/app.js
index 54404d4..2d9611a 100644
--- a/src/app.js
+++ b/src/app.js
@@ -9,7 +9,7 @@ import { qrSvg } from './qr.js';
import './rich-text.js'; // <coinos-text>, the composers' field
import { makeSearcher, resultRows, searchable, punkUrl, warmSearch } from './recipient-search.js';
import { assetUrl } from './asset-url.js';
-import { npubOf, seedPubkey, neventOf } from './nostr.js';
+import { npubOf, seedPubkey, neventOf, parseNostrPubkey } from './nostr.js';
import { nip98Header } from './nip98.js';
import { uploadPublicMedia, MediaUploadError } from './media-upload.js';
import { NOSTR_MARK } from './features/nostrlogin.js';
@@ -114,15 +114,27 @@ const ui = {
sendResult: null, // { txid } | { signedHex, txid }
busy: false,
};
+let sendPageOpen = false, sendPageRendered = false;
+
+function clearSend() {
+ ui.send = blankSend();
+ ui.draft = null; ui.broadcastTx = null; ui.sendResult = null; ui.sendError = '';
+ featureAll('resetSend');
+ sendSearcher.clear(false);
+ sendSearch.rows = null; sendSearch.sync = null; sendSearch.pick = null; sendSearch.el = null;
+ clearTimeout(sendRevealTimer);
+}
// Take the wallet to the Send pane: any payment detail left open (a tapped
// history row — which claims the whole tab area, whichever tab is picked)
// closes first. A feature that jumped straight to ui.tab = 'send' used to
// land on a renewal's detail card instead of the form.
-function showSend() {
+// A new recipient also clears previous payment reviews and results.
+function showSend({ fresh = false } = {}) {
ui.txDetail = null; ui.arkMoveDetail = null; ui.arkReconDetail = null; ui.arkExitDetail = null; ui.giftDetail = null;
ui.bump = null;
ui.sendError = '';
+ if (fresh) clearSend();
ui.tab = 'send';
}
@@ -754,6 +766,7 @@ function renderInner() {
// there. Declining still lands back exactly where the tap happened,
// because nothing else moves. Onboarding keeps its precedence.
const lockAsk = ui.pw && ui.pw.purpose === 'lock' && !(ui.onb || onbInProgress());
+ sendPageRendered = false;
const screen =
(lockAsk && h('div', { class: 'col', style: 'gap:16px' }, brandHeader(false), pwPromptCard()))
|| featureHook('screenView')
@@ -774,6 +787,10 @@ function renderInner() {
// deliberate choice and still paints; this one waits.
? h('div', { class: 'col', style: 'gap:16px' }, BOOT_NAV ? null : brandHeader(false))
: shouldOnboard() ? onboardScreen() : unlockScreen());
+ // Track the pane actually rendered: a profile or chat hides Send even
+ // when its wallet tab is still selected. Reviews/results stay in Send.
+ if (sendPageOpen && !sendPageRendered) clearSend();
+ sendPageOpen = sendPageRendered;
// Navigation animates; background repaints must not. The key is every
// ui field that decides which page is on screen.
const navKey = [ui.screen, ui.tab === 'settings', ui.chatOpen, ui.msgView, ui.msgPeer, ui.msgCommunity,
@@ -4564,11 +4581,11 @@ function tabContent() {
// getting back to it is scrolling, not hunting for the toggle. A history
// DETAIL (a tapped row) still claims the whole area — you're reading one
// payment, not browsing — as does the receive celebration takeover.
- const pane = ui.tab === 'receive' ? receiveTab() : sendTab();
const hist = historyTab();
const detailOpen = ui.bump || ui.txDetail || ui.arkMoveDetail
|| ui.arkReconDetail || ui.arkExitDetail || ui.giftDetail;
if (detailOpen) return hist;
+ const pane = ui.tab === 'receive' ? receiveTab() : sendTab();
return h('div', { class: 'col', style: 'gap:16px' },
pane,
h('div', { class: 'small faint', style: 'text-transform:uppercase;letter-spacing:.06em;margin-top:4px' }, t('tabHistory')),
@@ -4710,6 +4727,7 @@ function loadSeedCard() {
}
function sendTab() {
+ sendPageRendered = true;
// Watch-only wallet (e.g. restored after a session wipe without "Save to
// device"): prompt to re-enter the seed before spending.
if (wallet.watchOnly) {
@@ -5096,8 +5114,8 @@ function recipientRow(s, r, i) {
),
check,
via ? h('div', { class: 'row gap6 send-via', style: 'align-items:center' },
- via.pk ? featureHook('avatarNode', via.pk) : null,
- h('span', { class: 'small' }, via.name),
+ via.pk && !single ? featureHook('avatarNode', via.pk) : null,
+ via.pk && single ? null : h('span', { class: 'small' }, via.name),
h('span', { class: 'small faint' }, t('sendNameHint'))) : null,
suggest,
r._ready ? h('div', { class: 'input-group' },
@@ -5145,6 +5163,9 @@ function sendForm() {
// show only the destination input (a Lightning invoice auto-advances instead).
const ready = destReady((s.recipients[0] || {}).address);
const plainAddr = (s.recipients[0] || {}).address;
+ const via = s.recipients[0]?.via;
+ const recipientPk = s.recipients.length === 1
+ ? (via?.ark === plainAddr && via.pk) || parseNostrPubkey(plainAddr) : null;
const arkDest = s.recipients.length === 1 && !!featureHook('hideSendControls', plainAddr);
const feeOpts = [
['economyFee', t('feeEconomy')],
@@ -5155,6 +5176,7 @@ function sendForm() {
return h(
'div',
{ class: 'card col' },
+ recipientPk ? featureHook('profileChip', recipientPk, 'lg') : null,
h(
'div',
{ class: 'field' },
diff --git a/src/features/ark.js b/src/features/ark.js
index 566c402..8fe21cc 100644
--- a/src/features/ark.js
+++ b/src/features/ark.js
@@ -1895,7 +1895,7 @@ export function arkFeature(ctx) {
function arkZapView() {
// While resolving, show the SHAPE of the card that's coming — same
- // title, same recipient chip, a spinner where the form will be. The
+ // title, same recipient portrait, a spinner where the form will be. The
// screen fills in rather than being replaced.
if (ui.arkZap && ui.arkZap.status === 'lookup') return zapSkeleton(ui.arkZap.pk, ui.arkZap.npub);
if (ui.arkZapped) {
@@ -3488,6 +3488,11 @@ export function arkFeature(ctx) {
}
return false;
},
+ resetSend() {
+ ui.arkLnFromSavings = null; ui.arkLnFromSavingsOk = false; ui.arkOffboardSend = null;
+ ui.arkLnPaid = null; ui.arkLnPay = null; ui.arkZapped = null; ui.arkZap = null;
+ ui.arkSent = null; ui.arkSend = null;
+ },
sendView() {
if (ui.arkLnFromSavings) return arkLnFromSavingsView();
if (ui.arkOffboardSend) return arkOffboardSendView();
diff --git a/src/features/messages.js b/src/features/messages.js
index 7ebc28e..54cbfa3 100644
--- a/src/features/messages.js
+++ b/src/features/messages.js
@@ -2964,10 +2964,10 @@ export function messagesFeature(ctx) {
//
// The thumbnail we keep locally is the whole picture at this size, so
// a 30px circle never asks the network for the original again. The
- // 64px profile avatar layers them: CSS paints the first layer that
+ // Larger profile/payment avatars layer them: CSS paints the first layer that
// has arrived, so the thumbnail shows instantly and the full-size
// original takes over on top when it lands.
- ? h('div', { class: cls + ' ava-img', style: 'background-image:' + avatarBg(p, cls.includes('profile-avatar')) })
+ ? h('div', { class: cls + ' ava-img', style: 'background-image:' + avatarBg(p, cls.includes('profile-avatar') || cls.includes('send-avatar')) })
: fallbackAvatar(h, pk, p.name, cls);
// A face we keep painting is one worth keeping a thumbnail of.
if (!feedPaint && p && p.picture) makeThumb(pk, p);
@@ -7924,7 +7924,8 @@ export function messagesFeature(ctx) {
ui.noteThread = null;
ui.userSearch = null;
ui.chatOpen = false;
- ctx.showSend(); // and never a lingering payment detail
+ ctx.showSend({ fresh: true });
+ ui.send.recipients[0].address = npubStr;
render();
hook('matchSendText', npubStr);
} }, t('profPay')),
@@ -7988,7 +7989,8 @@ export function messagesFeature(ctx) {
...noteOverlays());
}
- const backBtn = (onClick) => h('button', { class: 'iconbtn chat-back', onClick }, '‹');
+ const backBtn = (toParent) => h('button', { class: 'iconbtn chat-back',
+ onClick: () => ctx.goBack(toParent) }, '‹');
// ---- the post composer ----------------------------------------------------
// Shared by the profile page and the feed. A picture is uploaded the moment
@@ -9982,10 +9984,11 @@ export function messagesFeature(ctx) {
// Accounts page switches to that identity before showing its profile)
profileChip(pk, size, onOpen) {
const big = size === 'lg';
- return h('span', {
- class: 'zap-chip' + (big ? ' lg' : ''),
+ return h(big ? 'button' : 'span', {
+ class: big ? 'send-person' : 'zap-chip',
+ type: big ? 'button' : undefined,
onClick: (e) => { e.stopPropagation(); if (onOpen) onOpen(); else openProfile(pk); },
- }, avatar(pk, 'chat-avatar ' + (big ? 'chip-lg' : 'mini'), false),
+ }, avatar(pk, 'chat-avatar ' + (big ? 'send-avatar' : 'mini'), false),
h('span', { class: big ? '' : 'small' }, displayName(pk)));
},
// A sign-in (Google, passkey, key) that found no wallet on its identity:
diff --git a/src/features/names.js b/src/features/names.js
index a34334f..8f37b36 100644
--- a/src/features/names.js
+++ b/src/features/names.js
@@ -929,6 +929,7 @@ export function namesFeature(ctx) {
if (!ui.send || ui.send.recipients.length !== 1) return false;
return beginResolve(text);
},
+ resetSend() { ui.nameResolve = null; },
// DNS resolution takes visible time — say so under the recipient field
// instead of leaving a picked name looking ignored.
sendFormNote(a) {
diff --git a/src/features/zaps.js b/src/features/zaps.js
index d6b2271..7a5f335 100644
--- a/src/features/zaps.js
+++ b/src/features/zaps.js
@@ -464,6 +464,7 @@ export function zapsFeature(ctx) {
begin({ kind: 'npub', pk, eventId: eventId || null }, shortNpub(npub || npubOf(pk)));
return true;
},
+ resetSend() { ui.zap = null; },
sendView() { return zapView(); },
// Settings → Nostr: the one-tap zap amount.
nostrSettingsCards() {
diff --git a/src/recipient-search.js b/src/recipient-search.js
index 20083ee..8d1ae84 100644
--- a/src/recipient-search.js
+++ b/src/recipient-search.js
@@ -252,7 +252,7 @@ export function makeSearcher(onUpdate) {
if (my === seq) onUpdate(q, rows);
}, wait);
},
- clear() { seq++; clearTimeout(timer); onUpdate('', null); },
+ clear(notify = true) { seq++; clearTimeout(timer); if (notify) onUpdate('', null); },
};
}
diff --git a/src/style.css b/src/style.css
index 91b8dd4..f77c7d9 100644
--- a/src/style.css
+++ b/src/style.css
@@ -1224,9 +1224,15 @@ body::after {
border: 0; border-radius: 7px; background: var(--accent-soft); color: var(--muted); cursor: pointer;
}
.amt-max:hover { background: var(--surface2); color: var(--ink); }
-/* recipient chip: large variant for pay/zap screens */
-.zap-chip.lg { gap: 8px; padding: 4px 12px 4px 4px; font-weight: 600; }
-.chat-avatar.chip-lg { width: 30px; height: 30px; font-size: 11px; flex-shrink: 0; }
+/* The selected person leads the payment form, with their name below. */
+.send-person {
+ display: flex; flex-direction: column; align-items: center; align-self: center;
+ max-width: 100%; gap: 12px; padding: 12px; border: 0; border-radius: 0;
+ background: transparent; text-align: center; font-size: 18px; font-weight: 650;
+ overflow-wrap: anywhere;
+}
+.send-person:hover { background: transparent; }
+.chat-avatar.send-avatar { width: 96px; height: 96px; font-size: 28px; }
/* the clickable way to change account (swiping only helps on touch) */
.balance-switch {
display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;