mirror of
https://github.com/mikedilger/gossip.git
synced 2024-09-19 19:46:50 +00:00
Hamburger menu on each post. Dismiss option.
This commit is contained in:
parent
05b6e91a6e
commit
352b674a60
@ -59,6 +59,9 @@ pub struct Globals {
|
|||||||
|
|
||||||
/// Signer
|
/// Signer
|
||||||
pub signer: RwLock<Signer>,
|
pub signer: RwLock<Signer>,
|
||||||
|
|
||||||
|
/// Dismissed Events
|
||||||
|
pub dismissed: RwLock<Vec<Id>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
@ -84,6 +87,7 @@ lazy_static! {
|
|||||||
shutting_down: AtomicBool::new(false),
|
shutting_down: AtomicBool::new(false),
|
||||||
settings: RwLock::new(Settings::default()),
|
settings: RwLock::new(Settings::default()),
|
||||||
signer: RwLock::new(Signer::default()),
|
signer: RwLock::new(Signer::default()),
|
||||||
|
dismissed: RwLock::new(Vec::new()),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -96,6 +100,7 @@ impl Globals {
|
|||||||
.iter()
|
.iter()
|
||||||
.map(|(_, e)| e)
|
.map(|(_, e)| e)
|
||||||
.filter(|e| e.kind == EventKind::TextNote)
|
.filter(|e| e.kind == EventKind::TextNote)
|
||||||
|
.filter(|e| !GLOBALS.dismissed.blocking_read().contains(&e.id))
|
||||||
.filter(|e| {
|
.filter(|e| {
|
||||||
if threaded {
|
if threaded {
|
||||||
e.replies_to().is_none()
|
e.replies_to().is_none()
|
||||||
@ -274,7 +279,7 @@ impl Globals {
|
|||||||
|
|
||||||
// FIXME - this allows people to react many times to the same event, and
|
// FIXME - this allows people to react many times to the same event, and
|
||||||
// it counts them all!
|
// it counts them all!
|
||||||
pub fn get_reactions_sync(id: Id) -> HashMap<char, usize> {
|
pub fn get_reactions_sync(id: Id) -> Vec<(char, usize)> {
|
||||||
let mut output: HashMap<char, usize> = HashMap::new();
|
let mut output: HashMap<char, usize> = HashMap::new();
|
||||||
|
|
||||||
if let Some(relationships) = GLOBALS.relationships.blocking_read().get(&id).cloned() {
|
if let Some(relationships) = GLOBALS.relationships.blocking_read().get(&id).cloned() {
|
||||||
@ -295,7 +300,9 @@ impl Globals {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
output
|
let mut v: Vec<(char, usize)> = output.iter().map(|(c, u)| (*c, *u)).collect();
|
||||||
|
v.sort();
|
||||||
|
v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -494,7 +494,11 @@ impl Overlord {
|
|||||||
|
|
||||||
info!("Seeking {} events", desired_count);
|
info!("Seeking {} events", desired_count);
|
||||||
|
|
||||||
let urls: Vec<Url> = desired_events_map.keys().map(|u| u.to_owned()).filter(|u| u.is_valid()).collect();
|
let urls: Vec<Url> = desired_events_map
|
||||||
|
.keys()
|
||||||
|
.map(|u| u.to_owned())
|
||||||
|
.filter(|u| u.is_valid())
|
||||||
|
.collect();
|
||||||
|
|
||||||
for url in urls.iter() {
|
for url in urls.iter() {
|
||||||
// Get all the ones slated for this relay
|
// Get all the ones slated for this relay
|
||||||
|
@ -163,20 +163,20 @@ fn render_post(
|
|||||||
}
|
}
|
||||||
|
|
||||||
ui.with_layout(Layout::right_to_left(Align::TOP), |ui| {
|
ui.with_layout(Layout::right_to_left(Align::TOP), |ui| {
|
||||||
|
ui.menu_button(RichText::new("≡").size(28.0), |ui| {
|
||||||
|
if ui.button("Copy ID").clicked() {
|
||||||
|
ui.output().copied_text = event.id.as_hex_string();
|
||||||
|
}
|
||||||
|
if ui.button("Dismiss").clicked() {
|
||||||
|
GLOBALS.dismissed.blocking_write().push(event.id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
ui.label(
|
ui.label(
|
||||||
RichText::new(crate::date_ago::date_ago(event.created_at))
|
RichText::new(crate::date_ago::date_ago(event.created_at))
|
||||||
.italics()
|
.italics()
|
||||||
.weak(),
|
.weak(),
|
||||||
);
|
);
|
||||||
|
|
||||||
ui.add_space(10.0);
|
|
||||||
|
|
||||||
if ui.add(CopyButton {}).clicked() {
|
|
||||||
ui.output().copied_text = event.id.as_hex_string();
|
|
||||||
}
|
|
||||||
ui.label("[ID]").on_hover_ui(|ui| {
|
|
||||||
ui.label(&format!("ID: {}", event.id.as_hex_string()));
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user