From c3d6c31acaacef7cc36d0b6ae6b14d058d2f4d42 Mon Sep 17 00:00:00 2001 From: 2ro <17595647+2ro@users.noreply.github.com> Date: Sun, 5 Jul 2026 23:52:59 -0400 Subject: [PATCH] goblin: one-toggle add-identity sheet, kill the dead Generate button (Build 148) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The add sheet's "Generate new" was a mode toggle that set import=false — the mode the sheet already opens in — so it read as a completely dead button, and the four-button layout (Generate new / Import / Cancel / Add) mixed two silent mode toggles with two actions. The sheet now DEFAULTS to generate mode with a one-line note saying a fresh anonymous key will be created; the standalone "Generate new" button is gone. One clear toggle sits above the action row and always names the OTHER mode: "Import an existing identity instead" switches to import mode (revealing the .backup picker and nsec paste inputs), where it becomes "Create a new key instead" to switch back. The action row stays exactly Cancel + Add — Add creates a fresh identity in generate mode and imports in import mode — keeping the 147 modal-lock, uniform-button and CenterTop conventions. The old generate/import toggle labels are removed from all six locales and the new generate_note / import_instead / generate_instead strings added; drift green. --- locales/de.yml | 5 +-- locales/en.yml | 5 +-- locales/fr.yml | 5 +-- locales/ru.yml | 5 +-- locales/tr.yml | 5 +-- locales/zh-CN.yml | 5 +-- src/gui/views/goblin/mod.rs | 72 ++++++++++++------------------------- 7 files changed, 40 insertions(+), 62 deletions(-) diff --git a/locales/de.yml b/locales/de.yml index a3c38801..3c1593e1 100644 --- a/locales/de.yml +++ b/locales/de.yml @@ -685,9 +685,10 @@ goblin: held: "Vorhandene Identitäten" add: "Identität hinzufügen" add_title: "Eine Identität hinzufügen" - generate: "Neu erzeugen" - import: "Importieren" nsec_hint: "Nsec einfügen" + generate_note: "Ein neuer, anonymer Schlüssel wird für diese Wallet erstellt." + import_instead: "Stattdessen eine bestehende Identität importieren" + generate_instead: "Stattdessen einen neuen Schlüssel erstellen" choose_backup: "Eine .backup-Datei wählen" backup_selected: "Backup-Datei ausgewählt" delete_short: "Identität löschen" diff --git a/locales/en.yml b/locales/en.yml index aa2b3da2..e4b3945e 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -685,9 +685,10 @@ goblin: held: "Held identities" add: "Add identity" add_title: "Add an identity" - generate: "Generate new" - import: "Import" nsec_hint: "Paste an nsec" + generate_note: "A fresh, anonymous key will be created for this wallet." + import_instead: "Import an existing identity instead" + generate_instead: "Create a new key instead" choose_backup: "Choose a .backup file" backup_selected: "Backup file selected" delete_short: "Delete identity" diff --git a/locales/fr.yml b/locales/fr.yml index c1094bb6..041dc848 100644 --- a/locales/fr.yml +++ b/locales/fr.yml @@ -685,9 +685,10 @@ goblin: held: "Identités détenues" add: "Ajouter une identité" add_title: "Ajouter une identité" - generate: "En générer une" - import: "Importer" nsec_hint: "Coller un nsec" + generate_note: "Une nouvelle clé anonyme sera créée pour ce portefeuille." + import_instead: "Importer plutôt une identité existante" + generate_instead: "Créer plutôt une nouvelle clé" choose_backup: "Choisir un fichier .backup" backup_selected: "Fichier de sauvegarde sélectionné" delete_short: "Supprimer l'identité" diff --git a/locales/ru.yml b/locales/ru.yml index 8a70c860..5ed8b7c4 100644 --- a/locales/ru.yml +++ b/locales/ru.yml @@ -685,9 +685,10 @@ goblin: held: "Имеющиеся личности" add: "Добавить личность" add_title: "Добавить личность" - generate: "Создать новую" - import: "Импорт" nsec_hint: "Вставьте nsec" + generate_note: "Для этого кошелька будет создан новый анонимный ключ." + import_instead: "Вместо этого импортировать существующую личность" + generate_instead: "Вместо этого создать новый ключ" choose_backup: "Выбрать файл .backup" backup_selected: "Файл резервной копии выбран" delete_short: "Удалить личность" diff --git a/locales/tr.yml b/locales/tr.yml index c030eccd..2abcc46e 100644 --- a/locales/tr.yml +++ b/locales/tr.yml @@ -685,9 +685,10 @@ goblin: held: "Mevcut kimlikler" add: "Kimlik ekle" add_title: "Bir kimlik ekle" - generate: "Yeni oluştur" - import: "İçe aktar" nsec_hint: "Bir nsec yapıştır" + generate_note: "Bu cüzdan için yeni, anonim bir anahtar oluşturulacak." + import_instead: "Bunun yerine mevcut bir kimliği içe aktar" + generate_instead: "Bunun yerine yeni bir anahtar oluştur" choose_backup: "Bir .backup dosyası seç" backup_selected: "Yedek dosyası seçildi" delete_short: "Kimliği sil" diff --git a/locales/zh-CN.yml b/locales/zh-CN.yml index 42cf8be5..edffc485 100644 --- a/locales/zh-CN.yml +++ b/locales/zh-CN.yml @@ -685,9 +685,10 @@ goblin: held: "已持有的身份" add: "添加身份" add_title: "添加一个身份" - generate: "新建" - import: "导入" nsec_hint: "粘贴 nsec" + generate_note: "将为此钱包创建一个全新的匿名密钥。" + import_instead: "改为导入现有身份" + generate_instead: "改为创建新密钥" choose_backup: "选择 .backup 文件" backup_selected: "已选择备份文件" delete_short: "删除身份" diff --git a/src/gui/views/goblin/mod.rs b/src/gui/views/goblin/mod.rs index 43608f78..1d589da0 100644 --- a/src/gui/views/goblin/mod.rs +++ b/src/gui/views/goblin/mod.rs @@ -5089,57 +5089,15 @@ impl GoblinWalletView { .color(t.surface_text), ); ui.add_space(8.0); - // Generate vs import toggle: two equal-width in-panel buttons, - // matching the Cancel/Add row below. `big_action_on_card_ink` - // sizes to `ui.available_width()`, so each must be constrained - // to half the panel — otherwise the first button eats the whole - // width and the second (Import) overflows the card. - ui.horizontal(|ui| { - let half = (ui.available_width() - 10.0) / 2.0; - ui.scope_builder( - egui::UiBuilder::new().max_rect(egui::Rect::from_min_size( - ui.cursor().min, - Vec2::new(half, 44.0), - )), - |ui| { - if w::big_action_on_card_ink( - ui, - &t!("goblin.identities.generate"), - if self.identity_switch.import { - t.surface_text - } else { - t.pos - }, - ) - .clicked() - { - self.identity_switch.import = false; - } - }, + // The sheet defaults to GENERATE (a fresh anonymous key). What + // generating means, in one line, so the default mode isn't blank. + if !self.identity_switch.import { + ui.label( + RichText::new(t!("goblin.identities.generate_note")) + .font(FontId::new(12.5, fonts::regular())) + .color(t.surface_text_dim), ); - ui.add_space(10.0); - ui.scope_builder( - egui::UiBuilder::new().max_rect(egui::Rect::from_min_size( - ui.cursor().min, - Vec2::new(half, 44.0), - )), - |ui| { - if w::big_action_on_card_ink( - ui, - &t!("goblin.identities.import"), - if self.identity_switch.import { - t.pos - } else { - t.surface_text - }, - ) - .clicked() - { - self.identity_switch.import = true; - } - }, - ); - }); + } if self.identity_switch.import { ui.add_space(8.0); // (a) Select a .backup file. Desktop returns the path now; @@ -5202,6 +5160,20 @@ impl GoblinWalletView { }); } ui.add_space(10.0); + // ONE mode toggle instead of the old Generate/Import pair (whose + // "Generate new" half was the already-active default and read as + // a dead button). Tapping switches the sheet's mode, revealing or + // hiding the import inputs; the label always names the OTHER mode. + let toggle_label = if self.identity_switch.import { + t!("goblin.identities.generate_instead") + } else { + t!("goblin.identities.import_instead") + }; + if w::big_action_on_card(ui, &toggle_label).clicked() { + self.identity_switch.import = !self.identity_switch.import; + self.identity_switch.error.clear(); + } + ui.add_space(10.0); let import = self.identity_switch.import; // Generate is always ready; import needs either a selected // .backup or a pasted nsec. The password is entered in the modal.