Skip to content

Commit

Permalink
A few UI fixes to the wizard
Browse files Browse the repository at this point in the history
  • Loading branch information
mikedilger committed Dec 20, 2024
1 parent d3af9a2 commit 8f56bd5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
15 changes: 2 additions & 13 deletions gossip-bin/src/ui/wizard/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use eframe::egui;
use egui::widgets::{Button, Slider};
use egui::{Align, Context, Layout};
use egui_winit::egui::{vec2, Ui};
use gossip_lib::comms::ToOverlordMessage;
use gossip_lib::{FeedKind, PersonList, PersonTable, Relay, RunState, Table, GLOBALS};
use nostr_types::RelayUrl;

Expand Down Expand Up @@ -303,21 +302,11 @@ fn complete_wizard(app: &mut GossipUi, ctx: &Context) {
}
}

fn modify_relay<M>(relay_url: &RelayUrl, mut modify: M)
fn modify_relay<M>(relay_url: &RelayUrl, modify: M)
where
M: FnMut(&mut Relay),
{
// Load relay record
let mut relay = GLOBALS.db().read_or_create_relay(relay_url, None).unwrap();
let old = relay.clone();

// Run modification
modify(&mut relay);

// Save relay via the Overlord, so minions can be updated
let _ = GLOBALS
.to_overlord
.send(ToOverlordMessage::UpdateRelay(old, relay));
let _ = GLOBALS.db().modify_relay(relay_url, modify, None);
}

fn continue_button() -> impl egui::Widget {
Expand Down
3 changes: 2 additions & 1 deletion gossip-bin/src/ui/wizard/welcome_nostr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub(super) fn update(app: &mut GossipUi, ctx: &Context, _frame: &mut eframe::Fra
if app.wizard_state.has_private_key {
app.wizard_state.generating = false;
app.set_page(ctx, Page::Wizard(WizardPage::SetupRelays));
return;
}

ui.add_space(10.0);
Expand Down Expand Up @@ -57,7 +58,7 @@ pub(super) fn update(app: &mut GossipUi, ctx: &Context, _frame: &mut eframe::Fra

ui.label(""); // empty cell
let text = if ready {
if app.password.is_empty() {
if app.password.is_empty() && !app.wizard_state.generating {
"Your password is empty!"
} else {
""
Expand Down

0 comments on commit 8f56bd5

Please sign in to comment.