web: highlight button for current search, bring back debug unread
This commit is contained in:
parent
6f93aa4f34
commit
aa1736a285
@ -12,7 +12,7 @@ use web_sys::{HtmlElement, HtmlInputElement};
|
|||||||
use crate::{
|
use crate::{
|
||||||
api::urls,
|
api::urls,
|
||||||
graphql::{front_page_query::*, show_thread_query::*},
|
graphql::{front_page_query::*, show_thread_query::*},
|
||||||
state::{CatchupItem, Context, Model, Msg, RefreshingState, Tag, Version},
|
state::{unread_query, CatchupItem, Context, Model, Msg, RefreshingState, Tag, Version},
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO(wathiede): create a QueryString enum that wraps single and multiple message ids and thread
|
// TODO(wathiede): create a QueryString enum that wraps single and multiple message ids and thread
|
||||||
@ -1210,13 +1210,18 @@ fn view_header(
|
|||||||
false
|
false
|
||||||
};
|
};
|
||||||
let query = Url::decode_uri_component(query).unwrap_or("".to_string());
|
let query = Url::decode_uri_component(query).unwrap_or("".to_string());
|
||||||
|
let filter_all = String::new();
|
||||||
|
let filter_unread = unread_query().to_string();
|
||||||
|
let filter_news = "is:unread is:news".to_string();
|
||||||
|
let filter_mail = "is:unread is:mail".to_string();
|
||||||
|
let highlight_color = "bg-sky-800";
|
||||||
|
|
||||||
nav![
|
nav![
|
||||||
C!["flex", "flex-col"],
|
C!["flex", "flex-col"],
|
||||||
div![
|
div![
|
||||||
C!["flex-auto", "flex"],
|
C!["flex-auto", "flex"],
|
||||||
button![
|
button![
|
||||||
C![IF![is_error => "bg-red-500"], "rounded-none"],
|
C![IF!(is_error => "bg-red-500"), "rounded-none"],
|
||||||
tw_classes::button(),
|
tw_classes::button(),
|
||||||
span![i![C![
|
span![i![C![
|
||||||
"fa-solid",
|
"fa-solid",
|
||||||
@ -1226,35 +1231,35 @@ fn view_header(
|
|||||||
ev(Ev::Click, |_| Msg::RefreshStart),
|
ev(Ev::Click, |_| Msg::RefreshStart),
|
||||||
],
|
],
|
||||||
button![
|
button![
|
||||||
|
IF!(query == filter_all => C![highlight_color]),
|
||||||
tw_classes::button(),
|
tw_classes::button(),
|
||||||
C!["grow", "rounded-none"],
|
C!["grow", "rounded-none"],
|
||||||
"All",
|
"All",
|
||||||
ev(Ev::Click, |_| Msg::SearchQuery(String::new())),
|
ev(Ev::Click, |_| Msg::SearchQuery(filter_all)),
|
||||||
],
|
],
|
||||||
button![
|
button![
|
||||||
|
IF!(query == filter_unread => C![highlight_color]),
|
||||||
tw_classes::button(),
|
tw_classes::button(),
|
||||||
C!["grow", "rounded-none"],
|
C!["grow", "rounded-none"],
|
||||||
span![i![C!["far", "fa-envelope"]]],
|
span![i![C!["far", "fa-envelope"]]],
|
||||||
" Unread",
|
" Unread",
|
||||||
ev(Ev::Click, |_| Msg::SearchQuery("is:unread".to_string())),
|
ev(Ev::Click, |_| Msg::SearchQuery(filter_unread)),
|
||||||
],
|
],
|
||||||
button![
|
button![
|
||||||
|
IF!(query == filter_news => C![highlight_color]),
|
||||||
tw_classes::button(),
|
tw_classes::button(),
|
||||||
C!["grow", "rounded-none"],
|
C!["grow", "rounded-none"],
|
||||||
span![i![C!["far", "fa-envelope"]]],
|
span![i![C!["far", "fa-envelope"]]],
|
||||||
" News",
|
" News",
|
||||||
ev(Ev::Click, |_| Msg::SearchQuery(
|
ev(Ev::Click, |_| Msg::SearchQuery(filter_news)),
|
||||||
"is:unread is:news".to_string()
|
|
||||||
)),
|
|
||||||
],
|
],
|
||||||
button![
|
button![
|
||||||
|
IF!(query == filter_mail => C![highlight_color]),
|
||||||
tw_classes::button(),
|
tw_classes::button(),
|
||||||
C!["grow", "rounded-none"],
|
C!["grow", "rounded-none"],
|
||||||
span![i![C!["far", "fa-envelope"]]],
|
span![i![C!["far", "fa-envelope"]]],
|
||||||
" Mail",
|
" Mail",
|
||||||
ev(Ev::Click, |_| Msg::SearchQuery(
|
ev(Ev::Click, |_| Msg::SearchQuery(filter_mail)),
|
||||||
"is:unread is:mail".to_string()
|
|
||||||
)),
|
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
div![
|
div![
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user