web: change up unread message styles

This commit is contained in:
Bill Thiede 2024-02-20 13:55:54 -08:00
parent c8e0f68278
commit 04592ddcc4
2 changed files with 21 additions and 10 deletions

View File

@ -63,6 +63,10 @@
width: 100%; width: 100%;
} }
.index tr.unread {
font-weight: bold;
}
.index .from { .index .from {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;

View File

@ -121,7 +121,13 @@ fn view_search_results(
let rows = results.iter().map(|r| { let rows = results.iter().map(|r| {
let tid = r.thread.clone(); let tid = r.thread.clone();
let datetime = human_age(r.timestamp as i64); let datetime = human_age(r.timestamp as i64);
let unread_idx = r.tags.iter().position(|e| e == &"unread");
let mut tags = r.tags.clone();
if let Some(idx) = unread_idx {
tags.remove(idx);
};
tr![ tr![
IF!(unread_idx.is_some() => C!["unread"]),
td![ td![
C!["from"], C!["from"],
pretty_authors(&r.authors), pretty_authors(&r.authors),
@ -129,7 +135,7 @@ fn view_search_results(
], ],
td![ td![
C!["subject"], C!["subject"],
tags_chiclet(&r.tags, false), tags_chiclet(&tags, false),
" ", " ",
a![ a![
C!["has-text-light"], C!["has-text-light"],
@ -275,12 +281,7 @@ fn raw_text_message(contents: &str) -> Node<Msg> {
} }
fn has_unread(tags: &[String]) -> bool { fn has_unread(tags: &[String]) -> bool {
for t in tags { tags.contains(&String::from("unread"))
if t == "unread" {
return true;
}
}
false
} }
fn read_message_render(msg: &ShowThreadQueryThreadMessages, open: StateAccess<bool>) -> Node<Msg> { fn read_message_render(msg: &ShowThreadQueryThreadMessages, open: StateAccess<bool>) -> Node<Msg> {
@ -296,7 +297,10 @@ fn read_message_render(msg: &ShowThreadQueryThreadMessages, open: StateAccess<bo
style! { style! {
St::Color => "gold" St::Color => "gold"
}, },
C![if is_unread { "fa-regular" } else { "fa-solid" }, "fa-star"], C![
if is_unread { "fa-regular" } else { "fa-solid" },
"fa-envelope"
],
ev(Ev::Click, move |e| { ev(Ev::Click, move |e| {
e.stop_propagation(); e.stop_propagation();
Msg::SetUnread(format!("id:{id}"), !is_unread) Msg::SetUnread(format!("id:{id}"), !is_unread)
@ -333,7 +337,10 @@ fn unread_message_render(
style! { style! {
St::Color => "gold" St::Color => "gold"
}, },
C![if is_unread { "fa-regular" } else { "fa-solid" }, "fa-star"], C![
if is_unread { "fa-regular" } else { "fa-solid" },
"fa-envelope"
],
ev(Ev::Click, move |e| { ev(Ev::Click, move |e| {
e.stop_propagation(); e.stop_propagation();
Msg::SetUnread(format!("id:{id}"), !is_unread) Msg::SetUnread(format!("id:{id}"), !is_unread)
@ -433,7 +440,7 @@ fn thread(thread: &ShowThreadQueryThread) -> Node<Msg> {
}, },
C![ C![
if any_unread { "fa-regular" } else { "fa-solid" }, if any_unread { "fa-regular" } else { "fa-solid" },
"fa-star" "fa-envelope"
], ],
ev(Ev::Click, move |_| Msg::SetUnread( ev(Ev::Click, move |_| Msg::SetUnread(
format!("thread:{}", thread_id), format!("thread:{}", thread_id),