From ea20b96e6c633ff38a5221719a9240f77342f792 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 2 Oct 2026 09:40:22 -0700 Subject: Profile npub: full and monospace again, behind a Public key link The truncated key button took a whole row on every profile. A "Public key" link now ends the Following/Followers line; it reveals the npub in full, monospace, tap to copy, and hides it again. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Dmcrt9KyNDKVWFKnb8BREo --- src/features/messages.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/features') diff --git a/src/features/messages.js b/src/features/messages.js index 8c01cbe..2b8365b 100644 --- a/src/features/messages.js +++ b/src/features/messages.js @@ -3145,7 +3145,7 @@ export function messagesFeature(ctx) { // for the other direction (a note row tapped on a profile page). ui.profOverThread = !!ui.noteThread; ui.profEdit = null; ui.profEditFilled = false; ui.logoutConfirm = null; ui.profCompose = null; - ui.profPeople = null; + ui.profPeople = null; ui.npubShown = null; render(); try { window.scrollTo(0, 0); } catch {} fetchFullProfile(pk); @@ -4580,9 +4580,14 @@ export function messagesFeature(ctx) { type: 'button', class: 'social-count' + (ui.profPeople === which ? ' on' : ''), 'aria-expanded': String(ui.profPeople === which), onClick: () => pick(which), }, h('b', {}, n == null ? '–' : compactNum(n)), ' ', label); + const shown = ui.npubShown === pk; return h('div', { class: 'row social-line' }, btn('following', follows, t('profFollowing')), - btn('followers', c?.followers, t('profFollowers'))); + btn('followers', c?.followers, t('profFollowers')), + h('button', { + type: 'button', class: 'social-count npub-toggle' + (shown ? ' on' : ''), style: 'margin-left:auto', 'aria-expanded': String(shown), + onClick: () => { ui.npubShown = shown ? null : pk; render(); }, + }, t('profKeyLink'))); } function socialList(pk) { const which = ui.profPeople; @@ -8141,18 +8146,13 @@ export function messagesFeature(ctx) { : null, ui.profEdit ? null : socialLine(pk), ui.profEdit ? null : socialList(pk), - // A readable public-ID preview; copying always uses the full npub. - // It only steps aside while the (long) edit form is open. - ui.profEdit ? null : h('button', { - type: 'button', class: 'profile-key', title: npub, - 'aria-label': t('copy') + ': ' + t('profPublicKey'), + // The npub in full, monospace, tap to copy — behind the "Public key" + // link on the line above, so it costs no room until it's asked for. + ui.profEdit || ui.npubShown !== pk ? null : h('button', { + type: 'button', class: 'addr-box break npub-box', title: t('copy'), + style: 'font-size:11px;cursor:pointer;text-align:left;width:100%', onClick: async () => { try { await navigator.clipboard.writeText(npub); toast(t('copied')); } catch {} }, - }, - h('span', { class: 'profile-key-content' }, - h('span', { class: 'profile-key-label' }, t('profPublicKey')), - h('bdi', { class: 'profile-key-value', dir: 'ltr' }, npub.slice(0, 12) + '…' + npub.slice(-8))), - h('span', { class: 'profile-key-copy', 'aria-hidden': 'true', html: - '' })), + }, npub), ui.profEdit ? h('div', { class: 'col', style: 'gap:8px' }, // the username IS the payment address and NIP-05 — the frozen -- cgit v1.2.3