Compare commits
4 Commits
56311bbe05
...
d09efd3a69
| Author | SHA1 | Date | |
|---|---|---|---|
| d09efd3a69 | |||
| 1ac7f5b6dc | |||
| fc7a4a747c | |||
| facea2326e |
@ -43,3 +43,8 @@ features = [
|
||||
"MediaQueryList",
|
||||
"Window"
|
||||
]
|
||||
|
||||
|
||||
[profile.release]
|
||||
debug = true
|
||||
|
||||
|
||||
@ -55,6 +55,7 @@
|
||||
padding: 1em;
|
||||
width: 0;
|
||||
min-width: 100%;
|
||||
overflow: auto;
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
@ -220,11 +221,21 @@
|
||||
}
|
||||
|
||||
.search-results .row .from {
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.search-results .from a {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.search-results .from a {
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.search-results .row .tag {
|
||||
height: 1.5em;
|
||||
padding-left: .5em;
|
||||
|
||||
@ -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));
|
||||
};
|
||||
|
||||
@ -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;
|
||||
@ -135,6 +135,11 @@ fn view_search_results(
|
||||
if let Some(idx) = unread_idx {
|
||||
tags.remove(idx);
|
||||
};
|
||||
let subject = if r.subject.is_empty() {
|
||||
"(no subject)"
|
||||
} else {
|
||||
&r.subject
|
||||
};
|
||||
tr![
|
||||
IF!(unread_idx.is_some() => C!["unread"]),
|
||||
td![label![
|
||||
@ -163,8 +168,14 @@ fn view_search_results(
|
||||
]],
|
||||
td![
|
||||
C!["from"],
|
||||
pretty_authors(&r.authors),
|
||||
IF!(r.total>1 => small![" ", r.total.to_string()]),
|
||||
a![
|
||||
C!["has-text-light", "text"],
|
||||
attrs! {
|
||||
At::Href => urls::thread(&tid)
|
||||
},
|
||||
pretty_authors(&r.authors),
|
||||
IF!(r.total>1 => small![" ", r.total.to_string()]),
|
||||
]
|
||||
],
|
||||
td![
|
||||
C!["subject"],
|
||||
@ -175,10 +186,19 @@ fn view_search_results(
|
||||
attrs! {
|
||||
At::Href => urls::thread(&tid)
|
||||
},
|
||||
&r.subject,
|
||||
&subject,
|
||||
]
|
||||
],
|
||||
td![C!["date"], datetime]
|
||||
td![
|
||||
C!["date"],
|
||||
a![
|
||||
C!["has-text-light", "text"],
|
||||
attrs! {
|
||||
At::Href => urls::thread(&tid)
|
||||
},
|
||||
datetime
|
||||
]
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
@ -426,7 +446,7 @@ fn render_open_header(msg: &ShowThreadQueryThreadMessages) -> Node<Msg> {
|
||||
table![
|
||||
IF!(!msg.to.is_empty() =>
|
||||
tr![
|
||||
td![ "To" ],
|
||||
td![ "To:" ],
|
||||
//td![ if i==0 { "To" }else { "" } ],
|
||||
td![
|
||||
msg.to.iter().enumerate().map(|(i, to)|
|
||||
@ -452,7 +472,7 @@ fn render_open_header(msg: &ShowThreadQueryThreadMessages) -> Node<Msg> {
|
||||
]),
|
||||
IF!(!msg.cc.is_empty() =>
|
||||
tr![
|
||||
td![ "CC" ],
|
||||
td![ "CC:" ],
|
||||
td![
|
||||
msg.cc.iter().enumerate().map(|(i, cc)|
|
||||
small![
|
||||
@ -475,10 +495,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)])
|
||||
]]
|
||||
],
|
||||
],
|
||||
],
|
||||
@ -641,7 +661,12 @@ fn message_render(msg: &ShowThreadQueryThreadMessages, open: bool) -> Node<Msg>
|
||||
#[topo::nested]
|
||||
fn thread(thread: &ShowThreadQueryThread, open_messages: &HashSet<String>) -> Node<Msg> {
|
||||
// TODO(wathiede): show per-message subject if it changes significantly from top-level subject
|
||||
set_title(&thread.subject);
|
||||
let subject = if thread.subject.is_empty() {
|
||||
"(no subject)"
|
||||
} else {
|
||||
&thread.subject
|
||||
};
|
||||
set_title(subject);
|
||||
let mut tags: Vec<_> = thread
|
||||
.messages
|
||||
.iter()
|
||||
@ -660,7 +685,7 @@ fn thread(thread: &ShowThreadQueryThread, open_messages: &HashSet<String>) -> No
|
||||
let unread_thread_id = thread.thread_id.clone();
|
||||
div![
|
||||
C!["thread"],
|
||||
h3![C!["is-size-5"], &thread.subject],
|
||||
h3![C!["is-size-5"], subject],
|
||||
span![C!["tags"], tags_chiclet(&tags, false)],
|
||||
span![
|
||||
// TODO(wathiede): add "Mark as spam"
|
||||
@ -746,7 +771,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",
|
||||
],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user