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", "MediaQueryList",
"Window" "Window"
] ]
[profile.release]
debug = true

View File

@ -2,7 +2,7 @@ use std::collections::HashSet;
use graphql_client::GraphQLQuery; use graphql_client::GraphQLQuery;
use log::{error, info}; use log::{error, info};
use seed::{app::subs, prelude::*, *}; use seed::{prelude::*, *};
use thiserror::Error; use thiserror::Error;
use crate::{ use crate::{
@ -13,10 +13,22 @@ use crate::{
graphql::{front_page_query::*, send_graphql, show_thread_query::*}, 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. // `init` describes what should happen when your app started.
pub fn init(url: Url, orders: &mut impl Orders<Msg>) -> Model { pub fn init(url: Url, orders: &mut impl Orders<Msg>) -> Model {
if url.hash().is_none() { if url.hash().is_none() {
orders.request_url(urls::search("is:unread", 0)); orders.request_url(urls::search(unread_query(), 0));
} else { } else {
orders.notify(subs::UrlRequested::new(url)); orders.notify(subs::UrlRequested::new(url));
}; };

View File

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