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%;
}
.index tr.unread {
font-weight: bold;
}
.index .from {
overflow: hidden;
text-overflow: ellipsis;

View File

@ -121,7 +121,13 @@ fn view_search_results(
let rows = results.iter().map(|r| {
let tid = r.thread.clone();
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![
IF!(unread_idx.is_some() => C!["unread"]),
td![
C!["from"],
pretty_authors(&r.authors),
@ -129,7 +135,7 @@ fn view_search_results(
],
td![
C!["subject"],
tags_chiclet(&r.tags, false),
tags_chiclet(&tags, false),
" ",
a![
C!["has-text-light"],
@ -275,12 +281,7 @@ fn raw_text_message(contents: &str) -> Node<Msg> {
}
fn has_unread(tags: &[String]) -> bool {
for t in tags {
if t == "unread" {
return true;
}
}
false
tags.contains(&String::from("unread"))
}
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! {
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| {
e.stop_propagation();
Msg::SetUnread(format!("id:{id}"), !is_unread)
@ -333,7 +337,10 @@ fn unread_message_render(
style! {
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| {
e.stop_propagation();
Msg::SetUnread(format!("id:{id}"), !is_unread)
@ -433,7 +440,7 @@ fn thread(thread: &ShowThreadQueryThread) -> Node<Msg> {
},
C![
if any_unread { "fa-regular" } else { "fa-solid" },
"fa-star"
"fa-envelope"
],
ev(Ev::Click, move |_| Msg::SetUnread(
format!("thread:{}", thread_id),