Compare commits

..

No commits in common. "2b6cb6ec6ef4d6898f28ad0d91f077350d71ff25" and "73433711ca2aaecda9f6c0ae157eddc441cdb3d8" have entirely different histories.

6 changed files with 49 additions and 72 deletions

10
Cargo.lock generated
View File

@ -2965,7 +2965,7 @@ dependencies = [
[[package]]
name = "letterbox-notmuch"
version = "0.8.3"
version = "0.8.2"
dependencies = [
"itertools 0.14.0",
"log",
@ -2980,14 +2980,14 @@ dependencies = [
[[package]]
name = "letterbox-procmail2notmuch"
version = "0.8.3"
version = "0.8.2"
dependencies = [
"anyhow",
]
[[package]]
name = "letterbox-server"
version = "0.8.3"
version = "0.8.2"
dependencies = [
"ammonia",
"anyhow",
@ -3030,7 +3030,7 @@ dependencies = [
[[package]]
name = "letterbox-shared"
version = "0.8.3"
version = "0.8.2"
dependencies = [
"build-info",
"letterbox-notmuch",
@ -3039,7 +3039,7 @@ dependencies = [
[[package]]
name = "letterbox-web"
version = "0.8.3"
version = "0.8.2"
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.8.3"
version = "0.8.2"
repository = "https://git.z.xinu.tv/wathiede/letterbox"
[profile.dev]

View File

@ -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.8.3", path = "../notmuch", registry = "xinu" }
letterbox-shared = { version = "0.8.3", path = "../shared", registry = "xinu" }
letterbox-notmuch = { version = "0.8.2", path = "../notmuch", registry = "xinu" }
letterbox-shared = { version = "0.8.2", path = "../shared", registry = "xinu" }
[build-dependencies]
build-info-build = "0.0.39"

View File

@ -12,5 +12,5 @@ version.workspace = true
[dependencies]
build-info = "0.0.39"
letterbox-notmuch = { version = "0.8.3", path = "../notmuch", registry = "xinu" }
letterbox-notmuch = { version = "0.8.2", 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.8.3", path = "../shared", registry = "xinu" }
letterbox-notmuch = { version = "0.8.3", path = "../notmuch", registry = "xinu" }
letterbox-shared = { version = "0.8.2", path = "../shared", registry = "xinu" }
letterbox-notmuch = { version = "0.8.2", path = "../notmuch", registry = "xinu" }
seed_hooks = { version = "0.4.0", registry = "xinu" }
[package.metadata.wasm-pack.profile.release]

View File

@ -7,7 +7,7 @@ use letterbox_shared::compute_color;
use log::{debug, error, info};
use seed::{prelude::*, *};
use seed_hooks::{state_access::CloneState, topo, use_state, StateAccessEventHandlers};
use web_sys::{HtmlElement, HtmlInputElement};
use web_sys::HtmlElement;
use crate::{
api::urls,
@ -60,7 +60,6 @@ mod tw_classes {
"accent-green-600",
"appearance-none",
"checked:appearance-auto",
"indeterminate:appearance-auto",
"rounded",
"border",
"border-neutral-500",
@ -136,6 +135,7 @@ fn search_results(
tags.remove(idx);
};
let is_unread = unread_idx.is_some();
// TODO: add check-all button, and tristate indicator
div![
C![
"flex",
@ -189,12 +189,11 @@ fn search_results(
]
});
let show_bulk_edit = !selected_threads.is_empty();
let all_selected = selected_threads.len() == results.len();
div![
C!["flex", "flex-col", "flex-auto", "p-4"],
search_toolbar(count, pager, show_bulk_edit, all_selected),
search_toolbar(count, pager, show_bulk_edit),
div![rows],
search_toolbar(count, pager, show_bulk_edit, all_selected),
search_toolbar(count, pager, show_bulk_edit),
]
}
@ -311,71 +310,47 @@ fn human_age(timestamp: i64) -> String {
datetime
}
#[topo::nested]
fn search_toolbar(
count: usize,
pager: &FrontPageQuerySearchPageInfo,
show_bulk_edit: bool,
all_selected: bool,
) -> Node<Msg> {
let indeterminate = show_bulk_edit && !all_selected;
let tristate_el: ElRef<HtmlInputElement> = use_state(|| Default::default()).get();
let tri = el_ref(&tristate_el);
if let Some(tri) = tri.get() {
info!(
"setting tristate to {indeterminate}, current {}",
tri.indeterminate()
);
tri.set_indeterminate(indeterminate);
}
nav![
C!["py-4", "flex", "w-full", "justify-between"],
C!["p-4", "flex", "w-full", "justify-between"],
div![
C!["gap-2", "flex", IF!(!show_bulk_edit => "invisible")],
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
}
}),
],
C!["gap-2", "flex"],
IF!(show_bulk_edit =>
div![
button![
C![&tw_classes::BUTTON, "rounded-r-none"],
attrs! {At::Title => "Mark as read"},
attrs!{At::Title => "Mark as read"},
span![i![C!["far", "fa-envelope-open"]]],
span![C!["pl-2", "hidden", "md:inline"], "Read"],
ev(Ev::Click, |_| Msg::SelectionMarkAsRead)
],
button![
C![&tw_classes::BUTTON, "rounded-l-none"],
attrs! {At::Title => "Mark as unread"},
attrs!{At::Title => "Mark as unread"},
span![i![C!["far", "fa-envelope"]]],
span![C!["pl-2", "hidden", "md:inline"], "Unread"],
ev(Ev::Click, |_| Msg::SelectionMarkAsUnread)
]
],
div![button![
]),
IF!(show_bulk_edit =>
div![
button![
C![&tw_classes::BUTTON, "text-red-500"],
attrs! {At::Title => "Mark as spam"},
attrs!{At::Title => "Mark as spam"},
span![i![C!["far", "fa-hand"]]],
span![C!["pl-2", "hidden", "md:inline"], "Spam"],
ev(Ev::Click, |_| Msg::MultiMsg(vec![
ev(Ev::Click, |_|
Msg::MultiMsg(vec![
Msg::SelectionAddTag("Spam".to_string()),
Msg::SelectionMarkAsRead
]))
]],
])
)
]
]),
],
div![
C!["flex", "gap-2", "items-center"],
@ -902,7 +877,6 @@ fn view_header(
false
};
let query = Url::decode_uri_component(query).unwrap_or("".to_string());
nav![
C!["flex", "px-4", "pt-4", "overflow-hidden"],
a![
@ -1047,6 +1021,9 @@ pub fn tags(model: &Model) -> Node<Msg> {
} else {
a.name.cmp(&b.name)
};
if a.name.starts_with('@') || b.name.starts_with('@') {
info!("a {} < b {} = {r:?}", a.name, b.name,);
}
return r;
});
let tags_open = use_state(|| false);