Compare commits

..

No commits in common. "d4038f40d6d7a30edca1fb60eda4ee26ec268866" and "1f5f10f78d489f339757a937ed9bb393b59569ca" have entirely different histories.

8 changed files with 9 additions and 82 deletions

6
Cargo.lock generated
View File

@ -1440,11 +1440,6 @@ version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
[[package]]
name = "human_format"
version = "1.0.2"
source = "git+https://github.com/wathiede/human-format-rs#c5f59f0b0e4d92e649d415a8509bc46e92413356"
[[package]] [[package]]
name = "hyper" name = "hyper"
version = "0.10.16" version = "0.10.16"
@ -1732,7 +1727,6 @@ dependencies = [
"console_log", "console_log",
"gloo-net", "gloo-net",
"graphql_client", "graphql_client",
"human_format",
"itertools", "itertools",
"log 0.4.20", "log 0.4.20",
"notmuch", "notmuch",

View File

@ -32,7 +32,6 @@ graphql_client = "0.13.0"
thiserror = "1.0.50" thiserror = "1.0.50"
seed_hooks = { git = "https://github.com/wathiede/styles_hooks", package = "seed_hooks", branch = "main" } seed_hooks = { git = "https://github.com/wathiede/styles_hooks", package = "seed_hooks", branch = "main" }
gloo-net = { version = "0.4.0", features = ["json", "serde_json"] } gloo-net = { version = "0.4.0", features = ["json", "serde_json"] }
human_format = { git ="https://github.com/wathiede/human-format-rs" }
[package.metadata.wasm-pack.profile.release] [package.metadata.wasm-pack.profile.release]
wasm-opt = ['-Os'] wasm-opt = ['-Os']

View File

@ -222,7 +222,6 @@ 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
seed::window() seed::window()
.location() .location()
.set_href(&search_url) .set_href(&search_url)

View File

@ -9,7 +9,6 @@ use crate::{
#[topo::nested] #[topo::nested]
pub(super) fn view(model: &Model) -> Node<Msg> { pub(super) fn view(model: &Model) -> Node<Msg> {
log::info!("tablet::view");
let show_icon_text = true; let show_icon_text = true;
// Do two queries, one without `unread` so it loads fast, then a second with unread. // Do two queries, one without `unread` so it loads fast, then a second with unread.
let content = match &model.context { let content = match &model.context {

View File

@ -10,7 +10,6 @@ use crate::{
}; };
pub(super) fn view(model: &Model) -> Node<Msg> { pub(super) fn view(model: &Model) -> Node<Msg> {
log::info!("tablet::view");
let show_icon_text = false; let show_icon_text = false;
let content = match &model.context { let content = match &model.context {
Context::None => div![h1!["Loading"]], Context::None => div![h1!["Loading"]],

View File

@ -4,7 +4,6 @@ use std::{
}; };
use chrono::{DateTime, Datelike, Duration, Local, Utc}; use chrono::{DateTime, Datelike, Duration, Local, Utc};
use human_format::{Formatter, Scales};
use itertools::Itertools; use itertools::Itertools;
use log::error; use log::error;
use seed::{prelude::*, *}; use seed::{prelude::*, *};
@ -61,59 +60,6 @@ fn tags_chiclet(tags: &[String], is_mobile: bool) -> impl Iterator<Item = Node<M
}) })
} }
fn removable_tags_chiclet<'a>(
thread_id: &'a str,
tags: &'a [String],
is_mobile: bool,
) -> Node<Msg> {
div![
C![
"message-tags",
"field",
"is-grouped",
"is-grouped-multiline"
],
tags.iter().map(move |tag| {
let hex = compute_color(tag);
let style = style! {St::BackgroundColor=>hex};
let classes = C!["tag", IF!(is_mobile => "is-small")];
let attrs = attrs! {
At::Href => urls::search(&format!("tag:{tag}"), 0)
};
let tag = tag.clone();
let rm_tag = tag.clone();
let thread_id = format!("thread:{thread_id}");
div![
C!["control"],
div![
C!["tags", "has-addons"],
a![
classes,
attrs,
style,
match tag.as_str() {
"attachment" => span!["📎"],
"replied" => span![i![C!["fa-solid", "fa-reply"]]],
_ => span![&tag],
},
ev(Ev::Click, move |_| Msg::FrontPageRequest {
query: format!("tag:{tag}"),
after: None,
before: None,
first: None,
last: None,
})
],
a![
C!["tag", "is-delete"],
ev(Ev::Click, move |_| Msg::RemoveTag(thread_id, rm_tag))
]
]
]
})
]
}
fn pretty_authors(authors: &str) -> impl Iterator<Item = Node<Msg>> + '_ { fn pretty_authors(authors: &str) -> impl Iterator<Item = Node<Msg>> + '_ {
let one_person = authors.matches(',').count() == 0; let one_person = authors.matches(',').count() == 0;
let authors = authors.split(','); let authors = authors.split(',');
@ -695,18 +641,18 @@ fn message_render(msg: &ShowThreadQueryThreadMessages, open: bool) -> Node<Msg>
) => pre![C!["error"], contents], ) => pre![C!["error"], contents],
ShowThreadQueryThreadMessagesBody::PlainText( ShowThreadQueryThreadMessagesBody::PlainText(
ShowThreadQueryThreadMessagesBodyOnPlainText { ShowThreadQueryThreadMessagesBodyOnPlainText {
contents, contents,
content_tree, content_tree,
}, },
) => div![ ) => div![
raw_text_message(&contents), raw_text_message(&contents),
view_content_tree(&content_tree), view_content_tree(&content_tree),
], ],
ShowThreadQueryThreadMessagesBody::Html( ShowThreadQueryThreadMessagesBody::Html(
ShowThreadQueryThreadMessagesBodyOnHtml { ShowThreadQueryThreadMessagesBodyOnHtml {
contents, contents,
content_tree, content_tree,
}, },
) => div![ ) => div![
C!["view-part-text-html"], C!["view-part-text-html"],
raw![contents], raw![contents],
@ -723,9 +669,6 @@ fn message_render(msg: &ShowThreadQueryThreadMessages, open: bool) -> Node<Msg>
let filename = a.filename.as_ref().unwrap_or(&default); let filename = a.filename.as_ref().unwrap_or(&default);
let host = seed::window().location().host().expect("couldn't get host"); let host = seed::window().location().host().expect("couldn't get host");
let url = format!("//{host}/download/attachment/{}/{}/{}", a.id,a.idx, filename); let url = format!("//{host}/download/attachment/{}/{}/{}", a.id,a.idx, filename);
let mut fmtr = Formatter::new();
fmtr.with_separator(" ");
fmtr.with_scales(Scales::Binary());
div![ div![
C!["attachment", "card"], C!["attachment", "card"],
@ -745,7 +688,7 @@ fn message_render(msg: &ShowThreadQueryThreadMessages, open: bool) -> Node<Msg>
div![C!["card-content"], div![C!["card-content"],
div![C!["content"], div![C!["content"],
&a.filename, br![], &a.filename, br![],
small![ fmtr.format(a.size as f64),"B"] small![&a.size, " bytes"]
] ]
], ],
footer![ footer![
@ -801,10 +744,7 @@ fn thread(
div![ div![
C!["thread"], C!["thread"],
h3![C!["is-size-5"], subject], h3![C!["is-size-5"], subject],
span![ span![C!["tags"], tags_chiclet(&tags, false)],
C!["tags"],
removable_tags_chiclet(&thread.thread_id, &tags, false)
],
div![ div![
C!["level", "is-mobile"], C!["level", "is-mobile"],
div![ div![

View File

@ -6,7 +6,6 @@ use crate::{
}; };
pub(super) fn view(model: &Model) -> Node<Msg> { pub(super) fn view(model: &Model) -> Node<Msg> {
log::info!("tablet::view");
let show_icon_text = false; let show_icon_text = false;
// Do two queries, one without `unread` so it loads fast, then a second with unread. // Do two queries, one without `unread` so it loads fast, then a second with unread.
let content = match &model.context { let content = match &model.context {

View File

@ -155,14 +155,12 @@ input::placeholder,
padding: 1em; padding: 1em;
} }
.tablet .thread h3,
.mobile .thread h3 { .mobile .thread h3 {
overflow-wrap: break-word; overflow-wrap: break-word;
padding: 1em 1em 0; padding: 1em 1em 0;
} }
.tablet .thread .message-tags, .mobile .thread .tags {
.mobile .thread .message-tags {
padding: 0 1em; padding: 0 1em;
} }