Bring back new-event hilighting, cleared when you switch feed tabs

This commit is contained in:
Mike Dilger 2023-01-04 17:11:45 +13:00
parent 9979dd8c64
commit 050780cc87
2 changed files with 5 additions and 8 deletions

View File

@ -38,6 +38,7 @@ pub(super) fn update(app: &mut GossipUi, ctx: &Context, frame: &mut eframe::Fram
app.page = Page::FeedGeneral; app.page = Page::FeedGeneral;
GLOBALS.feed.set_feed_to_general(); GLOBALS.feed.set_feed_to_general();
feed_kind = FeedKind::General; feed_kind = FeedKind::General;
GLOBALS.event_is_new.blocking_write().clear();
} }
ui.separator(); ui.separator();
if ui if ui
@ -50,14 +51,17 @@ pub(super) fn update(app: &mut GossipUi, ctx: &Context, frame: &mut eframe::Fram
app.page = Page::FeedReplies; app.page = Page::FeedReplies;
GLOBALS.feed.set_feed_to_replies(); GLOBALS.feed.set_feed_to_replies();
feed_kind = FeedKind::Replies; feed_kind = FeedKind::Replies;
GLOBALS.event_is_new.blocking_write().clear();
} }
if matches!(feed_kind, FeedKind::Thread(..)) { if matches!(feed_kind, FeedKind::Thread(..)) {
ui.separator(); ui.separator();
ui.selectable_value(&mut app.page, Page::FeedThread, "Thread"); ui.selectable_value(&mut app.page, Page::FeedThread, "Thread");
GLOBALS.event_is_new.blocking_write().clear();
} }
if matches!(feed_kind, FeedKind::Person(..)) { if matches!(feed_kind, FeedKind::Person(..)) {
ui.separator(); ui.separator();
ui.selectable_value(&mut app.page, Page::FeedPerson, "Person"); ui.selectable_value(&mut app.page, Page::FeedPerson, "Person");
GLOBALS.event_is_new.blocking_write().clear();
} }
}); });
ui.separator(); ui.separator();
@ -373,7 +377,6 @@ fn render_post_actual(
// Try LayoutJob // Try LayoutJob
/* currently all events are new because the code that stales them is now gone
#[allow(clippy::collapsible_else_if)] #[allow(clippy::collapsible_else_if)]
let bgcolor = if GLOBALS.event_is_new.blocking_read().contains(&event.id) { let bgcolor = if GLOBALS.event_is_new.blocking_read().contains(&event.id) {
if ctx.style().visuals.dark_mode { if ctx.style().visuals.dark_mode {
@ -388,13 +391,6 @@ fn render_post_actual(
Color32::WHITE Color32::WHITE
} }
}; };
*/
let bgcolor = if ctx.style().visuals.dark_mode {
Color32::BLACK
} else {
Color32::WHITE
};
Frame::none().fill(bgcolor).show(ui, |ui| { Frame::none().fill(bgcolor).show(ui, |ui| {
ui.horizontal(|ui| { ui.horizontal(|ui| {

View File

@ -198,6 +198,7 @@ impl eframe::App for GossipUi {
.clicked() .clicked()
{ {
self.page = Page::FeedGeneral; self.page = Page::FeedGeneral;
GLOBALS.event_is_new.blocking_write().clear();
} }
ui.separator(); ui.separator();
if ui if ui