aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-08-03 12:31:05 -0700
committerAdam Soltys <[email protected]>2026-08-03 12:31:05 -0700
commit444d01d69e0a30659fc769a57fe5e070ef025b2e (patch)
tree72766446f32d79b66b0f1f9b537bca3b1ed31ff9
parent4d09a091d0aa6a63860260637feddc1e11bed708 (diff)
downloadcoinosv3-444d01d69e0a30659fc769a57fe5e070ef025b2e.tar.gz
coinosv3-444d01d69e0a30659fc769a57fe5e070ef025b2e.zip
Onboarding: no waiting state before the migration question
The step needed this wallet's payment address for the migrate link, and the background claim often hasn't landed yet when the step appears — so it flashed a spinner first. The page renders complete now; if someone taps before the address exists, the wait happens on the button instead. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Wvj4aoeMZwA7VUGdJP9Swi
-rw-r--r--src/app.js36
-rw-r--r--src/i18n.js1
2 files changed, 25 insertions, 12 deletions
diff --git a/src/app.js b/src/app.js
index 4eeae3f..c528fd7 100644
--- a/src/app.js
+++ b/src/app.js
@@ -2050,23 +2050,35 @@ function onboardScreen() {
const title = (txt) => h('h2', { class: 'onb-title' }, txt);
if (o.step === 'legacy') {
- const addr = featureHook('namesAddress');
- const url = addr
- ? `https://coinos.io/migrate?to=${encodeURIComponent(addr)}&back=${encodeURIComponent(location.origin + '/')}`
- : null;
+ // The migrate link carries this wallet's payment address, which the
+ // background claim may still be minting. Don't make the user watch that:
+ // show the finished page and wait (on the button) only if they tap
+ // before it lands.
+ const goLegacy = async () => {
+ let addr = featureHook('namesAddress');
+ if (!addr) {
+ o.legacyBusy = true;
+ render();
+ for (let i = 0; i < 40 && !addr; i++) {
+ await new Promise((r) => setTimeout(r, 500));
+ addr = featureHook('namesAddress');
+ }
+ o.legacyBusy = false;
+ if (!addr) { ui.onbError = t('onbLegacyNoAddr'); render(); return; }
+ }
+ o.wentToLegacy = true;
+ location.href = `https://coinos.io/migrate?to=${encodeURIComponent(addr)}&back=${encodeURIComponent(location.origin + '/')}`;
+ };
return page([
title(t('onbLegacyTitle')),
h('p', { class: 'muted', style: 'margin:0' }, t('onbLegacyBody')),
- url
- ? h('a', {
- class: 'btn btn-primary btn-block', href: url,
- style: 'text-align:center;display:block;text-decoration:none;padding:14px',
- onClick: () => { o.wentToLegacy = true; },
- }, t('onbLegacyGo'))
- : h('div', { class: 'row gap6', style: 'align-items:center' },
- h('span', { class: 'spinner sm' }), h('span', { class: 'small muted' }, t('onbNameWait'))),
+ h('button', {
+ class: 'btn-primary btn-block', style: 'padding:14px',
+ disabled: !!o.legacyBusy, onClick: goLegacy,
+ }, o.legacyBusy ? h('span', { class: 'spinner sm' }) : t('onbLegacyGo')),
h('button', { class: 'btn-block', style: 'padding:14px', onClick: () => { o.step = 'username'; render(); } },
o.wentToLegacy ? t('onbLegacyDone') : t('onbLegacyNo')),
+ ui.onbError ? h('div', { class: 'notice err' }, ui.onbError) : null,
h('button', { class: 'linklike small', onClick: () => { o.step = 'nostr'; render(); } }, t('back')),
]);
}
diff --git a/src/i18n.js b/src/i18n.js
index 4474b63..898abaa 100644
--- a/src/i18n.js
+++ b/src/i18n.js
@@ -496,6 +496,7 @@ const STR = {
onbLegacyTitle: 'Do you have an account on coinos.io?',
onbLegacyBody: 'The original coinos. We can move your balance over and bring your username with you — your old account gets renamed and stops receiving.',
onbLegacyGo: 'Move my coinos.io account',
+ onbLegacyNoAddr: "Your payment address isn't ready yet — try again in a moment.",
onbLegacyDone: "I'm done — continue",
onbLegacyNo: "No, I'm new here",
migrateClaimed: 'Welcome back — {name} is yours here now.',