From a4d331533ec009397c2957ff2513797ae22fe51d Mon Sep 17 00:00:00 2001 From: Mike Dilger Date: Tue, 17 Jan 2023 13:58:26 +1300 Subject: [PATCH] layout relay page differently so the scrollable area is less likely to have no room --- src/ui/relays.rs | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/src/ui/relays.rs b/src/ui/relays.rs index 655c5f8d..89b3a16d 100644 --- a/src/ui/relays.rs +++ b/src/ui/relays.rs @@ -50,17 +50,30 @@ pub(super) fn update(app: &mut GossipUi, _ctx: &Context, _frame: &mut eframe::Fr .map(|r| r.to_owned()) .collect(); - ui.add_space(32.0); + ui.horizontal(|ui| { + ui.set_max_height(0.0); // tries to be as short as possible - ui.heading("Connected to:"); + ui.with_layout(Layout::top_down(Align::Min), |ui| { + ui.heading("Connected to:"); + for url in GLOBALS.relays_watching.blocking_read().iter() { + ui.label(url.inner()); + } + }); - for url in GLOBALS.relays_watching.blocking_read().iter() { - ui.label(url.inner()); - } + ui.add_space(12.0); + ui.separator(); + ui.add_space(12.0); - ui.add_space(10.0); - ui.separator(); - ui.add_space(10.0); + ui.with_layout(Layout::top_down(Align::Min), |ui| { + ui.heading("Writing to:"); + for relay in postrelays.iter() { + render_relay(ui, relay, true); + ui.add_space(3.0); + ui.separator(); + ui.add_space(3.0); + } + }); + }); ui.with_layout(Layout::bottom_up(Align::Center), |ui| { if ui.button("SAVE CHANGES").clicked() { @@ -68,15 +81,6 @@ pub(super) fn update(app: &mut GossipUi, _ctx: &Context, _frame: &mut eframe::Fr } ui.with_layout(Layout::top_down(Align::Center), |ui| { - ui.heading("Your Relays (write):"); - - for relay in postrelays.iter() { - render_relay(ui, relay, true); - ui.add_space(3.0); - ui.separator(); - ui.add_space(3.0); - } - ui.heading("Other Known Relays:"); ScrollArea::vertical().show(ui, |ui| { @@ -91,6 +95,10 @@ pub(super) fn update(app: &mut GossipUi, _ctx: &Context, _frame: &mut eframe::Fr }); }); }); + + ui.add_space(10.0); + ui.separator(); + ui.add_space(10.0); } fn render_relay(ui: &mut Ui, relay: &DbRelay, bold: bool) {