web: separate spam button from read buttons and color red.

This commit is contained in:
Bill Thiede 2024-04-06 08:00:35 -07:00
parent 8abf9398e9
commit b0305b7411
3 changed files with 70 additions and 50 deletions

View File

@ -42,7 +42,6 @@ pub fn init(url: Url, orders: &mut impl Orders<Msg>) -> Model {
context: Context::None, context: Context::None,
query: "".to_string(), query: "".to_string(),
refreshing_state: RefreshingState::None, refreshing_state: RefreshingState::None,
ui_error: UIError::NoError,
tags: None, tags: None,
} }
} }
@ -450,7 +449,6 @@ pub struct Model {
pub query: String, pub query: String,
pub context: Context, pub context: Context,
pub refreshing_state: RefreshingState, pub refreshing_state: RefreshingState,
pub ui_error: UIError,
pub tags: Option<Vec<Tag>>, pub tags: Option<Vec<Tag>>,
} }

View File

@ -255,35 +255,41 @@ fn search_toolbar(
.unwrap_or(0); .unwrap_or(0);
nav![ nav![
C!["level"], C!["level"],
div![ IF!(show_bulk_edit =>
C!["level-left"], div![
IF!(show_bulk_edit => C!["level-left"],
span![ div![
// TODO(wathiede): add "Mark as spam" C!["level-item"],
C!["level-item", "buttons", "has-addons"], div![C!["buttons", "has-addons"],
button![ button![
C!["button"], C!["button","spam"],
attrs!{At::Title => "Mark as spam"}, attrs!{At::Title => "Mark as spam"},
span![C!["icon", "is-small"], i![C!["far", "fa-hand"]]], span![C!["icon", "is-small"], i![C!["far", "fa-hand"]]],
span!["Spam"], span!["Spam"],
ev(Ev::Click, |_| Msg::SelectionAddTag("Spam".to_string())) ev(Ev::Click, |_| Msg::SelectionAddTag("Spam".to_string()))
],
],
], ],
button![ div![
C!["button"], C!["level-item"],
attrs!{At::Title => "Mark as read"}, div![C!["buttons", "has-addons"],
button![
C!["button","mark-read"],
attrs!{At::Title => "Mark as read"},
span![C!["icon", "is-small"], i![C!["far", "fa-envelope-open"]]], span![C!["icon", "is-small"], i![C!["far", "fa-envelope-open"]]],
span!["Read"], span!["Read"],
ev(Ev::Click, |_| Msg::SelectionMarkAsRead) ev(Ev::Click, |_| Msg::SelectionMarkAsRead)
], ],
button![ button![
C!["button"], C!["button","mark-unread"],
attrs!{At::Title => "Mark as unread"}, attrs!{At::Title => "Mark as unread"},
span![C!["icon", "is-small"], i![C!["far", "fa-envelope"]]], span![C!["icon", "is-small"], i![C!["far", "fa-envelope"]]],
span!["Unread"], span!["Unread"],
ev(Ev::Click, |_| Msg::SelectionMarkAsUnread) ev(Ev::Click, |_| Msg::SelectionMarkAsUnread)
] ]
]), ]
], ]
]),
div![ div![
C!["level-right"], C!["level-right"],
nav![ nav![
@ -733,37 +739,49 @@ fn thread(thread: &ShowThreadQueryThread, open_messages: &HashSet<String>) -> No
C!["thread"], C!["thread"],
h3![C!["is-size-5"], subject], h3![C!["is-size-5"], subject],
span![C!["tags"], tags_chiclet(&tags, false)], span![C!["tags"], tags_chiclet(&tags, false)],
span![ div![
C!["level-item", "buttons", "has-addons"], C!["level"],
button![ div![
C!["button"], C!["level-item"],
attrs! {At::Title => "Spam"}, div![
span![C!["icon", "is-small"], i![C!["far", "fa-hand"]]], C!["buttons", "has-addons"],
span!["Spam"], button![
ev(Ev::Click, move |_| Msg::AddTag( C!["button", "spam"],
format!("thread:{spam_thread_id}"), attrs! {At::Title => "Spam"},
"Spam".to_string() span![C!["icon", "is-small"], i![C!["far", "fa-hand"]]],
)), span!["Spam"],
ev(Ev::Click, move |_| Msg::AddTag(
format!("thread:{spam_thread_id}"),
"Spam".to_string()
)),
],
],
], ],
button![ div![
C!["button"], C!["level-item"],
attrs! {At::Title => "Mark as read"}, div![
span![C!["icon", "is-small"], i![C!["far", "fa-envelope-open"]]], C!["buttons", "has-addons"],
span!["Read"], button![
ev(Ev::Click, move |_| Msg::SetUnread( C!["button", "mark-read"],
format!("thread:{read_thread_id}"), attrs! {At::Title => "Mark as read"},
false span![C!["icon", "is-small"], i![C!["far", "fa-envelope-open"]]],
)), span!["Read"],
], ev(Ev::Click, move |_| Msg::SetUnread(
button![ format!("thread:{read_thread_id}"),
C!["button"], false
attrs! {At::Title => "Mark as unread"}, )),
span![C!["icon", "is-small"], i![C!["far", "fa-envelope"]]], ],
span!["Unread"], button![
ev(Ev::Click, move |_| Msg::SetUnread( C!["button", "mark-unread"],
format!("thread:{unread_thread_id}"), attrs! {At::Title => "Mark as unread"},
true span![C!["icon", "is-small"], i![C!["far", "fa-envelope"]]],
)), span!["Unread"],
ev(Ev::Click, move |_| Msg::SetUnread(
format!("thread:{unread_thread_id}"),
true
)),
],
],
], ],
], ],
messages, messages,

View File

@ -282,3 +282,7 @@ display: none;
.attachment .card-content { .attachment .card-content {
padding: 0.5rem 1.5rem; padding: 0.5rem 1.5rem;
} }
.button.spam {
color: #f00;
}