web: debug search for tag:letterbox instead of is:unread

This commit is contained in:
Bill Thiede 2024-02-28 19:13:37 -08:00
parent facea2326e
commit fc7a4a747c
3 changed files with 25 additions and 8 deletions

View File

@ -43,3 +43,8 @@ features = [
"MediaQueryList",
"Window"
]
[profile.release]
debug = true

View File

@ -2,7 +2,7 @@ use std::collections::HashSet;
use graphql_client::GraphQLQuery;
use log::{error, info};
use seed::{app::subs, prelude::*, *};
use seed::{prelude::*, *};
use thiserror::Error;
use crate::{
@ -13,10 +13,22 @@ use crate::{
graphql::{front_page_query::*, send_graphql, show_thread_query::*},
};
/// Used to fake the unread string while in development
pub fn unread_query() -> &'static str {
let host = seed::window()
.location()
.host()
.expect("failed to get host");
if host.starts_with("6758.") {
return "tag:letterbox";
}
"is:unread"
}
// `init` describes what should happen when your app started.
pub fn init(url: Url, orders: &mut impl Orders<Msg>) -> Model {
if url.hash().is_none() {
orders.request_url(urls::search("is:unread", 0));
orders.request_url(urls::search(unread_query(), 0));
} else {
orders.notify(subs::UrlRequested::new(url));
};

View File

@ -14,7 +14,7 @@ use crate::{
api::urls,
consts::SEARCH_RESULTS_PER_PAGE,
graphql::{front_page_query::*, show_thread_query::*},
state::{Model, Msg, RefreshingState},
state::{unread_query, Model, Msg, RefreshingState},
};
mod desktop;
@ -490,10 +490,10 @@ fn render_open_header(msg: &ShowThreadQueryThreadMessages) -> Node<Msg> {
])
]
]),
tr![
td!["Date"],
td![msg.timestamp.map(|ts| span![C!["header"], human_age(ts)])]
]
tr![td![
attrs! {At::ColSpan=>2},
msg.timestamp.map(|ts| span![C!["header"], human_age(ts)])
]]
],
],
],
@ -761,7 +761,7 @@ fn view_header(query: &str, refresh_request: &RefreshingState) -> Node<Msg> {
a![
C!["navbar-item", "button"],
attrs! {
At::Href => urls::search("is:unread", 0)
At::Href => urls::search(unread_query(), 0)
},
"Unread",
],