From 9ec7c80792dbb12fad33f8c32815ca4ca5c2753f Mon Sep 17 00:00:00 2001 From: Mike Dilger Date: Sat, 24 Dec 2022 20:59:29 +1300 Subject: [PATCH] Start of showing relays and connect button (we also need to know if we are already connected) --- src/ui/relays.rs | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/ui/relays.rs b/src/ui/relays.rs index 5cca5e0c..54633deb 100644 --- a/src/ui/relays.rs +++ b/src/ui/relays.rs @@ -1,7 +1,29 @@ use super::GossipUi; +use crate::globals::GLOBALS; use eframe::egui; -use egui::{Context, Ui}; +use egui::{Align, Context, Layout, ScrollArea, Ui}; pub(super) fn update(_app: &mut GossipUi, _ctx: &Context, _frame: &mut eframe::Frame, ui: &mut Ui) { - ui.label("RELAYS PAGE - Coming Soon".to_string()); + ui.add_space(8.0); + ui.heading("Relays known"); + ui.add_space(18.0); + + let relays = GLOBALS.relays.blocking_lock().clone(); + + ScrollArea::vertical().show(ui, |ui| { + for (_, relay) in relays.iter() { + ui.horizontal(|ui| { + ui.label(&relay.url); + + ui.with_layout(Layout::right_to_left(Align::Center), |ui| { + if ui.button("CONNECT").clicked() { + ui.label("TBD"); + } + }); + }); + + ui.add_space(12.0); + ui.separator(); + } + }); }