From 859564c476d92cc2c75e777ba1c124d7df7a343b Mon Sep 17 00:00:00 2001 From: Bill Thiede Date: Thu, 27 Nov 2025 09:45:01 -0800 Subject: [PATCH] web: change up progress bar behavior --- web/src/view/mod.rs | 50 +++++++++++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 15 deletions(-) diff --git a/web/src/view/mod.rs b/web/src/view/mod.rs index 6c665e3..a4e1a1e 100644 --- a/web/src/view/mod.rs +++ b/web/src/view/mod.rs @@ -88,7 +88,6 @@ pub fn view(model: &Model) -> Node { &model.versions, &model.query, &model.refreshing_state, - model.read_completion_ratio, &model.tags, ), Context::ThreadResult { @@ -97,18 +96,23 @@ pub fn view(model: &Model) -> Node { } => { if let Some(catchup) = &model.catchup { catchup_view( - thread(thread_data, open_messages, &model.content_el, true), + thread(thread_data, open_messages, &model.content_el, true, 0.), &catchup.items, - model.read_completion_ratio, is_loading, + model.read_completion_ratio, ) } else { normal_view( - thread(thread_data, open_messages, &model.content_el, false), + thread( + thread_data, + open_messages, + &model.content_el, + false, + model.read_completion_ratio, + ), &model.versions, &model.query, &model.refreshing_state, - model.read_completion_ratio, &model.tags, ) } @@ -119,18 +123,17 @@ pub fn view(model: &Model) -> Node { } => { if let Some(catchup) = &model.catchup { catchup_view( - news_post(post, &model.content_el, true), + news_post(post, &model.content_el, true, model.read_completion_ratio), &catchup.items, - model.read_completion_ratio, is_loading, + 0., ) } else { normal_view( - news_post(post, &model.content_el, false), + news_post(post, &model.content_el, false, model.read_completion_ratio), &model.versions, &model.query, &model.refreshing_state, - model.read_completion_ratio, &model.tags, ) } @@ -146,7 +149,6 @@ pub fn view(model: &Model) -> Node { &model.versions, &model.query, &model.refreshing_state, - model.read_completion_ratio, &model.tags, ), } @@ -157,7 +159,6 @@ fn normal_view( versions: &Version, query: &str, refreshing_state: &RefreshingState, - read_completion_ratio: f64, tags: &Option>, ) -> Node { div![ @@ -184,15 +185,14 @@ fn normal_view( content, view_header(query, refreshing_state, false), ], - reading_progress(read_completion_ratio), ] } fn catchup_view( content: Node, items: &[CatchupItem], - read_completion_ratio: f64, is_loading: bool, + read_completion_ratio: f64, ) -> Node { div![ C!["w-full", "relative", "text-white"], @@ -219,6 +219,23 @@ fn catchup_view( C!["absolute", "top-0", "right-4", "text-gray-500", "p-4"], span![i![C!["fas", "fa-x"]]], ev(Ev::Click, move |_| Msg::CatchupExit) + ], + div![ + C![ + "absolute", + "left-0", + "right-0", + "bottom-0", + "w-full", + "h-1", + "bg-gray-200" + ], + div![ + C!["h-1", "bg-green-500"], + style! { + St::Width => format!("{}%", read_completion_ratio*100.) + } + ] ] ], div![C!["mt-12", "mb-20"], content], @@ -258,7 +275,6 @@ fn catchup_view( ev(Ev::Click, |_| Msg::CatchupMarkAsRead) ] ], - reading_progress(read_completion_ratio) ] } @@ -1159,6 +1175,7 @@ fn thread( open_messages: &HashSet, content_el: &ElRef, catchup_mode: bool, + read_completion_ratio: f64, ) -> Node { // TODO(wathiede): show per-message subject if it changes significantly from top-level subject let subject = if thread.subject.is_empty() { @@ -1243,7 +1260,8 @@ fn thread( el_ref(content_el), messages, IF!(!catchup_mode => click_to_top()) - ] + ], + reading_progress(read_completion_ratio) ] } @@ -1487,6 +1505,7 @@ fn news_post( post: &ShowThreadQueryThreadOnNewsPost, content_el: &ElRef, catchup_mode: bool, + read_completion_ratio: f64, ) -> Node { let subject = &post.title; set_title(subject); @@ -1574,6 +1593,7 @@ fn news_post( ] ], IF!(!catchup_mode => click_to_top()), + reading_progress(read_completion_ratio) ] } fn render_news_post_header(post: &ShowThreadQueryThreadOnNewsPost) -> Node {