diff --git a/locales/de.yml b/locales/de.yml index e9670b9d..2968c201 100644 --- a/locales/de.yml +++ b/locales/de.yml @@ -833,6 +833,8 @@ goblin: title: "Richte dein Wallet ein" create_new: "Neu erstellen" restore_from_seed: "Aus Seed wiederherstellen" + import_identity: "Identität importieren" + import_identity_hint: "Nach diesem Schritt bringst du deinen vorhandenen Schlüssel mit (eine .backup-Datei oder nsec)." name_hint: "Wallet-Name" password_hint: "Passwort" repeat_password_hint: "Passwort wiederholen" diff --git a/locales/en.yml b/locales/en.yml index 3030e66e..22a7cc9f 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -833,6 +833,8 @@ goblin: title: "Set up your wallet" create_new: "Create new" restore_from_seed: "Restore from seed" + import_identity: "Import identity" + import_identity_hint: "You'll bring in your existing key (a .backup file or nsec) after this step." name_hint: "Wallet name" password_hint: "Password" repeat_password_hint: "Repeat password" diff --git a/locales/fr.yml b/locales/fr.yml index 312e4340..a13a7219 100644 --- a/locales/fr.yml +++ b/locales/fr.yml @@ -833,6 +833,8 @@ goblin: title: "Configurez votre portefeuille" create_new: "Créer un nouveau" restore_from_seed: "Restaurer depuis la phrase" + import_identity: "Importer une identité" + import_identity_hint: "Vous importerez votre clé existante (un fichier .backup ou un nsec) après cette étape." name_hint: "Nom du portefeuille" password_hint: "Mot de passe" repeat_password_hint: "Répéter le mot de passe" diff --git a/locales/ru.yml b/locales/ru.yml index c161f8be..00b00fb9 100644 --- a/locales/ru.yml +++ b/locales/ru.yml @@ -833,6 +833,8 @@ goblin: title: "Настройте кошелёк" create_new: "Создать новый" restore_from_seed: "Восстановить из seed" + import_identity: "Импорт личности" + import_identity_hint: "После этого шага вы добавите свой существующий ключ (файл .backup или nsec)." name_hint: "Имя кошелька" password_hint: "Пароль" repeat_password_hint: "Повторите пароль" diff --git a/locales/tr.yml b/locales/tr.yml index adfb065f..0f77f991 100644 --- a/locales/tr.yml +++ b/locales/tr.yml @@ -833,6 +833,8 @@ goblin: title: "Cüzdanını kur" create_new: "Yeni oluştur" restore_from_seed: "Tohumdan geri yükle" + import_identity: "Kimliği içe aktar" + import_identity_hint: "Bu adımdan sonra mevcut anahtarını (bir .backup dosyası veya nsec) getireceksin." name_hint: "Cüzdan adı" password_hint: "Parola" repeat_password_hint: "Parolayı tekrarla" diff --git a/locales/zh-CN.yml b/locales/zh-CN.yml index b59b1535..3c4e1303 100644 --- a/locales/zh-CN.yml +++ b/locales/zh-CN.yml @@ -833,6 +833,8 @@ goblin: title: "设置你的钱包" create_new: "新建" restore_from_seed: "从助记词恢复" + import_identity: "导入身份" + import_identity_hint: "此步骤之后,你将导入现有密钥(.backup 文件或 nsec)。" name_hint: "钱包名称" password_hint: "密码" repeat_password_hint: "重复密码" diff --git a/src/gui/views/goblin/onboarding.rs b/src/gui/views/goblin/onboarding.rs index ea1e3cbf..2f5b2fcc 100644 --- a/src/gui/views/goblin/onboarding.rs +++ b/src/gui/views/goblin/onboarding.rs @@ -58,6 +58,11 @@ pub struct OnboardingContent { ext_url: String, /// Wallet setup inputs. restore: bool, + /// The user chose "Import identity" on the wallet step: after the wallet is + /// created the identity step opens the import panel straight away (bringing + /// over an existing key from a `.backup` or nsec), instead of the fresh + /// random key. Composes with either seed choice above it. + want_import: bool, name: String, pass: String, pass2: String, @@ -108,6 +113,7 @@ impl Default for OnboardingContent { integrated: false, ext_url: "https://grincoin.org".to_string(), restore: false, + want_import: false, name: "Main wallet".to_string(), pass: String::new(), pass2: String::new(), @@ -414,6 +420,37 @@ impl OnboardingContent { ui.add_space(10.0); } }); + ui.add_space(10.0); + + // First-class "Import identity" option, standing alongside Create/Restore: + // bring an existing key over (from a .backup file or a bare nsec). It + // composes with either seed choice above — the import panel itself opens + // on the identity step, once the wallet exists. + ui.scope_builder( + egui::UiBuilder::new().max_rect(egui::Rect::from_min_size( + ui.cursor().min, + Vec2::new(ui.available_width(), 44.0), + )), + |ui| { + if w::chip( + ui, + &t!("goblin.onboarding.wallet.import_identity"), + self.want_import, + ) + .clicked() + { + self.want_import = !self.want_import; + } + }, + ); + if self.want_import { + ui.add_space(6.0); + ui.label( + RichText::new(t!("goblin.onboarding.wallet.import_identity_hint")) + .font(FontId::new(12.5, fonts::regular())) + .color(t.text_mute), + ); + } ui.add_space(14.0); w::field_well(ui, |ui| { @@ -864,6 +901,13 @@ impl OnboardingContent { .nostr_service() .map(|s| s.identity.read().nip05.is_some()) .unwrap_or(false); + // Came in via the wallet step's "Import identity" button: open the import + // panel straight away (offers both a .backup file and a bare nsec), rather + // than the fresh-key claim card. + if self.want_import && self.import.is_none() { + self.import = Some(OnbImport::default()); + self.want_import = false; + } if self.import.is_some() { // Returning user is swapping the random key for their existing identity. self.import_ui(ui, &wallet, cb); @@ -946,19 +990,11 @@ impl OnboardingContent { } }); ui.add_space(10.0); - // Returning user? Let them restore their existing identity (nsec or a - // .backup file) instead of claiming a fresh name on the random key. - let import_resp = ui - .add( - egui::Label::new( - RichText::new(t!("goblin.onboarding.identity.import_existing")) - .font(FontId::new(13.0, fonts::semibold())) - .color(t.accent), - ) - .sense(Sense::click()), - ) - .on_hover_cursor(egui::CursorIcon::PointingHand); - if import_resp.clicked() { + // Returning user? A centered, first-class "Import identity" button + // (was a left-aligned text link) restores their existing identity + // from a .backup file or a bare nsec instead of the fresh random key. + // The .backup-or-nsec choice lives behind it, in import_ui. + if w::big_action(ui, &t!("goblin.onboarding.wallet.import_identity"), true).clicked() { self.import = Some(OnbImport::default()); } ui.add_space(16.0);