From fdb3b28d37a6b95ab32457fc4cd42b97efa140d5 Mon Sep 17 00:00:00 2001 From: Mike Dilger Date: Wed, 25 Oct 2023 07:57:38 +1300 Subject: [PATCH] person page: enable the Priority button --- gossip-bin/src/ui/people/person.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gossip-bin/src/ui/people/person.rs b/gossip-bin/src/ui/people/person.rs index 330f9659..153c2deb 100644 --- a/gossip-bin/src/ui/people/person.rs +++ b/gossip-bin/src/ui/people/person.rs @@ -379,7 +379,17 @@ fn content(app: &mut GossipUi, ctx: &Context, ui: &mut Ui, pubkey: PublicKey, pe app.theme.accent_button_2_style(ui.style_mut()); // restore style } ui.add_space(BTN_SPACING); - ui.add(egui::Button::new("Add to Priority").min_size(MIN_SIZE).rounding(BTN_ROUNDING)); + if !on_list { + if ui.add(egui::Button::new("Add to Priority").min_size(MIN_SIZE).rounding(BTN_ROUNDING)).clicked() { + let _ = GLOBALS.storage.add_person_to_list(&person.pubkey, PersonList::Custom(2), true, None); + }; + } else { + app.theme.accent_button_danger_hover(ui.style_mut()); + if ui.add(egui::Button::new("Remove from Priority").min_size(MIN_SIZE).rounding(BTN_ROUNDING)).clicked() { + let _ = GLOBALS.storage.remove_person_from_list(&person.pubkey, PersonList::Custom(2), None); + }; + app.theme.accent_button_2_style(ui.style_mut()); // restore style + } ui.add_space(BTN_SPACING); let mute_label = if muted {