diff --git a/src/overlord/mod.rs b/src/overlord/mod.rs index eb1e7dfa..d79c2a50 100644 --- a/src/overlord/mod.rs +++ b/src/overlord/mod.rs @@ -294,7 +294,7 @@ impl Overlord { // FIXME: Handle EventKind::ContactList } } - "minion_is_ready" => {}, + "minion_is_ready" => {} "save_settings" => { let settings: Settings = serde_json::from_str(&bus_message.json_payload)?; @@ -305,7 +305,7 @@ impl Overlord { *GLOBALS.settings.lock().await = settings; debug!("Settings saved."); - }, + } _ => {} }, _ => {} diff --git a/src/ui/mod.rs b/src/ui/mod.rs index 842c6e90..8206e53e 100644 --- a/src/ui/mod.rs +++ b/src/ui/mod.rs @@ -111,7 +111,7 @@ impl GossipUi { icon: icon_texture_handle, placeholder_avatar: placeholder_avatar_texture_handle, draft: "".to_owned(), - settings: settings, + settings, } } } diff --git a/src/ui/people.rs b/src/ui/people.rs index abe77eb6..4a57d318 100644 --- a/src/ui/people.rs +++ b/src/ui/people.rs @@ -1,7 +1,35 @@ use super::GossipUi; +use crate::globals::GLOBALS; use eframe::egui; -use egui::{Context, Ui}; +use egui::{Context, RichText, ScrollArea, TextStyle, Ui}; pub(super) fn update(_app: &mut GossipUi, _ctx: &Context, _frame: &mut eframe::Frame, ui: &mut Ui) { - ui.label("PEOPLE PAGE - Coming Soon".to_string()); + ui.add_space(8.0); + ui.heading("People Followed"); + ui.add_space(18.0); + + let people = GLOBALS.people.blocking_lock().clone(); + + ScrollArea::vertical().show(ui, |ui| { + for (_, person) in people.iter() { + if person.followed != 1 { + continue; + } + + ui.label(&person.pubkey.0); + + ui.label( + RichText::new(person.name.as_deref().unwrap_or("")) + .text_style(TextStyle::Name("Bold".into())), + ); + + ui.label(person.about.as_deref().unwrap_or("")); + + ui.label(person.dns_id.as_deref().unwrap_or("")); + + ui.add_space(12.0); + + ui.separator(); + } + }); } diff --git a/src/ui/settings.rs b/src/ui/settings.rs index bf741711..dd51b134 100644 --- a/src/ui/settings.rs +++ b/src/ui/settings.rs @@ -1,9 +1,9 @@ -use crate::GLOBALS; -use crate::comms::BusMessage; use super::GossipUi; +use crate::comms::BusMessage; +use crate::GLOBALS; use eframe::egui; -use egui::{Align, Context, Layout, Ui}; use egui::widgets::{Button, Slider}; +use egui::{Align, Context, Layout, Ui}; pub(super) fn update( app: &mut GossipUi, @@ -40,8 +40,13 @@ pub(super) fn update( ui.add_space(24.0); ui.heading("What Posts to Include"); - ui.checkbox(&mut app.settings.view_posts_referred_to, "View posts referred to by people you follow (not yet implemented)") - .on_hover_text("Recommended, otherwise it's hard to understand what the person is talking about."); + ui.checkbox( + &mut app.settings.view_posts_referred_to, + "View posts referred to by people you follow (not yet implemented)", + ) + .on_hover_text( + "Recommended, otherwise it's hard to understand what the person is talking about.", + ); ui.checkbox(&mut app.settings.view_posts_referring_to, "View posts referring to posts by people you follow (not yet implemented)") .on_hover_text("Not recommended, as anyone can reply to them and you'll certainly encounter spam this way."); @@ -49,8 +54,11 @@ pub(super) fn update( ui.add_space(24.0); ui.heading("Miscellaneous"); - ui.checkbox(&mut app.settings.autofollow, "Autofollow everybody (not yet implemented)") - .on_hover_text("Definately not recommended. In fact we may remove this soon."); + ui.checkbox( + &mut app.settings.autofollow, + "Autofollow everybody (not yet implemented)", + ) + .on_hover_text("Definately not recommended. In fact we may remove this soon."); ui.add_space(24.0); ui.heading("Style"); @@ -85,15 +93,13 @@ pub(super) fn update( let _ = tx.send(BusMessage { target: "overlord".to_string(), kind: "save_settings".to_string(), - json_payload: serde_json::to_string(&app.settings).unwrap() + json_payload: serde_json::to_string(&app.settings).unwrap(), }); } }); - } fn secs_to_string(secs: u64) -> String { - let days = secs / 86400; let remainder = secs % 86400; let hours = remainder / 3600; @@ -101,9 +107,15 @@ fn secs_to_string(secs: u64) -> String { let minutes = remainder / 60; let seconds = remainder % 60; let mut output: String = String::new(); - if days>0 { output.push_str(&format!(" {} days", days)); } - if hours>0 { output.push_str(&format!(" {} hours", hours)); } - if minutes>0 { output.push_str(&format!(" {} minutes", minutes)); } + if days > 0 { + output.push_str(&format!(" {} days", days)); + } + if hours > 0 { + output.push_str(&format!(" {} hours", hours)); + } + if minutes > 0 { + output.push_str(&format!(" {} minutes", minutes)); + } output.push_str(&format!(" {} seconds", seconds)); output }