diff --git a/web/Cargo.toml b/web/Cargo.toml index 9077d13..8241498 100644 --- a/web/Cargo.toml +++ b/web/Cargo.toml @@ -43,3 +43,8 @@ features = [ "MediaQueryList", "Window" ] + + +[profile.release] +debug = true + diff --git a/web/src/state.rs b/web/src/state.rs index 6a5b908..5352b91 100644 --- a/web/src/state.rs +++ b/web/src/state.rs @@ -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) -> 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)); }; diff --git a/web/src/view/mod.rs b/web/src/view/mod.rs index 6acf3fe..f085c89 100644 --- a/web/src/view/mod.rs +++ b/web/src/view/mod.rs @@ -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 { ]) ] ]), - 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 { a![ C!["navbar-item", "button"], attrs! { - At::Href => urls::search("is:unread", 0) + At::Href => urls::search(unread_query(), 0) }, "Unread", ],