aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-08-04 00:43:11 -0700
committerAdam Soltys <[email protected]>2026-08-04 00:43:11 -0700
commita247809c5c29f3e1ad2d53ac010f61ac81973583 (patch)
tree35f2a3da1b6eb7d08b5fe5b6499150ab73176ecd
parentdece938e6e4dc1e1ee8afc76be1c3e91282100bf (diff)
downloadcoinosv3-a247809c5c29f3e1ad2d53ac010f61ac81973583.tar.gz
coinosv3-a247809c5c29f3e1ad2d53ac010f61ac81973583.zip
A refresh mid-wizard resumes the step it was on
The wizard mints the wallet on its first step, so 'an account exists' stopped meaning 'wizard done' — reloading dropped you into the half-set-up wallet. Persist the current step until the wizard finishes. Also trims the balance coach-mark copy. Co-Authored-By: Claude Fable 5 <[email protected]>
-rw-r--r--src/app.js22
-rw-r--r--src/i18n.js2
2 files changed, 19 insertions, 5 deletions
diff --git a/src/app.js b/src/app.js
index 7b7fb9a..319fb4c 100644
--- a/src/app.js
+++ b/src/app.js
@@ -2126,6 +2126,14 @@ function vaultScreen() {
// yes/no (sign in or silently mint a wallet), username, avatar, confetti —
// then a three-stop coach-mark tour of the home screen. One time only.
const ONBOARDED_KEY = 'btc-wallet-onboarded';
+// The wizard mints the wallet on its first step, so "an account exists" stops
+// meaning "wizard done". The current step is persisted so a refresh (or the
+// legacy-migration round trip) resumes exactly where it left off instead of
+// dropping into the half-set-up wallet.
+const ONB_STEP_KEY = 'btc-wallet-onb-step';
+function onbInProgress() {
+ try { return !localStorage.getItem(ONBOARDED_KEY) && !!localStorage.getItem(ONB_STEP_KEY); } catch { return false; }
+}
function shouldOnboard() {
try { if (localStorage.getItem(ONBOARDED_KEY)) return false; } catch {}
return !ui.onbSkip && accounts.length === 0 && !hasVault();
@@ -2154,7 +2162,12 @@ async function onbUpload(file) {
}
function onboardScreen() {
- ui.onb ||= { step: 'welcome' };
+ if (!ui.onb) {
+ let saved = null;
+ try { saved = localStorage.getItem(ONB_STEP_KEY); } catch {}
+ ui.onb = { step: saved || 'welcome' };
+ if (saved === 'signin') ui.nostrLoginOpen = true; // reopen the login card
+ }
const o = ui.onb;
// steps that were waiting on something advance the moment it exists
if ((o.step === 'welcome' || o.step === 'signin') && ui.screen === 'wallet' && activeAccount()) {
@@ -2169,6 +2182,7 @@ function onboardScreen() {
// appear. A restored login whose custom name recovers skips ahead too.
if (addr && addr !== o.enterAddr && !/^npub1/.test(addr)) o.step = 'avatar';
}
+ try { localStorage.setItem(ONB_STEP_KEY, o.step); } catch {}
const page = (kids) => h('div', { class: 'col onb', style: 'gap:20px' }, ...kids);
const title = (txt) => h('h2', { class: 'onb-title' }, txt);
@@ -2225,7 +2239,7 @@ function onboardScreen() {
h('span', { style: 'display:flex;flex-shrink:0', html: NOSTR_MARK }),
t('nlSignIn'))),
ui.onbError ? h('div', { class: 'notice err' }, ui.onbError) : null,
- h('button', { class: 'linklike small', onClick: () => { ui.onbSkip = true; ui.onb = null; render(); } }, t('onbHaveWallet')),
+ h('button', { class: 'linklike small', onClick: () => { ui.onbSkip = true; ui.onb = null; try { localStorage.removeItem(ONB_STEP_KEY); } catch {} render(); } }, t('onbHaveWallet')),
]);
}
if (o.step === 'signin') {
@@ -2297,7 +2311,7 @@ function onboardScreen() {
h('div', { class: 'check-badge onb-check' }, '✓'),
h('p', { class: 'muted', style: 'margin:0;text-align:center' }, t('onbDoneBody')),
h('button', { class: 'btn-primary btn-block', style: 'padding:14px', onClick: () => {
- try { localStorage.setItem(ONBOARDED_KEY, '1'); } catch {}
+ try { localStorage.setItem(ONBOARDED_KEY, '1'); localStorage.removeItem(ONB_STEP_KEY); } catch {}
ui.onb = null;
ui.tour = 0;
ui.tab = 'receive';
@@ -2365,7 +2379,7 @@ function tourOverlay() {
}
function walletScreen() {
- if (ui.onb) return onboardScreen();
+ if (ui.onb || onbInProgress()) return onboardScreen();
// A feature can hold the wallet behind a required onboarding step (picking
// a username). Imported wallets skip it once their name is recovered.
const ob = featureHook('onboardingView');
diff --git a/src/i18n.js b/src/i18n.js
index a395518..3ca19e7 100644
--- a/src/i18n.js
+++ b/src/i18n.js
@@ -548,7 +548,7 @@ const STR = {
onbDoneBody: 'Your wallet is ready, your address is live, and the coinos community chat is waiting for you.',
onbEnter: 'Enter coinos',
tourAvatar: 'Your avatar lives here — profile, messages, settings, and logout are all behind it.',
- tourBalance: 'Two balances: Spending is instant and free, Savings is on-chain. Tap to switch — everything follows.',
+ tourBalance: 'Two balances: Spending is instant and free, Savings is on-chain. Tap to switch.',
tourTabs: 'Receive, send, and your history. Tip: swipe left and right to move between them.',
tourNext: 'Next',
tourReplayTitle: 'Tour',