mirror of
https://github.com/mikedilger/gossip.git
synced 2024-09-19 19:46:50 +00:00
Some feed page work
This commit is contained in:
parent
7aa14cc37c
commit
cb19731353
@ -76,7 +76,6 @@ pub async fn get_feed() -> Vec<Id> {
|
|||||||
.cloned()
|
.cloned()
|
||||||
.collect();
|
.collect();
|
||||||
let len = GLOBALS.event_relateds.lock().await.len();
|
let len = GLOBALS.event_relateds.lock().await.len();
|
||||||
info!("New feed, length={} (of {} events)", feed.len(), len);
|
|
||||||
feed.sort_unstable_by(|a, b| a.last_reply_at.cmp(&b.last_reply_at));
|
feed.sort_unstable_by(|a, b| a.last_reply_at.cmp(&b.last_reply_at));
|
||||||
feed.iter().map(|e| e.id).collect()
|
feed.iter().map(|e| e.id).collect()
|
||||||
}
|
}
|
||||||
@ -93,7 +92,6 @@ pub fn blocking_get_feed() -> Vec<Id> {
|
|||||||
.cloned()
|
.cloned()
|
||||||
.collect();
|
.collect();
|
||||||
let len = GLOBALS.event_relateds.blocking_lock().len();
|
let len = GLOBALS.event_relateds.blocking_lock().len();
|
||||||
info!("New feed, length={} (of {} events)", feed.len(), len);
|
|
||||||
feed.sort_unstable_by(|a, b| a.last_reply_at.cmp(&b.last_reply_at));
|
feed.sort_unstable_by(|a, b| a.last_reply_at.cmp(&b.last_reply_at));
|
||||||
feed.iter().map(|e| e.id).collect()
|
feed.iter().map(|e| e.id).collect()
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,38 @@
|
|||||||
use super::GossipUi;
|
use super::GossipUi;
|
||||||
use eframe::egui;
|
use eframe::egui;
|
||||||
use egui::{Context, Ui};
|
use egui::{Context, ScrollArea, TextStyle, Ui};
|
||||||
|
use tracing::info;
|
||||||
|
|
||||||
pub(super) fn update(_app: &mut GossipUi, _ctx: &Context, _frame: &mut eframe::Frame, ui: &mut Ui) {
|
pub(super) fn update(_app: &mut GossipUi, ctx: &Context, _frame: &mut eframe::Frame, ui: &mut Ui) {
|
||||||
ui.label("FEED PAGE - Coming Soon".to_string());
|
|
||||||
|
let feed = crate::globals::blocking_get_feed();
|
||||||
|
|
||||||
|
let screen_rect = ctx.input().screen_rect; // Rect
|
||||||
|
let scroll_delta = ctx.input().scroll_delta; // Vec2
|
||||||
|
|
||||||
|
|
||||||
|
ScrollArea::vertical().show(ui, |ui| {
|
||||||
|
for id in feed.iter() {
|
||||||
|
// Stop rendering at the bottom of the window:
|
||||||
|
let pos2 = ui.next_widget_position();
|
||||||
|
if pos2.y > screen_rect.max.y { break; }
|
||||||
|
|
||||||
|
if let Some(event) = crate::globals::GLOBALS.events.blocking_lock().get(id) {
|
||||||
|
if let Some(person) = crate::globals::GLOBALS.people.blocking_lock().get(&event.pubkey) {
|
||||||
|
if let Some(name) = &person.name {
|
||||||
|
ui.label(&format!("{}", name));
|
||||||
|
} else {
|
||||||
|
ui.label(&format!("{}", event.pubkey.as_hex_string()));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ui.label(&format!("{}", event.pubkey.as_hex_string()));
|
||||||
|
}
|
||||||
|
ui.label(&format!("{}", event.content));
|
||||||
|
ui.separator();
|
||||||
|
} else {
|
||||||
|
ui.label(&format!("-- missing event --"));
|
||||||
|
ui.separator();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
@ -3,5 +3,5 @@ use eframe::egui;
|
|||||||
use egui::{Context, Ui};
|
use egui::{Context, Ui};
|
||||||
|
|
||||||
pub(super) fn update(_app: &mut GossipUi, _ctx: &Context, _frame: &mut eframe::Frame, ui: &mut Ui) {
|
pub(super) fn update(_app: &mut GossipUi, _ctx: &Context, _frame: &mut eframe::Frame, ui: &mut Ui) {
|
||||||
ui.label("YOU PAGE - Coming Soon".to_string());
|
ui.heading("Your Identities");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user