web: add scrollbar for read progress

This commit is contained in:
2024-08-31 16:08:06 -07:00
parent 5c813e7350
commit 4faef5e017
6 changed files with 65 additions and 10 deletions

View File

@@ -1117,12 +1117,14 @@ fn news_post(post: &ShowThreadQueryThreadOnNewsPost, show_icon_text: bool) -> No
C!["body", "news-post", format!("site-{}", post.slug)],
raw![&post.body]
]
] /* TODO(wathiede): plumb in orignal id
a![
attrs! {At::Href=>api::original(&thread_node.0.as_ref().expect("message missing").id)},
"Original"
],
*/
],
/* TODO(wathiede): plumb in orignal id
a![
attrs! {At::Href=>api::original(&thread_node.0.as_ref().expect("message missing").id)},
"Original"
],
*/
ev(Ev::Scroll, |e| info!("scroll event {e:?}"))
]
}
fn render_news_post_header(post: &ShowThreadQueryThreadOnNewsPost) -> Node<Msg> {
@@ -1181,3 +1183,20 @@ fn render_news_post_header(post: &ShowThreadQueryThreadOnNewsPost) -> Node<Msg>
]
]
}
fn reading_progress(ratio: f64) -> Node<Msg> {
let percent = ratio * 100.;
progress![
C![
"read-progress",
"progress",
"is-success",
"is-small",
IF!(percent<5. => "is-invisible")
],
attrs! {
At::Value=>percent,
At::Max=>"100"
},
format!("{percent}%")
]
}