Compare commits
No commits in common. "7df11639edc4dccf6b9e9503e9ca1a99a340c3f9" and "8abf9398e9e86ffe1b951b7e02b9252ca87c7d41" have entirely different histories.
7df11639ed
...
8abf9398e9
@ -42,6 +42,7 @@ pub fn init(url: Url, orders: &mut impl Orders<Msg>) -> Model {
|
||||
context: Context::None,
|
||||
query: "".to_string(),
|
||||
refreshing_state: RefreshingState::None,
|
||||
ui_error: UIError::NoError,
|
||||
tags: None,
|
||||
}
|
||||
}
|
||||
@ -449,6 +450,7 @@ pub struct Model {
|
||||
pub query: String,
|
||||
pub context: Context,
|
||||
pub refreshing_state: RefreshingState,
|
||||
pub ui_error: UIError,
|
||||
pub tags: Option<Vec<Tag>>,
|
||||
}
|
||||
|
||||
|
||||
@ -9,28 +9,20 @@ use crate::{
|
||||
|
||||
#[topo::nested]
|
||||
pub(super) fn view(model: &Model) -> Node<Msg> {
|
||||
let show_icon_text = true;
|
||||
// Do two queries, one without `unread` so it loads fast, then a second with unread.
|
||||
let content = match &model.context {
|
||||
Context::None => div![h1!["Loading"]],
|
||||
Context::ThreadResult {
|
||||
thread,
|
||||
open_messages,
|
||||
} => view::thread(thread, open_messages, show_icon_text),
|
||||
} => view::thread(thread, open_messages),
|
||||
Context::SearchResult {
|
||||
query,
|
||||
results,
|
||||
count,
|
||||
pager,
|
||||
selected_threads,
|
||||
} => view_search_results(
|
||||
&query,
|
||||
results.as_slice(),
|
||||
*count,
|
||||
pager,
|
||||
selected_threads,
|
||||
show_icon_text,
|
||||
),
|
||||
} => view_search_results(&query, results.as_slice(), *count, pager, selected_threads),
|
||||
};
|
||||
fn view_tag_li(display_name: &str, indent: usize, t: &Tag, search_unread: bool) -> Node<Msg> {
|
||||
let href = if search_unread {
|
||||
|
||||
@ -10,27 +10,19 @@ use crate::{
|
||||
};
|
||||
|
||||
pub(super) fn view(model: &Model) -> Node<Msg> {
|
||||
let show_icon_text = false;
|
||||
let content = match &model.context {
|
||||
Context::None => div![h1!["Loading"]],
|
||||
Context::ThreadResult {
|
||||
thread,
|
||||
open_messages,
|
||||
} => view::thread(thread, open_messages, show_icon_text),
|
||||
} => view::thread(thread, open_messages),
|
||||
Context::SearchResult {
|
||||
query,
|
||||
results,
|
||||
count,
|
||||
pager,
|
||||
selected_threads,
|
||||
} => search_results(
|
||||
&query,
|
||||
results.as_slice(),
|
||||
*count,
|
||||
pager,
|
||||
selected_threads,
|
||||
show_icon_text,
|
||||
),
|
||||
} => search_results(&query, results.as_slice(), *count, pager, selected_threads),
|
||||
};
|
||||
div![
|
||||
view_header(&model.query, &model.refreshing_state),
|
||||
@ -45,7 +37,6 @@ fn search_results(
|
||||
count: usize,
|
||||
pager: &FrontPageQuerySearchPageInfo,
|
||||
selected_threads: &HashSet<String>,
|
||||
show_icon_text: bool,
|
||||
) -> Node<Msg> {
|
||||
if query.is_empty() {
|
||||
set_title("all mail");
|
||||
@ -105,8 +96,8 @@ fn search_results(
|
||||
let show_bulk_edit = !selected_threads.is_empty();
|
||||
div![
|
||||
C!["search-results"],
|
||||
search_toolbar(count, pager, show_bulk_edit, show_icon_text),
|
||||
search_toolbar(count, pager, show_bulk_edit),
|
||||
div![C!["index"], rows],
|
||||
search_toolbar(count, pager, show_bulk_edit, show_icon_text),
|
||||
search_toolbar(count, pager, show_bulk_edit),
|
||||
]
|
||||
}
|
||||
|
||||
@ -116,7 +116,6 @@ fn view_search_results(
|
||||
count: usize,
|
||||
pager: &FrontPageQuerySearchPageInfo,
|
||||
selected_threads: &HashSet<String>,
|
||||
show_icon_text: bool,
|
||||
) -> Node<Msg> {
|
||||
if query.is_empty() {
|
||||
set_title("all mail");
|
||||
@ -204,7 +203,7 @@ fn view_search_results(
|
||||
|
||||
div![
|
||||
C!["search-results"],
|
||||
search_toolbar(count, pager, show_bulk_edit, show_icon_text),
|
||||
search_toolbar(count, pager, show_bulk_edit),
|
||||
table![
|
||||
C![
|
||||
"table",
|
||||
@ -240,7 +239,7 @@ fn view_search_results(
|
||||
]],
|
||||
tbody![rows]
|
||||
],
|
||||
search_toolbar(count, pager, show_bulk_edit, show_icon_text)
|
||||
search_toolbar(count, pager, show_bulk_edit)
|
||||
]
|
||||
}
|
||||
|
||||
@ -248,7 +247,6 @@ fn search_toolbar(
|
||||
count: usize,
|
||||
pager: &FrontPageQuerySearchPageInfo,
|
||||
show_bulk_edit: bool,
|
||||
show_icon_text: bool,
|
||||
) -> Node<Msg> {
|
||||
let start = pager
|
||||
.start_cursor
|
||||
@ -256,42 +254,36 @@ fn search_toolbar(
|
||||
.map(|i| i.parse().unwrap_or(0))
|
||||
.unwrap_or(0);
|
||||
nav![
|
||||
C!["level", "is-mobile"],
|
||||
IF!(show_bulk_edit =>
|
||||
div![
|
||||
C!["level-left"],
|
||||
div![
|
||||
C!["level-item"],
|
||||
div![C!["buttons", "has-addons"],
|
||||
button![
|
||||
C!["button", "spam"],
|
||||
attrs!{At::Title => "Mark as spam"},
|
||||
C!["level"],
|
||||
div![
|
||||
C!["level-left"],
|
||||
IF!(show_bulk_edit =>
|
||||
span![
|
||||
// TODO(wathiede): add "Mark as spam"
|
||||
C!["level-item", "buttons", "has-addons"],
|
||||
button![
|
||||
C!["button"],
|
||||
attrs!{At::Title => "Mark as spam"},
|
||||
span![C!["icon", "is-small"], i![C!["far", "fa-hand"]]],
|
||||
IF!(show_icon_text=>span!["Spam"]),
|
||||
span!["Spam"],
|
||||
ev(Ev::Click, |_| Msg::SelectionAddTag("Spam".to_string()))
|
||||
],
|
||||
],
|
||||
],
|
||||
div![
|
||||
C!["level-item"],
|
||||
div![C!["buttons", "has-addons"],
|
||||
button![
|
||||
C!["button", "mark-read"],
|
||||
attrs!{At::Title => "Mark as read"},
|
||||
button![
|
||||
C!["button"],
|
||||
attrs!{At::Title => "Mark as read"},
|
||||
span![C!["icon", "is-small"], i![C!["far", "fa-envelope-open"]]],
|
||||
IF!(show_icon_text=>span!["Read"]),
|
||||
span!["Read"],
|
||||
ev(Ev::Click, |_| Msg::SelectionMarkAsRead)
|
||||
],
|
||||
button![
|
||||
C!["button", "mark-unread"],
|
||||
attrs!{At::Title => "Mark as unread"},
|
||||
],
|
||||
button![
|
||||
C!["button"],
|
||||
attrs!{At::Title => "Mark as unread"},
|
||||
span![C!["icon", "is-small"], i![C!["far", "fa-envelope"]]],
|
||||
IF!(show_icon_text=>span!["Unread"]),
|
||||
span!["Unread"],
|
||||
ev(Ev::Click, |_| Msg::SelectionMarkAsUnread)
|
||||
]
|
||||
]
|
||||
]
|
||||
]),
|
||||
]),
|
||||
],
|
||||
div![
|
||||
C!["level-right"],
|
||||
nav![
|
||||
@ -712,11 +704,7 @@ fn message_render(msg: &ShowThreadQueryThreadMessages, open: bool) -> Node<Msg>
|
||||
}
|
||||
|
||||
#[topo::nested]
|
||||
fn thread(
|
||||
thread: &ShowThreadQueryThread,
|
||||
open_messages: &HashSet<String>,
|
||||
show_icon_text: bool,
|
||||
) -> 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
|
||||
let subject = if thread.subject.is_empty() {
|
||||
"(no subject)"
|
||||
@ -745,49 +733,37 @@ fn thread(
|
||||
C!["thread"],
|
||||
h3![C!["is-size-5"], subject],
|
||||
span![C!["tags"], tags_chiclet(&tags, false)],
|
||||
div![
|
||||
C!["level", "is-mobile"],
|
||||
div![
|
||||
C!["level-item"],
|
||||
div![
|
||||
C!["buttons", "has-addons"],
|
||||
button![
|
||||
C!["button", "spam"],
|
||||
attrs! {At::Title => "Spam"},
|
||||
span![C!["icon", "is-small"], i![C!["far", "fa-hand"]]],
|
||||
IF!(show_icon_text=>span!["Spam"]),
|
||||
ev(Ev::Click, move |_| Msg::AddTag(
|
||||
format!("thread:{spam_thread_id}"),
|
||||
"Spam".to_string()
|
||||
)),
|
||||
],
|
||||
],
|
||||
span![
|
||||
C!["level-item", "buttons", "has-addons"],
|
||||
button![
|
||||
C!["button"],
|
||||
attrs! {At::Title => "Spam"},
|
||||
span![C!["icon", "is-small"], i![C!["far", "fa-hand"]]],
|
||||
span!["Spam"],
|
||||
ev(Ev::Click, move |_| Msg::AddTag(
|
||||
format!("thread:{spam_thread_id}"),
|
||||
"Spam".to_string()
|
||||
)),
|
||||
],
|
||||
div![
|
||||
C!["level-item"],
|
||||
div![
|
||||
C!["buttons", "has-addons"],
|
||||
button![
|
||||
C!["button", "mark-read"],
|
||||
attrs! {At::Title => "Mark as read"},
|
||||
span![C!["icon", "is-small"], i![C!["far", "fa-envelope-open"]]],
|
||||
IF!(show_icon_text=>span!["Read"]),
|
||||
ev(Ev::Click, move |_| Msg::SetUnread(
|
||||
format!("thread:{read_thread_id}"),
|
||||
false
|
||||
)),
|
||||
],
|
||||
button![
|
||||
C!["button", "mark-unread"],
|
||||
attrs! {At::Title => "Mark as unread"},
|
||||
span![C!["icon", "is-small"], i![C!["far", "fa-envelope"]]],
|
||||
IF!(show_icon_text=>span!["Unread"]),
|
||||
ev(Ev::Click, move |_| Msg::SetUnread(
|
||||
format!("thread:{unread_thread_id}"),
|
||||
true
|
||||
)),
|
||||
],
|
||||
],
|
||||
button![
|
||||
C!["button"],
|
||||
attrs! {At::Title => "Mark as read"},
|
||||
span![C!["icon", "is-small"], i![C!["far", "fa-envelope-open"]]],
|
||||
span!["Read"],
|
||||
ev(Ev::Click, move |_| Msg::SetUnread(
|
||||
format!("thread:{read_thread_id}"),
|
||||
false
|
||||
)),
|
||||
],
|
||||
button![
|
||||
C!["button"],
|
||||
attrs! {At::Title => "Mark as unread"},
|
||||
span![C!["icon", "is-small"], i![C!["far", "fa-envelope"]]],
|
||||
span!["Unread"],
|
||||
ev(Ev::Click, move |_| Msg::SetUnread(
|
||||
format!("thread:{unread_thread_id}"),
|
||||
true
|
||||
)),
|
||||
],
|
||||
],
|
||||
messages,
|
||||
|
||||
@ -6,28 +6,20 @@ use crate::{
|
||||
};
|
||||
|
||||
pub(super) fn view(model: &Model) -> Node<Msg> {
|
||||
let show_icon_text = false;
|
||||
// Do two queries, one without `unread` so it loads fast, then a second with unread.
|
||||
let content = match &model.context {
|
||||
Context::None => div![h1!["Loading"]],
|
||||
Context::ThreadResult {
|
||||
thread,
|
||||
open_messages,
|
||||
} => view::thread(thread, open_messages, show_icon_text),
|
||||
} => view::thread(thread, open_messages),
|
||||
Context::SearchResult {
|
||||
query,
|
||||
results,
|
||||
count,
|
||||
pager,
|
||||
selected_threads,
|
||||
} => view_search_results(
|
||||
&query,
|
||||
results.as_slice(),
|
||||
*count,
|
||||
pager,
|
||||
selected_threads,
|
||||
show_icon_text,
|
||||
),
|
||||
} => view_search_results(&query, results.as_slice(), *count, pager, selected_threads),
|
||||
};
|
||||
div![
|
||||
C!["main-content"],
|
||||
|
||||
@ -282,7 +282,3 @@ display: none;
|
||||
.attachment .card-content {
|
||||
padding: 0.5rem 1.5rem;
|
||||
}
|
||||
|
||||
.button.spam {
|
||||
color: #f00;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user