Compare commits
37 Commits
letterbox-
...
12a04566d8
| Author | SHA1 | Date | |
|---|---|---|---|
| 12a04566d8 | |||
| 0cbe860d0d | |||
| 6eaedfaae8 | |||
| d1787bac32 | |||
| 58554e7f40 | |||
| fa6fe673bd | |||
| 44961f6ef1 | |||
| cd09594347 | |||
| 3d09ab7c15 | |||
| 0cf3e3ce05 | |||
| d10a34e32e | |||
| f311e517a9 | |||
| aacee2f537 | |||
| e2bec7760b | |||
| a4ef7e48a6 | |||
| 1aa6f22461 | |||
| 2f5026c75b | |||
| dcb90ca2c8 | |||
| 772548f10d | |||
| c62e925016 | |||
| 4570a6ea1c | |||
| ae06df21a0 | |||
| 02d43feb79 | |||
| 0e6508498a | |||
| a94bd8a341 | |||
| 788baf9e86 | |||
| fdf910b1a1 | |||
| 714c94e40b | |||
| 667893b6a3 | |||
| 687b050410 | |||
| 48bad8cbb0 | |||
| d156fe8282 | |||
| fc66759e92 | |||
| fcdc2d56a9 | |||
| 60993abd6f | |||
| c1112e5538 | |||
| 1b59c7a287 |
430
Cargo.lock
generated
430
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,7 @@ authors = ["Bill Thiede <git@xinu.tv>"]
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "UNLICENSED"
|
license = "UNLICENSED"
|
||||||
publish = ["xinu"]
|
publish = ["xinu"]
|
||||||
version = "0.17.61"
|
version = "0.17.66"
|
||||||
repository = "https://git.z.xinu.tv/wathiede/letterbox"
|
repository = "https://git.z.xinu.tv/wathiede/letterbox"
|
||||||
|
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ urlencoding = "2.1.3"
|
|||||||
#xtracing = { git = "http://git-private.h.xinu.tv/wathiede/xtracing.git" }
|
#xtracing = { git = "http://git-private.h.xinu.tv/wathiede/xtracing.git" }
|
||||||
#xtracing = { path = "../../xtracing" }
|
#xtracing = { path = "../../xtracing" }
|
||||||
xtracing = { version = "0.3.2", registry = "xinu" }
|
xtracing = { version = "0.3.2", registry = "xinu" }
|
||||||
zip = "7.0.0"
|
zip = { version = "7.0.0", default-features = false, features = ["aes-crypto", "bzip2", "deflate64", "deflate", "time", "zstd"] }
|
||||||
|
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
|
|||||||
@@ -224,6 +224,24 @@ pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
Msg::AddTag(query, tag) => {
|
Msg::AddTag(query, tag) => {
|
||||||
|
orders.skip().perform_cmd(async move {
|
||||||
|
let res: Result<
|
||||||
|
graphql_client::Response<graphql::add_tag_mutation::ResponseData>,
|
||||||
|
gloo_net::Error,
|
||||||
|
> = send_graphql(graphql::AddTagMutation::build_query(
|
||||||
|
graphql::add_tag_mutation::Variables {
|
||||||
|
query: query.clone(),
|
||||||
|
tag: tag.clone(),
|
||||||
|
},
|
||||||
|
))
|
||||||
|
.await;
|
||||||
|
if let Err(e) = res {
|
||||||
|
error!("Failed to add tag {tag} to {query}: {e}");
|
||||||
|
}
|
||||||
|
Msg::Refresh
|
||||||
|
});
|
||||||
|
}
|
||||||
|
Msg::AddTagAndGoToSearch(query, tag) => {
|
||||||
orders.skip().perform_cmd(async move {
|
orders.skip().perform_cmd(async move {
|
||||||
let res: Result<
|
let res: Result<
|
||||||
graphql_client::Response<graphql::add_tag_mutation::ResponseData>,
|
graphql_client::Response<graphql::add_tag_mutation::ResponseData>,
|
||||||
@@ -256,7 +274,24 @@ pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
|||||||
if let Err(e) = res {
|
if let Err(e) = res {
|
||||||
error!("Failed to remove tag {tag} to {query}: {e}");
|
error!("Failed to remove tag {tag} to {query}: {e}");
|
||||||
}
|
}
|
||||||
// TODO: reconsider this behavior
|
Msg::Refresh
|
||||||
|
});
|
||||||
|
}
|
||||||
|
Msg::RemoveTagAndGoToSearch(query, tag) => {
|
||||||
|
orders.skip().perform_cmd(async move {
|
||||||
|
let res: Result<
|
||||||
|
graphql_client::Response<graphql::remove_tag_mutation::ResponseData>,
|
||||||
|
gloo_net::Error,
|
||||||
|
> = send_graphql(graphql::RemoveTagMutation::build_query(
|
||||||
|
graphql::remove_tag_mutation::Variables {
|
||||||
|
query: query.clone(),
|
||||||
|
tag: tag.clone(),
|
||||||
|
},
|
||||||
|
))
|
||||||
|
.await;
|
||||||
|
if let Err(e) = res {
|
||||||
|
error!("Failed to remove tag {tag} to {query}: {e}");
|
||||||
|
}
|
||||||
Msg::GoToSearchResults
|
Msg::GoToSearchResults
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -505,7 +540,7 @@ pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
|||||||
.join(" ");
|
.join(" ");
|
||||||
orders
|
orders
|
||||||
.skip()
|
.skip()
|
||||||
.perform_cmd(async move { Msg::AddTag(threads, tag) });
|
.perform_cmd(async move { Msg::AddTagAndGoToSearch(threads, tag) });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Msg::SelectionRemoveTag(tag) => {
|
Msg::SelectionRemoveTag(tag) => {
|
||||||
@@ -520,7 +555,7 @@ pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
|||||||
.join(" ");
|
.join(" ");
|
||||||
orders
|
orders
|
||||||
.skip()
|
.skip()
|
||||||
.perform_cmd(async move { Msg::RemoveTag(threads, tag) });
|
.perform_cmd(async move { Msg::RemoveTagAndGoToSearch(threads, tag) });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Msg::SelectionMarkAsRead => {
|
Msg::SelectionMarkAsRead => {
|
||||||
@@ -692,6 +727,13 @@ pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
|||||||
};
|
};
|
||||||
orders.send_msg(Msg::CatchupNext);
|
orders.send_msg(Msg::CatchupNext);
|
||||||
}
|
}
|
||||||
|
Msg::CatchupMarkAsSpam => {
|
||||||
|
if let Some(thread_id) = current_thread_id(&model.context) {
|
||||||
|
orders.send_msg(Msg::AddTag(thread_id.clone(), "Spam".to_string()));
|
||||||
|
orders.send_msg(Msg::SetUnread(thread_id, false));
|
||||||
|
};
|
||||||
|
orders.send_msg(Msg::CatchupNext);
|
||||||
|
}
|
||||||
Msg::CatchupNext => {
|
Msg::CatchupNext => {
|
||||||
orders.send_msg(Msg::ScrollToTop);
|
orders.send_msg(Msg::ScrollToTop);
|
||||||
let Some(catchup) = &mut model.catchup else {
|
let Some(catchup) = &mut model.catchup else {
|
||||||
@@ -852,7 +894,10 @@ pub enum Msg {
|
|||||||
|
|
||||||
SetUnread(String, bool),
|
SetUnread(String, bool),
|
||||||
AddTag(String, String),
|
AddTag(String, String),
|
||||||
|
AddTagAndGoToSearch(String, String),
|
||||||
|
#[allow(dead_code)]
|
||||||
RemoveTag(String, String),
|
RemoveTag(String, String),
|
||||||
|
RemoveTagAndGoToSearch(String, String),
|
||||||
Snooze(String, DateTime<Utc>),
|
Snooze(String, DateTime<Utc>),
|
||||||
|
|
||||||
FrontPageRequest {
|
FrontPageRequest {
|
||||||
@@ -902,6 +947,7 @@ pub enum Msg {
|
|||||||
CatchupStart,
|
CatchupStart,
|
||||||
CatchupKeepUnread,
|
CatchupKeepUnread,
|
||||||
CatchupMarkAsRead,
|
CatchupMarkAsRead,
|
||||||
|
CatchupMarkAsSpam,
|
||||||
CatchupNext,
|
CatchupNext,
|
||||||
CatchupExit,
|
CatchupExit,
|
||||||
|
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ pub fn view(model: &Model) -> Node<Msg> {
|
|||||||
&catchup.items,
|
&catchup.items,
|
||||||
is_loading,
|
is_loading,
|
||||||
model.read_completion_ratio,
|
model.read_completion_ratio,
|
||||||
|
true, // show spam button for email
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
normal_view(
|
normal_view(
|
||||||
@@ -127,6 +128,7 @@ pub fn view(model: &Model) -> Node<Msg> {
|
|||||||
&catchup.items,
|
&catchup.items,
|
||||||
is_loading,
|
is_loading,
|
||||||
model.read_completion_ratio,
|
model.read_completion_ratio,
|
||||||
|
false, // no spam button for news
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
normal_view(
|
normal_view(
|
||||||
@@ -193,6 +195,7 @@ fn catchup_view(
|
|||||||
items: &[CatchupItem],
|
items: &[CatchupItem],
|
||||||
is_loading: bool,
|
is_loading: bool,
|
||||||
read_completion_ratio: f64,
|
read_completion_ratio: f64,
|
||||||
|
show_spam_button: bool,
|
||||||
) -> Node<Msg> {
|
) -> Node<Msg> {
|
||||||
div![
|
div![
|
||||||
C!["w-full", "relative", "text-white"],
|
C!["w-full", "relative", "text-white"],
|
||||||
@@ -268,6 +271,14 @@ fn catchup_view(
|
|||||||
Msg::GoToSearchResults
|
Msg::GoToSearchResults
|
||||||
]))
|
]))
|
||||||
],
|
],
|
||||||
|
IF!(show_spam_button => button![
|
||||||
|
tw_classes::button(),
|
||||||
|
C!["text-red-500"],
|
||||||
|
attrs! {At::Title => "Mark as spam"},
|
||||||
|
span![i![C!["far", "fa-hand"]]],
|
||||||
|
span![C!["pl-2"], "Spam"],
|
||||||
|
ev(Ev::Click, |_| Msg::CatchupMarkAsSpam)
|
||||||
|
]),
|
||||||
button![
|
button![
|
||||||
tw_classes::button_with_color("bg-green-800", "hover:bg-green-700"),
|
tw_classes::button_with_color("bg-green-800", "hover:bg-green-700"),
|
||||||
span![i![C!["far", "fa-envelope-open"]]],
|
span![i![C!["far", "fa-envelope-open"]]],
|
||||||
@@ -450,7 +461,7 @@ fn removable_tags_chiclet<'a>(thread_id: &'a str, tags: &'a [String]) -> Node<Ms
|
|||||||
a![
|
a![
|
||||||
C![&tw_classes::TAG_X],
|
C![&tw_classes::TAG_X],
|
||||||
span![i![C!["fa-solid", "fa-xmark"]]],
|
span![i![C!["fa-solid", "fa-xmark"]]],
|
||||||
ev(Ev::Click, move |_| Msg::RemoveTag(thread_id, rm_tag))
|
ev(Ev::Click, move |_| Msg::RemoveTagAndGoToSearch(thread_id, rm_tag))
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user