diff options
| author | Adam Soltys <[email protected]> | 2026-09-27 08:29:01 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-09-27 08:29:01 -0700 |
| commit | 3da7f9d52dee6a535190cd5e0db152a3689c7e8e (patch) | |
| tree | 59197752b56538cf967c5b33758423c8d92e0eb1 /src | |
| parent | b06bbb48e6c6c7f81a9592ab9562bb8e3042b2b6 (diff) | |
| download | coinosv3-3da7f9d52dee6a535190cd5e0db152a3689c7e8e.tar.gz coinosv3-3da7f9d52dee6a535190cd5e0db152a3689c7e8e.zip | |
Accounts: tapping an identity signs in as it and opens its profile; the padlock moves from the header to this page.
The identity chip used to put the npub in the URL and leave the list on
screen (the profile only paints over the wallet screen). Lock/Unlock now sits
with the other device-wide actions (log out, clear); the padlock tests reach it
through the Accounts page and lose their stale "Wallets" button.
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/app.js | 25 | ||||
| -rw-r--r-- | src/features/messages.js | 7 |
2 files changed, 26 insertions, 6 deletions
@@ -2453,10 +2453,14 @@ function softLock() { toast(t('lockedToast')); } +// Lock (or unlock) the wallets on this device — a row on the Accounts page, +// where the other whole-device actions (log out, clear) live; it used to be +// a header icon, one tap from a mis-tap on every screen. function lockBtn() { + if (!activeAccount()) return null; const locked = wallet.watchOnly && hasVault(); return h('button', { - class: 'header-msgs', + class: 'btn-ghost btn-block', title: locked ? t('unlock') : t('lockWallet'), 'aria-label': locked ? t('unlock') : t('lockWallet'), onClick: locked @@ -2467,7 +2471,7 @@ function lockBtn() { } else { ui.justLocked = false; ui.screen = 'vault'; render(); } } : () => softLock(), - }, h('span', { class: 'hm-ico', style: 'font-size:18px;line-height:1' }, locked ? '\u{1F512}' : '\u{1F513}')); + }, h('span', { style: 'font-size:15px;line-height:1;margin-right:6px' }, locked ? '\u{1F512}' : '\u{1F513}'), locked ? t('unlock') : t('lockWallet')); } // Messages sit one tap away, left of the wallet selector. The dot is presence, @@ -2523,7 +2527,6 @@ function brandHeader(withLock) { searchBtn(), messagesBtn(), settingsBtn(), - lockBtn(), avatarMenu()) : null ); @@ -3056,6 +3059,7 @@ function accountsScreen() { ), h('button', { class: 'btn-block', onClick: () => { ui.addWallet = { kind: 'spending', from: 'new' }; render(); } }, t('addWallet')), h('button', { class: 'btn-block', onClick: signInAnother }, t('signInAnother')), + lockBtn(), activeAccount() ? h('button', { class: 'btn-ghost btn-block', onClick: () => { ui.logoutConfirm = true; render(); } }, t('logout')) : null, hasVault() ? h('button', { class: 'btn-ghost btn-block', onClick: startChangePw }, t('changePassword')) : null, h('button', { class: 'btn-ghost btn-block', onClick: () => { ui.confirmClear = true; render(); } }, t('clearAll')) @@ -3080,10 +3084,23 @@ function groupAccounts() { // Who a group of wallets belongs to: their face and name, and a mark when // it's the identity you're currently using. One identity on the device needs // no heading at all — there's nothing to tell apart. +// Tapping the identity signs you in as it (its first wallet) and opens its +// profile page — the URL used to take the npub while the list stayed put, +// because the profile only paints over the wallet screen. +function openIdentityProfile(pk) { + const g = groupAccounts().find((x) => x.pk === pk); + const first = g && g.rows[0]; + if (first && first.id !== activeId) { + clearFeatureNav(); + activateAccount(first, { fresh: true }); // the screen flip and feature init are synchronous + } else { clearFeatureNav(); ui.screen = 'wallet'; } + featureHook('openProfile', pk); + render(); +} function identityHeading(pk) { if (!pk || groupAccounts().length < 2) return null; const me = ctx.shownPubkey && ctx.shownPubkey(); - const chip = featureHook('profileChip', pk); + const chip = featureHook('profileChip', pk, undefined, () => openIdentityProfile(pk)); return h('div', { class: 'row gap6', style: 'align-items:center;padding:10px 0 4px;border-bottom:1px solid var(--line)', diff --git a/src/features/messages.js b/src/features/messages.js index 06cb6dd..59fb0a5 100644 --- a/src/features/messages.js +++ b/src/features/messages.js @@ -8489,11 +8489,13 @@ export function messagesFeature(ctx) { fieldWhen: { lud16: follows('lud16'), nip05: follows('nip05') }, }).catch(() => {}); }, - profileChip(pk, size) { + // opens the profile, unless the caller has a step to take first (the + // 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' : ''), - onClick: (e) => { e.stopPropagation(); openProfile(pk); }, + onClick: (e) => { e.stopPropagation(); if (onOpen) onOpen(); else openProfile(pk); }, }, avatar(pk, 'chat-avatar ' + (big ? 'chip-lg' : 'mini'), false), h('span', { class: big ? '' : 'small' }, displayName(pk))); }, @@ -8501,6 +8503,7 @@ export function messagesFeature(ctx) { // the same start, but only the follows of an identity that follows // nobody yet — an established nostr user keeps their own list. identitySignedInNew() { setTimeout(() => seedNewIdentity({ onlyIfNoFollows: true }), 0); return true; }, + openProfile(pk) { openProfile(pk); return true; }, init() { const session = ++feedWarmSession; // this wallet's cached faces, from its own namespace — the keys are |
