aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/features/messages.js18
-rw-r--r--src/i18n.js1
2 files changed, 18 insertions, 1 deletions
diff --git a/src/features/messages.js b/src/features/messages.js
index 3bccd31..64e36c5 100644
--- a/src/features/messages.js
+++ b/src/features/messages.js
@@ -8385,6 +8385,21 @@ export function messagesFeature(ctx) {
// Your own posts and messages too: a zap to yourself is a harmless
// round-trip, and one bar that behaves the same everywhere beats a special case.
const canZapPk = (pk) => !!pk && !isVisitor() && !!(hook('arkReady') || hook('canLnZap')); // a visitor's tap asks them in instead
+ // A locked wallet — the watch-only view of a sealed vault, or an identity
+ // signed in over one — has no keys to pay with. The tap says so and opens
+ // the Accounts page (the padlock, and the way to add the wallet, are
+ // there); the feed is remembered for the way back. It used to do nothing
+ // at all: the button pressed, the cursor an arrow.
+ function zapLockedAsk() {
+ toast('\u{1F512} ' + t('zapLocked'), 4000);
+ // the open feed, for the way back: by its URL when it has one, by its
+ // id otherwise (Following lives at no address)
+ const def = ui.chatOpen && ui.msgView === 'feed' ? feedDef() : null;
+ const back = def ? feedPath(def) || 'feed:' + def.id : null;
+ try { sessionStorage.setItem(RETURN_KEY, back || location.pathname + location.search); } catch {}
+ ui.screen = 'accounts';
+ render();
+ }
function zapNote(pk, ev, origin) {
const npubStr = npubOf(pk);
const def = ctx.zapDefaultSat ? ctx.zapDefaultSat() : 0;
@@ -9594,7 +9609,7 @@ export function messagesFeature(ctx) {
// always in the bar — the same row of buttons on every post, so nothing
// shifts when a wallet comes online; without one it is just the number
btn(I_ZAP, zapLabel, zapSats ? fmtSats(zapSats) : 0, zapMine,
- (zapHold && zapHold.onClick) || (isVisitor() ? () => signinAsk() : null),
+ (zapHold && zapHold.onClick) || (isVisitor() ? () => signinAsk() : wallet.watchOnly ? zapLockedAsk : null),
'note-zap' + (zapMine ? ' zapped' : '') + (zapFlying ? ' flying' : ''),
zapHold && { ...zapHold, onClick: undefined }),
// who did all that: a small chevron, always in place — dimmed until
@@ -11068,6 +11083,7 @@ export function messagesFeature(ctx) {
if (!back) return;
setTimeout(() => {
try {
+ if (back.startsWith('feed:')) { showFeed(back.slice(5)); render(); return; }
const [path, q] = back.split('?');
if (/^\/feed(\/|$)/i.test(path)) { openFeedUrl(path.replace(/^\/feed\/?/i, ''), q ? '?' + q : ''); return; }
const pk = parseNostrPubkey(path.replace(/^\//, ''));
diff --git a/src/i18n.js b/src/i18n.js
index 7488821..8d014a6 100644
--- a/src/i18n.js
+++ b/src/i18n.js
@@ -528,6 +528,7 @@ const STR = {
msgNoIdentity: "Your nostr signer isn't connected. Reconnect it to send as yourself",
msgSendFailed: 'No relay accepted the message',
msgLockedChat: 'Your wallet is locked, so it can’t sign messages.',
+ zapLocked: 'Your wallet is locked, so it can’t zap. Unlock it to send sats.',
noteRefLink: 'view note',
noteRefLoading: 'Fetching note…',
noteRefNotFound: "Couldn't find that note on the relays.",