Compare commits
No commits in common. "00e8b0342edce054b89ee2165d5355d275fda1ae" and "e1a502ac4b671da765a00367250cfd357c5df61e" have entirely different histories.
00e8b0342e
...
e1a502ac4b
10
Cargo.lock
generated
10
Cargo.lock
generated
@ -2965,7 +2965,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "letterbox-notmuch"
|
||||
version = "0.9.2"
|
||||
version = "0.9.1"
|
||||
dependencies = [
|
||||
"itertools 0.14.0",
|
||||
"log",
|
||||
@ -2980,14 +2980,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "letterbox-procmail2notmuch"
|
||||
version = "0.9.2"
|
||||
version = "0.9.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "letterbox-server"
|
||||
version = "0.9.2"
|
||||
version = "0.9.1"
|
||||
dependencies = [
|
||||
"ammonia",
|
||||
"anyhow",
|
||||
@ -3030,7 +3030,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "letterbox-shared"
|
||||
version = "0.9.2"
|
||||
version = "0.9.1"
|
||||
dependencies = [
|
||||
"build-info",
|
||||
"letterbox-notmuch",
|
||||
@ -3039,7 +3039,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "letterbox-web"
|
||||
version = "0.9.2"
|
||||
version = "0.9.1"
|
||||
dependencies = [
|
||||
"build-info",
|
||||
"build-info-build",
|
||||
|
||||
@ -8,7 +8,7 @@ authors = ["Bill Thiede <git@xinu.tv>"]
|
||||
edition = "2021"
|
||||
license = "UNLICENSED"
|
||||
publish = ["xinu"]
|
||||
version = "0.9.2"
|
||||
version = "0.9.1"
|
||||
repository = "https://git.z.xinu.tv/wathiede/letterbox"
|
||||
|
||||
[profile.dev]
|
||||
|
||||
@ -48,8 +48,8 @@ urlencoding = "2.1.3"
|
||||
#xtracing = { path = "../../xtracing" }
|
||||
#xtracing = { git = "http://git-private.h.xinu.tv/wathiede/xtracing.git" }
|
||||
xtracing = { version = "0.3.0", registry = "xinu" }
|
||||
letterbox-notmuch = { version = "0.9.2", path = "../notmuch", registry = "xinu" }
|
||||
letterbox-shared = { version = "0.9.2", path = "../shared", registry = "xinu" }
|
||||
letterbox-notmuch = { version = "0.9.1", path = "../notmuch", registry = "xinu" }
|
||||
letterbox-shared = { version = "0.9.1", path = "../shared", registry = "xinu" }
|
||||
|
||||
[build-dependencies]
|
||||
build-info-build = "0.0.39"
|
||||
|
||||
@ -331,15 +331,10 @@ impl QueryRoot {
|
||||
notmuch_results.len(),
|
||||
);
|
||||
|
||||
let mut results: Vec<_> = newsreader_results
|
||||
let results: Vec<_> = newsreader_results
|
||||
.into_iter()
|
||||
.chain(notmuch_results)
|
||||
.collect();
|
||||
// The leading '-' is to reverse sort
|
||||
results.sort_by_key(|item| match item {
|
||||
ThreadSummaryCursor::Newsreader(_, ts) => -ts.timestamp,
|
||||
ThreadSummaryCursor::Notmuch(_, ts) => -ts.timestamp,
|
||||
});
|
||||
let ids = results
|
||||
.into_iter()
|
||||
.map(|r| match r {
|
||||
|
||||
@ -12,5 +12,5 @@ version.workspace = true
|
||||
|
||||
[dependencies]
|
||||
build-info = "0.0.39"
|
||||
letterbox-notmuch = { version = "0.9.2", path = "../notmuch", registry = "xinu" }
|
||||
letterbox-notmuch = { version = "0.9.1", path = "../notmuch", registry = "xinu" }
|
||||
serde = { version = "1.0.147", features = ["derive"] }
|
||||
|
||||
@ -33,8 +33,8 @@ wasm-bindgen = "=0.2.100"
|
||||
uuid = { version = "1.13.1", features = [
|
||||
"js",
|
||||
] } # direct dep to set js feature, prevents Rng issues
|
||||
letterbox-shared = { version = "0.9.2", path = "../shared", registry = "xinu" }
|
||||
letterbox-notmuch = { version = "0.9.2", path = "../notmuch", registry = "xinu" }
|
||||
letterbox-shared = { version = "0.9.1", path = "../shared", registry = "xinu" }
|
||||
letterbox-notmuch = { version = "0.9.1", path = "../notmuch", registry = "xinu" }
|
||||
seed_hooks = { version = "0.4.0", registry = "xinu" }
|
||||
|
||||
[package.metadata.wasm-pack.profile.release]
|
||||
|
||||
@ -59,20 +59,13 @@ pub fn init(url: Url, orders: &mut impl Orders<Msg>) -> Model {
|
||||
|
||||
fn on_url_changed(uc: subs::UrlChanged) -> Msg {
|
||||
let mut url = uc.0;
|
||||
let href = document().location().unwrap().href().unwrap();
|
||||
let origin = document().location().unwrap().origin().unwrap();
|
||||
let current_url = &href[origin.len()..];
|
||||
let did_change = current_url != url.to_string();
|
||||
let mut messages = Vec::new();
|
||||
if did_change {
|
||||
messages.push(Msg::ScrollToTop)
|
||||
}
|
||||
info!(
|
||||
"url changed\nold '{current_url}'\nnew '{url}', history {}",
|
||||
"url changed '{}', history {}",
|
||||
url,
|
||||
history().length().unwrap_or(0)
|
||||
);
|
||||
let hpp = url.remaining_hash_path_parts();
|
||||
let msg = match hpp.as_slice() {
|
||||
match hpp.as_slice() {
|
||||
["t", tid] => Msg::ShowThreadRequest {
|
||||
thread_id: tid.to_string(),
|
||||
},
|
||||
@ -109,9 +102,7 @@ fn on_url_changed(uc: subs::UrlChanged) -> Msg {
|
||||
last: None,
|
||||
}
|
||||
}
|
||||
};
|
||||
messages.push(msg);
|
||||
Msg::MultiMsg(messages)
|
||||
}
|
||||
}
|
||||
|
||||
// `update` describes how to handle each `Msg`.
|
||||
@ -317,6 +308,7 @@ pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
||||
})
|
||||
.collect(),
|
||||
);
|
||||
info!("pager {:#?}", data.search.page_info);
|
||||
let selected_threads = 'context: {
|
||||
if let Context::SearchResult {
|
||||
results,
|
||||
@ -544,10 +536,6 @@ pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
||||
.expect("failed to copy to clipboard");
|
||||
});
|
||||
}
|
||||
Msg::ScrollToTop => {
|
||||
info!("scrolling to the top");
|
||||
web_sys::window().unwrap().scroll_to_with_x_and_y(0., 0.);
|
||||
}
|
||||
Msg::WindowScrolled => {
|
||||
if let Some(el) = model.content_el.get() {
|
||||
let ih = window()
|
||||
@ -620,7 +608,6 @@ pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
||||
orders.send_msg(Msg::CatchupNext);
|
||||
}
|
||||
Msg::CatchupNext => {
|
||||
orders.send_msg(Msg::ScrollToTop);
|
||||
let Some(catchup) = &mut model.catchup else {
|
||||
orders.send_msg(Msg::GoToSearchResults);
|
||||
return;
|
||||
@ -790,7 +777,6 @@ pub enum Msg {
|
||||
|
||||
CopyToClipboard(String),
|
||||
|
||||
ScrollToTop,
|
||||
WindowScrolled,
|
||||
SetProgress(f64),
|
||||
UpdateServerVersion(String),
|
||||
|
||||
@ -4,7 +4,7 @@ use chrono::{DateTime, Datelike, Duration, Local, Utc};
|
||||
use human_format::{Formatter, Scales};
|
||||
use itertools::Itertools;
|
||||
use letterbox_shared::compute_color;
|
||||
use log::{debug, error};
|
||||
use log::{debug, error, info};
|
||||
use seed::{prelude::*, *};
|
||||
use seed_hooks::{state_access::CloneState, topo, use_state, StateAccessEventHandlers};
|
||||
use web_sys::{HtmlElement, HtmlInputElement};
|
||||
@ -217,14 +217,12 @@ fn catchup_view(
|
||||
],
|
||||
button![
|
||||
C![&tw_classes::BUTTON],
|
||||
span![i![C!["far", "fa-envelope"]]],
|
||||
span![C!["pl-2"], "Keep unread"],
|
||||
"Keep unread",
|
||||
ev(Ev::Click, move |_| Msg::CatchupKeepUnread)
|
||||
],
|
||||
button![
|
||||
C![&tw_classes::BUTTON, "bg-green-500"],
|
||||
span![i![C!["far", "fa-envelope-open"]]],
|
||||
span![C!["pl-2"], "Mark as read"],
|
||||
"Mark as read",
|
||||
ev(Ev::Click, move |_| Msg::CatchupMarkAsRead)
|
||||
]
|
||||
],
|
||||
@ -1067,7 +1065,7 @@ fn thread(
|
||||
let spam_add_thread_id = thread.thread_id.clone();
|
||||
let spam_unread_thread_id = thread.thread_id.clone();
|
||||
div![
|
||||
C!["lg:p-4", "max-w-4xl"],
|
||||
C!["lg:p-4"],
|
||||
div![
|
||||
C!["p-4", "lg:p-0"],
|
||||
h3![C!["text-xl"], subject],
|
||||
@ -1252,7 +1250,11 @@ pub fn view_tags(tags: &Option<Vec<Tag>>) -> Node<Msg> {
|
||||
],
|
||||
IF!(t.unread>0 => format!("{}", t.unread))
|
||||
],
|
||||
ev(Ev::Click, |_| { Msg::ScrollToTop })
|
||||
ev(Ev::Click, |_| {
|
||||
// Scroll window to the top when searching for a tag.
|
||||
info!("scrolling to the top because you clicked a tag");
|
||||
web_sys::window().unwrap().scroll_to_with_x_and_y(0., 0.);
|
||||
})
|
||||
]
|
||||
}
|
||||
fn matches(a: &[&str], b: &[&str]) -> usize {
|
||||
@ -1540,6 +1542,8 @@ fn click_to_top() -> Node<Msg> {
|
||||
C![&tw_classes::BUTTON, "bg-red-500", "lg:m-0", "m-4"],
|
||||
span!["Top"],
|
||||
span![i![C!["fas", "fa-arrow-turn-up"]]],
|
||||
ev(Ev::Click, |_| Msg::ScrollToTop)
|
||||
ev(Ev::Click, |_| web_sys::window()
|
||||
.unwrap()
|
||||
.scroll_to_with_x_and_y(0., 0.))
|
||||
]
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user