Profile Page: Fix left margin for sub-headings

This commit is contained in:
Bu5hm4nn 2023-12-26 23:18:05 -06:00
parent edb488a450
commit 541e7433ac

View File

@ -187,57 +187,65 @@ fn content(app: &mut GossipUi, ctx: &Context, ui: &mut Ui, pubkey: PublicKey, pe
}
ui.add_space(10.0);
ui.heading("User lists");
ui.horizontal(|ui|{
ui.add_space(10.0);
ui.heading("User lists");
});
ui.separator();
ui.add_space(10.0);
let all_lists = GLOBALS
.storage
.get_all_person_list_metadata()
.unwrap_or_default();
if let Ok(membership_map) = GLOBALS.storage.read_person_lists(&pubkey) {
for (list, metadata) in all_lists {
ui.horizontal(|ui| {
let membership = membership_map.get(&list);
let mut inlist = membership.is_some();
if widgets::switch_simple(ui, inlist).clicked() {
if inlist {
let _ =
GLOBALS.storage.remove_person_from_list(&pubkey, list, None);
inlist = false;
} else {
let _ = GLOBALS.storage.add_person_to_list(
&pubkey,
list,
!metadata.private,
None,
);
inlist = true;
make_frame().show(ui, |ui| {
let all_lists = GLOBALS
.storage
.get_all_person_list_metadata()
.unwrap_or_default();
if let Ok(membership_map) = GLOBALS.storage.read_person_lists(&pubkey) {
for (list, metadata) in all_lists {
ui.horizontal(|ui| {
let membership = membership_map.get(&list);
let mut inlist = membership.is_some();
if widgets::switch_simple(ui, inlist).clicked() {
if inlist {
let _ =
GLOBALS.storage.remove_person_from_list(&pubkey, list, None);
inlist = false;
} else {
let _ = GLOBALS.storage.add_person_to_list(
&pubkey,
list,
!metadata.private,
None,
);
inlist = true;
}
inlist = !inlist;
}
inlist = !inlist;
}
ui.add_space(10.0);
if inlist {
ui.label(metadata.title);
ui.add_space(10.0);
let public = membership.unwrap();
// button to toggle public
let label = if *public { "Public" } else { "Private" };
if ui.button(label).clicked() {
let _ = GLOBALS
.storage
.add_person_to_list(&pubkey, list, !*public, None);
if inlist {
ui.label(metadata.title);
ui.add_space(10.0);
let public = membership.unwrap();
// button to toggle public
let label = if *public { "Public" } else { "Private" };
if ui.button(label).clicked() {
let _ = GLOBALS
.storage
.add_person_to_list(&pubkey, list, !*public, None);
}
} else {
ui.label(RichText::new(metadata.title).weak());
}
} else {
ui.label(RichText::new(metadata.title).weak());
}
});
});
}
}
}
});
ui.add_space(10.0);
ui.heading("More details");
ui.horizontal(|ui|{
ui.add_space(10.0);
ui.heading("More details");
});
ui.separator();
ui.add_space(10.0);