mirror of
https://code.gri.mw/GUI/grim.git
synced 2026-07-15 11:18:55 +00:00
goblin: one-toggle add-identity sheet, kill the dead Generate button (Build 148)
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.
This commit is contained in:
+3
-2
@@ -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"
|
||||
|
||||
+3
-2
@@ -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"
|
||||
|
||||
+3
-2
@@ -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é"
|
||||
|
||||
+3
-2
@@ -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: "Удалить личность"
|
||||
|
||||
+3
-2
@@ -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"
|
||||
|
||||
+3
-2
@@ -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: "删除身份"
|
||||
|
||||
+22
-50
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user