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