web: conditionally show spam button in catchup

This commit is contained in:
2026-02-01 17:16:11 -08:00
parent cd09594347
commit 44961f6ef1

View File

@@ -100,6 +100,7 @@ pub fn view(model: &Model) -> Node<Msg> {
&catchup.items, &catchup.items,
is_loading, is_loading,
model.read_completion_ratio, model.read_completion_ratio,
true, // show spam button for email
) )
} else { } else {
normal_view( normal_view(
@@ -127,6 +128,7 @@ pub fn view(model: &Model) -> Node<Msg> {
&catchup.items, &catchup.items,
is_loading, is_loading,
model.read_completion_ratio, model.read_completion_ratio,
false, // no spam button for news
) )
} else { } else {
normal_view( normal_view(
@@ -193,6 +195,7 @@ fn catchup_view(
items: &[CatchupItem], items: &[CatchupItem],
is_loading: bool, is_loading: bool,
read_completion_ratio: f64, read_completion_ratio: f64,
show_spam_button: bool,
) -> Node<Msg> { ) -> Node<Msg> {
div![ div![
C!["w-full", "relative", "text-white"], C!["w-full", "relative", "text-white"],
@@ -268,14 +271,14 @@ fn catchup_view(
Msg::GoToSearchResults Msg::GoToSearchResults
])) ]))
], ],
button![ IF!(show_spam_button => button![
tw_classes::button(), tw_classes::button(),
C!["text-red-500"], C!["text-red-500"],
attrs! {At::Title => "Mark as spam"}, attrs! {At::Title => "Mark as spam"},
span![i![C!["far", "fa-hand"]]], span![i![C!["far", "fa-hand"]]],
span![C!["pl-2"], "Spam"], span![C!["pl-2"], "Spam"],
ev(Ev::Click, |_| Msg::CatchupMarkAsSpam) ev(Ev::Click, |_| Msg::CatchupMarkAsSpam)
], ]),
button![ button![
tw_classes::button_with_color("bg-green-800", "hover:bg-green-700"), tw_classes::button_with_color("bg-green-800", "hover:bg-green-700"),
span![i![C!["far", "fa-envelope-open"]]], span![i![C!["far", "fa-envelope-open"]]],