web: remove a ton of legacy deprecated code
This commit is contained in:
@@ -15,13 +15,12 @@ use wasm_timer::Instant;
|
||||
|
||||
use crate::{
|
||||
api::urls,
|
||||
consts::{SEARCH_RESULTS_PER_PAGE, USE_GRAPHQL},
|
||||
consts::SEARCH_RESULTS_PER_PAGE,
|
||||
graphql::{front_page_query::*, show_thread_query::*},
|
||||
state::{Model, Msg, RefreshingState},
|
||||
};
|
||||
|
||||
mod desktop;
|
||||
mod legacy;
|
||||
mod mobile;
|
||||
mod tablet;
|
||||
|
||||
@@ -47,10 +46,12 @@ fn tags_chiclet(tags: &[String], is_mobile: bool) -> impl Iterator<Item = Node<M
|
||||
"replied" => span![classes, style, i![C!["fa-solid", "fa-reply"]]],
|
||||
_ => span![classes, style, &tag],
|
||||
},
|
||||
ev(Ev::Click, move |_| Msg::SearchRequest {
|
||||
ev(Ev::Click, move |_| Msg::FrontPageRequest {
|
||||
query: format!("tag:{tag}"),
|
||||
page: 0,
|
||||
results_per_page: SEARCH_RESULTS_PER_PAGE,
|
||||
after: None,
|
||||
before: None,
|
||||
first: None,
|
||||
last: None,
|
||||
})
|
||||
]
|
||||
})
|
||||
@@ -532,30 +533,10 @@ fn view_header(query: &str, refresh_request: &RefreshingState) -> Node<Msg> {
|
||||
At::AutoFocus => true.as_at_value();
|
||||
At::Value => query,
|
||||
},
|
||||
input_ev(Ev::Input, |q| if USE_GRAPHQL {
|
||||
Msg::UpdateQuery(q)
|
||||
} else {
|
||||
Msg::SearchRequest {
|
||||
query: Url::encode_uri_component(if q.is_empty() {
|
||||
"*".to_string()
|
||||
} else {
|
||||
q
|
||||
}),
|
||||
page: 0,
|
||||
results_per_page: SEARCH_RESULTS_PER_PAGE,
|
||||
}
|
||||
}),
|
||||
input_ev(Ev::Input, |q| Msg::UpdateQuery(q)),
|
||||
// Send search on enter.
|
||||
keyboard_ev(Ev::KeyUp, move |e| if e.key_code() == 0x0d {
|
||||
if USE_GRAPHQL {
|
||||
Msg::SearchQuery(query)
|
||||
} else {
|
||||
Msg::SearchRequest {
|
||||
query: Url::encode_uri_component(query),
|
||||
page: 0,
|
||||
results_per_page: SEARCH_RESULTS_PER_PAGE,
|
||||
}
|
||||
}
|
||||
Msg::SearchQuery(query)
|
||||
} else {
|
||||
Msg::Noop
|
||||
}),
|
||||
@@ -584,7 +565,7 @@ pub fn view(model: &Model) -> Node<Msg> {
|
||||
.expect("window width")
|
||||
.as_f64()
|
||||
.expect("window width f64");
|
||||
let h = win
|
||||
let _h = win
|
||||
.inner_height()
|
||||
.expect("window height")
|
||||
.as_f64()
|
||||
|
||||
Reference in New Issue
Block a user