aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-09-28 10:02:55 -0700
committerAdam Soltys <[email protected]>2026-09-28 10:02:55 -0700
commit1369f2ecc80c30df32dd8f6c5e2edcc70ee864b3 (patch)
tree5988fbe00452397b2b91cb465e46bef2252f42ea /src
parent83aa57add3be62cb38acb1612ff6257a2996972f (diff)
downloadcoinosv3-1369f2ecc80c30df32dd8f6c5e2edcc70ee864b3.tar.gz
coinosv3-1369f2ecc80c30df32dd8f6c5e2edcc70ee864b3.zip
Zap settings opened from a hold return the reader to their place in the feed.
The settings screen replaces the page, and the page came back at its top; the scroll position is remembered on opening and put back on Save, Save and zap, and Back. The feed's windowing mounts the rows for that place. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01VhUKyXKtsJ67QAFfb7QR9D
Diffstat (limited to 'src')
-rw-r--r--src/features/messages.js22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/features/messages.js b/src/features/messages.js
index 945f01e..b53d321 100644
--- a/src/features/messages.js
+++ b/src/features/messages.js
@@ -5610,9 +5610,21 @@ export function messagesFeature(ctx) {
// the main action, zapping this note with the new amount the second.
function openZapSettings(pk, id, origin) {
const cur = ctx.zapDefaultSat ? ctx.zapDefaultSat() : 0;
- ui.zapSetup = { pk, npub: npubOf(pk), eventId: id, amount: String(cur || 21), origin, edit: true, sound: zapSoundOn() };
+ let scrollY = 0; try { scrollY = window.scrollY || 0; } catch {}
+ // the reader's place in the feed, to return to: the settings screen
+ // replaces the page, and the page comes back at its top otherwise
+ ui.zapSetup = { pk, npub: npubOf(pk), eventId: id, amount: String(cur || 21), origin, edit: true, sound: zapSoundOn(), scrollY };
render();
}
+ // Leave the zap settings the way they were opened: the page repaints,
+ // then the window is put back where the reader was (the feed's windowing
+ // mounts the rows for that place on the scroll).
+ function closeZapSetup() {
+ const y = ui.zapSetup && ui.zapSetup.scrollY;
+ ui.zapSetup = null;
+ render();
+ if (y) { try { window.scrollTo(0, y); } catch {} }
+ }
// First ⚡ tap ever: pick the amount one time, then every zap is one tap.
function zapSetupScreen() {
@@ -5628,8 +5640,7 @@ export function messagesFeature(ctx) {
const n = saved();
if (!n) return;
const { pk, npub, eventId } = s;
- ui.zapSetup = null;
- render();
+ closeZapSetup();
markZapPending(eventId, n, s.origin);
if (!hook('zapNpub', pk, npub, eventId, n) && !hook('lnZapNpub', pk, npub, eventId, n)) {
settleZap(eventId, false);
@@ -5640,9 +5651,8 @@ export function messagesFeature(ctx) {
const saveOnly = () => {
const n = saved();
if (!n) return;
- ui.zapSetup = null;
toast('⚡ ' + t('zapAmountSaved', { n: n.toLocaleString() }));
- render();
+ closeZapSetup();
};
return h('div', { class: 'col', style: 'gap:16px' },
ctx.brandHeader(false),
@@ -5659,7 +5669,7 @@ export function messagesFeature(ctx) {
? [h('button', { class: 'btn-primary btn-block', onClick: saveOnly }, t('save')),
h('button', { class: 'btn-ghost btn-block', onClick: saveAndZap }, t('zapSetupSave'))]
: h('button', { class: 'btn-primary btn-block', onClick: saveAndZap }, t('zapSetupSave'))),
- h('button', { class: 'btn-ghost btn-block', onClick: () => { ui.zapSetup = null; render(); } }, t('back')));
+ h('button', { class: 'btn-ghost btn-block', onClick: closeZapSetup }, t('back')));
}
// One post as a feed row (avatar · name · time · body), twitter/jumble