Scrollbar position no longer shared between the four different feeds

This commit is contained in:
Mike Dilger 2023-01-23 07:21:08 +13:00
parent d307dcc6fb
commit 5a00d00400

View File

@ -65,7 +65,7 @@ pub(super) fn update(app: &mut GossipUi, ctx: &Context, frame: &mut eframe::Fram
match feed_kind { match feed_kind {
FeedKind::General => { FeedKind::General => {
let feed = GLOBALS.feed.get_general(); let feed = GLOBALS.feed.get_general();
render_a_feed(app, ctx, frame, ui, feed, false); render_a_feed(app, ctx, frame, ui, feed, false, "general");
} }
FeedKind::Replies => { FeedKind::Replies => {
if GLOBALS.signer.blocking_read().public_key().is_none() { if GLOBALS.signer.blocking_read().public_key().is_none() {
@ -78,16 +78,16 @@ pub(super) fn update(app: &mut GossipUi, ctx: &Context, frame: &mut eframe::Fram
}); });
} }
let feed = GLOBALS.feed.get_replies(); let feed = GLOBALS.feed.get_replies();
render_a_feed(app, ctx, frame, ui, feed, false); render_a_feed(app, ctx, frame, ui, feed, false, "replies");
} }
FeedKind::Thread { .. } => { FeedKind::Thread { id, .. } => {
if let Some(parent) = GLOBALS.feed.get_thread_parent() { if let Some(parent) = GLOBALS.feed.get_thread_parent() {
render_a_feed(app, ctx, frame, ui, vec![parent], true); render_a_feed(app, ctx, frame, ui, vec![parent], true, &id.as_hex_string());
} }
} }
FeedKind::Person(pubkeyhex) => { FeedKind::Person(pubkeyhex) => {
let feed = GLOBALS.feed.get_person_feed(pubkeyhex); let feed = GLOBALS.feed.get_person_feed(pubkeyhex.clone());
render_a_feed(app, ctx, frame, ui, feed, false); render_a_feed(app, ctx, frame, ui, feed, false, &pubkeyhex.0);
} }
} }
} }
@ -222,8 +222,11 @@ fn render_a_feed(
ui: &mut Ui, ui: &mut Ui,
feed: Vec<Id>, feed: Vec<Id>,
threaded: bool, threaded: bool,
scroll_area_id: &str,
) { ) {
ScrollArea::vertical().show(ui, |ui| { ScrollArea::vertical()
.id_source(scroll_area_id)
.show(ui, |ui| {
let bgcolor = if ctx.style().visuals.dark_mode { let bgcolor = if ctx.style().visuals.dark_mode {
Color32::BLACK Color32::BLACK
} else { } else {
@ -525,9 +528,7 @@ fn render_post_actual(
// Possible subject line // Possible subject line
if let Some(subject) = event.subject() { if let Some(subject) = event.subject() {
ui.label( ui.label(RichText::new(subject).strong().underline());
RichText::new(subject).strong().underline()
);
} }
// MAIN CONTENT // MAIN CONTENT