Compare commits

..

No commits in common. "72622032ad7a3187e35ce244a358a8cc54263e00" and "7bfef154d9eeca5c745402b46d10f726d422c430" have entirely different histories.

3 changed files with 9 additions and 26 deletions

1
dev.sh
View File

@ -1,4 +1,3 @@
cd -- "$( dirname -- "${BASH_SOURCE[0]}" )"
tmux new-session -d -s letterbox-dev
tmux rename-window web
tmux send-keys "cd web; trunk serve --release --address 0.0.0.0 --port 6758 --proxy-backend http://localhost:9345/ --proxy-rewrite=/api/ -w ../shared -w ../notmuch -w ./" C-m

View File

@ -5,7 +5,6 @@ enum MatchType {
From,
Sender,
To,
Cc,
Subject,
List,
DeliveredTo,
@ -82,11 +81,6 @@ impl FromStr for Match {
match_type: MatchType::From,
needle: cleanup_match(FROM, needle),
});
} else if needle.starts_with(CC) {
return Ok(Match {
match_type: MatchType::Cc,
needle: cleanup_match(CC, needle),
});
} else if needle.starts_with(TOCC) {
return Ok(Match {
match_type: MatchType::To,
@ -94,7 +88,7 @@ impl FromStr for Match {
});
} else if needle.starts_with(SENDER) {
return Ok(Match {
match_type: MatchType::Sender,
match_type: MatchType::From,
needle: cleanup_match(SENDER, needle),
});
} else if needle.starts_with(SUBJECT) {
@ -146,6 +140,7 @@ impl FromStr for Match {
needle: cleanup_match("", &needle),
});
}
Ok(Match::default())
}
}
@ -166,7 +161,6 @@ fn notmuch_from_rules<W: Write>(mut w: W, rules: &[Rule]) -> anyhow::Result<()>
// TODO(wathiede): something more specific?
MatchType::Sender => "from:",
MatchType::To => "to:",
MatchType::Cc => "to:",
MatchType::Subject => "subject:",
MatchType::List => "List-ID:",
MatchType::Body => "",

View File

@ -8,7 +8,7 @@ use std::{
};
use itertools::Itertools;
use log::{debug, error, info, Level};
use log::{debug, error, info, warn, Level};
use notmuch::{Content, Part, Thread, ThreadNode, ThreadSet};
use seed::{prelude::*, *};
use serde::de::Deserialize;
@ -512,8 +512,7 @@ fn view_mobile_search_results(query: &str, search_results: &shared::SearchResult
div![
h1!["Search results"],
view_search_pager(first, summaries.len(), search_results.total),
rows,
view_search_pager(first, summaries.len(), search_results.total)
rows
]
}
@ -565,35 +564,26 @@ fn view_search_results(query: &str, search_results: &shared::SearchResult) -> No
th![C!["date"], "Date"]
]],
tbody![rows]
],
view_search_pager(first, summaries.len(), search_results.total)
]
]
}
fn view_search_pager(start: usize, count: usize, total: usize) -> Node<Msg> {
let is_first = start <= 0;
let is_last = (start + SEARCH_RESULTS_PER_PAGE) >= total;
fn view_search_pager(page: usize, count: usize, total: usize) -> Node<Msg> {
nav![
C!["pagination"],
a![
C![
"pagination-previous",
"button",
IF!(is_first => "is-static"),
IF!(is_first => "is-info"),
],
C!["pagination-previous", "button"],
"<",
ev(Ev::Click, |_| Msg::PreviousPage)
],
a![
C!["pagination-next", "button", IF!(is_last => "is-static")],
IF!(is_last => attrs!{ At::Disabled=>true }),
C!["pagination-next", "button"],
">",
ev(Ev::Click, |_| Msg::NextPage)
],
ul![
C!["pagination-list"],
li![format!("{} - {} of {}", start, start + count, total)],
li![format!("{} - {} of {}", page, page + count, total)],
],
]
}