Compare commits

..

No commits in common. "e01dabe6ed8d6cb9cecc1aebdda7679f5b058558" and "d53db5b49a377c076ce5d97714c9439aadbd6b64" have entirely different histories.

7 changed files with 87 additions and 119 deletions

10
Cargo.lock generated
View File

@ -3001,7 +3001,7 @@ dependencies = [
[[package]]
name = "letterbox-notmuch"
version = "0.12.0"
version = "0.10.13"
dependencies = [
"itertools",
"log",
@ -3016,14 +3016,14 @@ dependencies = [
[[package]]
name = "letterbox-procmail2notmuch"
version = "0.12.0"
version = "0.10.13"
dependencies = [
"anyhow",
]
[[package]]
name = "letterbox-server"
version = "0.12.0"
version = "0.10.13"
dependencies = [
"ammonia",
"anyhow",
@ -3065,7 +3065,7 @@ dependencies = [
[[package]]
name = "letterbox-shared"
version = "0.12.0"
version = "0.10.13"
dependencies = [
"build-info",
"letterbox-notmuch",
@ -3074,7 +3074,7 @@ dependencies = [
[[package]]
name = "letterbox-web"
version = "0.12.0"
version = "0.10.13"
dependencies = [
"build-info",
"build-info-build",

View File

@ -8,7 +8,7 @@ authors = ["Bill Thiede <git@xinu.tv>"]
edition = "2021"
license = "UNLICENSED"
publish = ["xinu"]
version = "0.12.0"
version = "0.10.13"
repository = "https://git.z.xinu.tv/wathiede/letterbox"
[profile.dev]

View File

@ -47,8 +47,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.12.0", path = "../notmuch", registry = "xinu" }
letterbox-shared = { version = "0.12.0", path = "../shared", registry = "xinu" }
letterbox-notmuch = { version = "0.10.13", path = "../notmuch", registry = "xinu" }
letterbox-shared = { version = "0.10.13", path = "../shared", registry = "xinu" }
[build-dependencies]
build-info-build = "0.0.40"

View File

@ -12,5 +12,5 @@ version.workspace = true
[dependencies]
build-info = "0.0.40"
letterbox-notmuch = { version = "0.12.0", path = "../notmuch", registry = "xinu" }
letterbox-notmuch = { version = "0.10.13", path = "../notmuch", registry = "xinu" }
serde = { version = "1.0.147", features = ["derive"] }

View File

@ -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.12.0", path = "../shared", registry = "xinu" }
letterbox-notmuch = { version = "0.12.0", path = "../notmuch", registry = "xinu" }
letterbox-shared = { version = "0.10.13", path = "../shared", registry = "xinu" }
letterbox-notmuch = { version = "0.10.13", path = "../notmuch", registry = "xinu" }
seed_hooks = { version = "0.4.0", registry = "xinu" }
strum_macros = "0.27.1"

View File

@ -616,6 +616,9 @@ pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
orders.send_msg(Msg::CatchupRequest { query });
}
Msg::CatchupKeepUnread => {
if let Some(thread_id) = current_thread_id(&model.context) {
orders.send_msg(Msg::SetUnread(thread_id, true));
};
orders.send_msg(Msg::CatchupNext);
}
Msg::CatchupMarkAsRead => {
@ -630,15 +633,7 @@ pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
orders.send_msg(Msg::GoToSearchResults);
return;
};
let Some(thread_id) = current_thread_id(&model.context) else {
return;
};
let Some(idx) = catchup
.items
.iter()
.inspect(|i| info!("i {i:?} thread_id {thread_id}"))
.position(|i| i.id == thread_id)
else {
let Some(idx) = catchup.items.iter().position(|i| !i.seen) else {
// All items have been seen
orders.send_msg(Msg::CatchupExit);
orders.send_msg(Msg::GoToSearchResults);
@ -731,7 +726,6 @@ pub struct Catchup {
pub items: Vec<CatchupItem>,
}
#[derive(Debug)]
pub struct CatchupItem {
pub id: String,
pub seen: bool,
@ -765,7 +759,6 @@ pub enum Msg {
NextPage,
PreviousPage,
GoToSearchResults,
UpdateQuery(String),
SearchQuery(String),

View File

@ -12,7 +12,7 @@ use web_sys::{HtmlElement, HtmlInputElement};
use crate::{
api::urls,
graphql::{front_page_query::*, show_thread_query::*},
state::{CatchupItem, Context, Model, Msg, RefreshingState, Tag, Version},
state::{unread_query, CatchupItem, Context, Model, Msg, RefreshingState, Tag, Version},
};
// TODO(wathiede): create a QueryString enum that wraps single and multiple message ids and thread
@ -468,42 +468,38 @@ fn search_toolbar(
if let Some(tri) = tri.get() {
tri.set_indeterminate(indeterminate);
}
let catchup = div![button![
tw_classes::button(),
attrs! {At::Title => "Catch up"},
span![i![C!["far", "fa-eye"]]],
span![C!["pl-2", "hidden", "md:inline"], "Catch-up"],
ev(Ev::Click, |_| Msg::CatchupStart)
]];
let tristate_input = div![
C!["flex", "items-center", "mr-4"],
input![
&tri,
C![&tw_classes::CHECKBOX],
attrs! {
At::Type=>"checkbox",
},
IF!(all_selected=>attrs!{At::Checked=>true})
],
ev(Ev::Input, move |_| {
if all_selected {
Msg::SelectionSetNone
} else {
Msg::SelectionSetAll
}
}),
];
nav![
C!["py-4", "flex", "w-full", "justify-between"],
div![
C!["gap-2", "flex", IF!(show_bulk_edit => "hidden")],
&tristate_input,
&catchup
div![button![
tw_classes::button(),
attrs! {At::Title => "Mark as read"},
span![i![C!["far", "fa-eye"]]],
span![C!["pl-2", "hidden", "md:inline"], "Catch-up"],
ev(Ev::Click, |_| Msg::CatchupStart)
]],
],
div![
C!["gap-2", "flex", IF!(!show_bulk_edit => "hidden")],
&tristate_input,
&catchup,
div![
C!["flex", "items-center", "mr-4"],
input![
tri,
C![&tw_classes::CHECKBOX],
attrs! {
At::Type=>"checkbox",
At::Checked=>all_selected,
}
],
ev(Ev::Input, move |_| {
if all_selected {
Msg::SelectionSetNone
} else {
Msg::SelectionSetAll
}
}),
],
div![
button![
tw_classes::button(),
@ -1212,68 +1208,47 @@ fn view_header(
let query = Url::decode_uri_component(query).unwrap_or("".to_string());
nav![
C!["flex", "flex-col"],
div![
C!["flex-auto", "flex"],
button![
C![IF![is_error => "bg-red-500"], "rounded-none"],
tw_classes::button(),
span![i![C![
"fa-solid",
"fa-arrow-rotate-right",
IF![is_loading => "animate-spin"],
]]],
ev(Ev::Click, |_| Msg::RefreshStart),
],
button![
tw_classes::button(),
C!["grow", "rounded-none"],
"All",
ev(Ev::Click, |_| Msg::SearchQuery(String::new())),
],
button![
tw_classes::button(),
C!["grow", "rounded-none"],
span![i![C!["far", "fa-envelope"]]],
" Unread",
ev(Ev::Click, |_| Msg::SearchQuery("is:unread".to_string())),
],
button![
tw_classes::button(),
C!["grow", "rounded-none"],
span![i![C!["far", "fa-envelope"]]],
" News",
ev(Ev::Click, |_| Msg::SearchQuery(
"is:unread is:news".to_string()
)),
],
button![
tw_classes::button(),
C!["grow", "rounded-none"],
span![i![C!["far", "fa-envelope"]]],
" Mail",
ev(Ev::Click, |_| Msg::SearchQuery(
"is:unread is:mail".to_string()
)),
],
C!["flex", "px-4", "pt-4", "overflow-hidden"],
a![
C![IF![is_error => "bg-red-500"], "rounded-r-none"],
tw_classes::button(),
span![i![C![
"fa-solid",
"fa-arrow-rotate-right",
IF![is_loading => "animate-spin"],
]]],
ev(Ev::Click, |_| Msg::RefreshStart),
],
div![
C!["flex-auto", "flex"],
input![
C!["grow", "text-black", "m-2", "p-1"],
attrs! {
At::Placeholder => "Search";
At::AutoFocus => auto_focus_search.as_at_value();
At::Value => query,
},
input_ev(Ev::Input, |q| Msg::UpdateQuery(q)),
// Send search on enter.
keyboard_ev(Ev::KeyUp, move |e| if e.key_code() == 0x0d {
Msg::SearchQuery(query)
} else {
Msg::Noop
}),
]
a![
tw_classes::button(),
C!["px-4", "rounded-none"],
attrs! {
At::Href => urls::search(unread_query(), 0)
},
"Unread",
],
a![
tw_classes::button(),
C!["px-4", "rounded-none"],
attrs! {
At::Href => urls::search("", 0)
},
"All",
],
input![
C!["grow", "pl-2", "text-black", "rounded-r"],
attrs! {
At::Placeholder => "Search";
At::AutoFocus => auto_focus_search.as_at_value();
At::Value => query,
},
input_ev(Ev::Input, |q| Msg::UpdateQuery(q)),
// Send search on enter.
keyboard_ev(Ev::KeyUp, move |e| if e.key_code() == 0x0d {
Msg::SearchQuery(query)
} else {
Msg::Noop
}),
]
]
}
@ -1580,12 +1555,12 @@ fn render_news_post_header(post: &ShowThreadQueryThreadOnNewsPost) -> Node<Msg>
} else {
"fa-envelope-open"
},
]],
ev(Ev::Click, move |e| {
e.stop_propagation();
Msg::SetUnread(id, !is_unread)
})
]
]]
],
ev(Ev::Click, move |e| {
e.stop_propagation();
Msg::SetUnread(id, !is_unread)
})
]
}
fn reading_progress(ratio: f64) -> Node<Msg> {