diff options
| author | Adam Soltys <[email protected]> | 2026-10-03 21:47:01 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-10-03 21:47:01 -0700 |
| commit | ef502ae200afd2d280641520819a050389ed5184 (patch) | |
| tree | 7246a0f69da4f7c2e2876c526e8971130744809d | |
| parent | 202dced76eb8617c094686ef86caa979c0074320 (diff) | |
| download | coinosv3-ef502ae200afd2d280641520819a050389ed5184.tar.gz coinosv3-ef502ae200afd2d280641520819a050389ed5184.zip | |
Media pager: tapping the author opens their profile (the pager goes with it)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011bvzKaZosXGHkigcGcSzAR
| -rw-r--r-- | src/features/messages.js | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/features/messages.js b/src/features/messages.js index f77b508..ef4819d 100644 --- a/src/features/messages.js +++ b/src/features/messages.js @@ -9923,6 +9923,10 @@ export function messagesFeature(ctx) { render(); } const closeMediaPager = () => ctx.goBack(() => { ui.mediaPager = null; }); + // Leaving the pager for another page (a profile, sign-in, the zap amount): + // only the feed's own render syncs the pager, and those pages don't paint + // the feed — so the overlay goes now, not on the next feed render. + const leavePager = () => { ui.mediaPager = null; if (pager) dropPager(); }; let pager = null; // the live pager: { el, scroller, kind, keys, cur, loud, io, near, tick } let pagerLoud = true; // sound on, unless the browser said no without a tap function syncMediaPager() { @@ -9967,20 +9971,21 @@ export function messagesFeature(ctx) { media, h('div', { class: 'mp-meta' }, h('div', { class: 'mp-left' }, - h('button', { class: 'mp-author', type: 'button', onClick: stop(() => { ui.mediaPager = null; openProfile(ev.pubkey); }) }, + h('button', { class: 'mp-author', type: 'button', onClick: stop(() => { leavePager(); openProfile(ev.pubkey); }) }, avatar(ev.pubkey, 'chat-avatar mini', false), h('span', {}, displayName(ev.pubkey))), caption ? h('div', { class: 'mp-caption', onClick: stop((e) => e.currentTarget.classList.toggle('open')) }, caption) : null), h('div', { class: 'mp-counts' }, h('button', { class: 'mp-like', type: 'button', 'aria-label': t('postLike'), onClick: stop(() => { - if (signinAsk()) { ui.mediaPager = null; render(); return; } + if (signinAsk()) { leavePager(); render(); return; } (myReactOn(ev.id) ? unreact(ev) : reactTo(ev, '❤️')).catch(() => {}).finally(() => pagerCounts(slide)); setTimeout(() => pagerCounts(slide), 50); }) }, h('span', { class: 'i', html: I_HEART(false) }), h('span', { class: 'n' })), h('button', { class: 'mp-zap', type: 'button', 'aria-label': t('zapTitle'), onClick: stop((e) => { - if (signinAsk()) { ui.mediaPager = null; render(); return; } + if (signinAsk()) { leavePager(); render(); return; } // the first zap ever asks for an amount on a page of its own - if (!(ctx.zapDefaultSat && ctx.zapDefaultSat())) ui.mediaPager = null; - zapNote(ev.pubkey, ev, e.currentTarget.getBoundingClientRect()); + const at = e.currentTarget.getBoundingClientRect(); + if (!(ctx.zapDefaultSat && ctx.zapDefaultSat())) leavePager(); + zapNote(ev.pubkey, ev, at); recheckZap(ev.id); setTimeout(() => pagerCounts(slide), 50); }) }, h('span', { class: 'i', html: I_ZAP }), h('span', { class: 'n' }))))); |
