Compare commits

..

3 Commits

10 changed files with 171 additions and 188 deletions

10
Cargo.lock generated
View File

@ -2469,7 +2469,7 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]]
name = "letterbox"
version = "0.0.41"
version = "0.0.42"
dependencies = [
"build-info",
"build-info-build",
@ -2988,7 +2988,7 @@ dependencies = [
[[package]]
name = "notmuch"
version = "0.0.41"
version = "0.0.42"
dependencies = [
"itertools 0.10.5",
"log",
@ -3625,7 +3625,7 @@ dependencies = [
[[package]]
name = "procmail2notmuch"
version = "0.0.41"
version = "0.0.42"
dependencies = [
"anyhow",
]
@ -4547,7 +4547,7 @@ dependencies = [
[[package]]
name = "server"
version = "0.0.41"
version = "0.0.42"
dependencies = [
"ammonia",
"anyhow",
@ -4646,7 +4646,7 @@ dependencies = [
[[package]]
name = "shared"
version = "0.0.41"
version = "0.0.42"
dependencies = [
"build-info",
"notmuch",

View File

@ -1,6 +1,6 @@
[package]
name = "notmuch"
version = "0.0.41"
version = "0.0.42"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@ -1,6 +1,6 @@
[package]
name = "procmail2notmuch"
version = "0.0.41"
version = "0.0.42"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@ -1,6 +1,6 @@
[package]
name = "server"
version = "0.0.41"
version = "0.0.42"
edition = "2021"
default-run = "server"

View File

@ -1,6 +1,6 @@
[package]
name = "shared"
version = "0.0.41"
version = "0.0.42"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@ -1,5 +1,5 @@
[package]
version = "0.0.41"
version = "0.0.42"
name = "letterbox"
repository = "https://github.com/seed-rs/seed-quickstart"
authors = ["Bill Thiede <git@xinu.tv>"]

View File

@ -4,25 +4,22 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://jenil.github.io/bulmaswatch/cyborg/bulmaswatch.min.css">
<!--
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css">
-->
<!--
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@1.0.0/css/bulma.min.css">
-->
<link rel="stylesheet" href="https://jenil.github.io/bulmaswatch/cyborg/bulmaswatch.min.css">
<!-- Pretty checkboxes from https://justboil.github.io/bulma-checkbox/ -->
<link data-trunk rel="css" href="static/main.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="icon" href="https://static.xinu.tv/favicon/letterbox.svg" />
<link data-trunk rel="css" href="static/style.css" />
<!-- Pretty checkboxes from https://justboil.github.io/bulma-checkbox/ -->
<link data-trunk rel="css" href="static/main.css" />
<!-- tall thin font for user icon -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@700&display=swap" rel="stylesheet">
<link data-trunk rel="css" href="static/site-specific.css" />
<link data-trunk rel="tailwind-css" href="./src/tailwind.css" />
</head>
<body>

3
web/src/tailwind.css Normal file
View File

@ -0,0 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

View File

@ -425,11 +425,15 @@ fn render_avatar(avatar: Option<String>, from: &str) -> Node<Msg> {
let h = 64;
let from_color = compute_color(from);
svg![
attrs! {At::ViewBox=>format!("0 0 {w} {h}") },
attrs! {
At::Width=>w,
At::Height=>h,
At::ViewBox=>format!("0 0 {w} {h}")
},
style! {
St::Display => "block",
St::FontFamily => "Poppins",
St::FontSize => pt(32),
St::FontSize => pt(28),
},
g![
rect![attrs! {
@ -447,7 +451,6 @@ fn render_avatar(avatar: Option<String>, from: &str) -> Node<Msg> {
text![
attrs! {
At::Fill => "white",
At::X => percent(50),
At::Y => percent(50),
At::DominantBaseline => "middle",
@ -460,6 +463,16 @@ fn render_avatar(avatar: Option<String>, from: &str) -> Node<Msg> {
}
}
fn copy_text_widget(text: &str) -> Node<Msg> {
let text = text.to_string();
span![
i![C!["far", "fa-clone"]],
ev(Ev::Click, move |e| {
e.stop_propagation();
Msg::CopyToClipboard(text)
})
]
}
fn render_open_header(msg: &ShowThreadQueryThreadOnEmailThreadMessages) -> Node<Msg> {
let (from, from_detail) = match &msg.from {
Some(ShowThreadQueryThreadOnEmailThreadMessagesFrom {
@ -477,129 +490,84 @@ fn render_open_header(msg: &ShowThreadQueryThreadOnEmailThreadMessages) -> Node<
let id = msg.id.clone();
let is_unread = has_unread(&msg.tags);
let img = render_avatar(avatar, &from);
article![
C!["media"],
figure![C!["media-left"], p![C!["image", "is-64x64"], img]],
div![figure![
C!["flex"],
div![C!["w-16", "h-16", "mx-auto", "h-auto"], &img],
div![
C!["media-content"],
div![
C!["content"],
p![
strong![from],
br![],
small![
&from_detail,
" ",
from_detail.map(|detail| span![
i![C!["far", "fa-clone"]],
ev(Ev::Click, move |e| {
e.stop_propagation();
Msg::CopyToClipboard(detail.to_string())
})
])
],
table![
IF!(!msg.to.is_empty() =>
tr![
td![ "To:" ],
//td![ if i==0 { "To" }else { "" } ],
td![
msg.to.iter().enumerate().map(|(i, to)|
small![
if i>0 { ", " }else { "" },
{
let to = match to {
ShowThreadQueryThreadOnEmailThreadMessagesTo {
name: Some(name),
addr:Some(addr),
} => format!("{name} <{addr}>"),
ShowThreadQueryThreadOnEmailThreadMessagesTo {
name: Some(name),
addr:None
} => format!("{name}"),
ShowThreadQueryThreadOnEmailThreadMessagesTo {
addr: Some(addr), ..
} => format!("{addr}"),
_ => String::from("UNKNOWN"),
};
span![
&to, " ",
span![
i![C!["far", "fa-clone"]],
ev(Ev::Click, move |e| {
e.stop_propagation();
Msg::CopyToClipboard(to)
})
]
]
}
])
]
]),
IF!(!msg.cc.is_empty() =>
tr![
td![ "CC:" ],
td![
msg.cc.iter().enumerate().map(|(i, cc)|
small![
if i>0 { ", " }else { "" },
{
let cc = match cc {
ShowThreadQueryThreadOnEmailThreadMessagesCc {
name: Some(name),
addr:Some(addr),
} => format!("{name} <{addr}>"),
ShowThreadQueryThreadOnEmailThreadMessagesCc {
name: Some(name),
addr:None
} => format!("{name}"),
ShowThreadQueryThreadOnEmailThreadMessagesCc {
addr: Some(addr), ..
} => format!("<{addr}>"),
_ => String::from("UNKNOWN"),
};
span![
&cc, " ",
span![
i![C!["far", "fa-clone"]],
ev(Ev::Click, move |e| {
e.stop_propagation();
Msg::CopyToClipboard(cc)
})
]
]
}
])
]
]),
tr![td![
attrs! {At::ColSpan=>2},
msg.timestamp.map(|ts| span![C!["header"], human_age(ts)])
]]
],
C!["px-4"],
span![C!["font-semibold"], &from],
" ",
from_detail.as_ref().map(|text| copy_text_widget(&text)),
IF!(!msg.to.is_empty() =>div![
C!["text-xs"],
span![
C!["font-semibold"],
"To: "
],
],
span![
msg.to.iter().map(|to| {
let ShowThreadQueryThreadOnEmailThreadMessagesTo { name, addr } = to;
span![
&name,
" ",
span![
i![C!["far", "fa-clone"]],
addr.clone().map(|addr| ev(Ev::Click, move |e| {
e.stop_propagation();
Msg::CopyToClipboard(addr)
}))
],
" "
]
})
]
]),
IF!(!msg.cc.is_empty() =>div![
C!["text-xs"],
span![
C!["font-semibold"],
"CC: "
],
span![
msg.cc.iter().map(|cc| {
let ShowThreadQueryThreadOnEmailThreadMessagesCc { name, addr } = cc;
span![
&name,
" ",
span![
i![C!["far", "fa-clone"]],
addr.clone().map(|addr| ev(Ev::Click, move |e| {
e.stop_propagation();
Msg::CopyToClipboard(addr)
}))
],
" "
]
})
]
]),
msg.timestamp.map(|ts| span![C!["header"], human_age(ts)]),
],
div![
C!["media-right"],
span![
C!["read-status"],
i![C![
"far",
if is_unread {
"fa-envelope"
} else {
"fa-envelope-open"
},
]]
],
ev(Ev::Click, move |e| {
e.stop_propagation();
Msg::SetUnread(id, !is_unread)
})
span![
C!["m-4", "read-status"],
i![C![
"far",
if is_unread {
"fa-envelope"
} else {
"fa-envelope-open"
},
]],
{
// TODO remove clone and code block when removing article![] below
let id = id.clone();
ev(Ev::Click, move |e| {
e.stop_propagation();
Msg::SetUnread(id, !is_unread)
})
}
]
]
],]
}
fn render_closed_header(msg: &ShowThreadQueryThreadOnEmailThreadMessages) -> Node<Msg> {
@ -618,62 +586,69 @@ fn render_closed_header(msg: &ShowThreadQueryThreadOnEmailThreadMessages) -> Nod
let id = msg.id.clone();
let is_unread = has_unread(&msg.tags);
let img = render_avatar(avatar, &from);
article![
C!["media"],
figure![C!["media-left"], p![C!["image", "is-64x64"], img]],
div![figure![
C!["flex"],
div![C!["w-16", "h-16", "mx-auto", "h-auto"], &img],
div![
C!["media-content"],
div![
C!["content"],
p![
strong![from],
br![],
IF!(!msg.to.is_empty() =>
nodes![
small![" to "],
msg.to.iter().enumerate().map(|(i, to)| small![
if i > 0 { ", " } else { "" },
to.name()
.as_ref()
.unwrap_or(&to.addr().unwrap_or("(UNKNOWN)"))
]).collect::<Vec<_>>()
]),
IF!(!msg.cc.is_empty() =>
nodes![
small![" cc "],
msg.cc.iter().enumerate().map(|(i, cc)| small![
if i > 0 { ", " } else { "" },
cc.name()
.as_ref()
.unwrap_or(&cc.addr().unwrap_or("(UNKNOWN)"))
]).collect::<Vec<_>>()
]),
br![],
msg.timestamp.map(|ts| span![C!["header"], human_age(ts)]),
C!["px-4"],
span![C!["font-semibold"], &from],
" ",
IF!(!msg.to.is_empty() =>div![
C!["text-xs"],
span![
C!["font-semibold"],
"To: "
],
],
span![
msg.to.iter().enumerate().map(|(i, to)| {
let ShowThreadQueryThreadOnEmailThreadMessagesTo { name, addr } = to;
span![
if i > 0 { ", " } else { "" },
&name,
]
})
]
]),
IF!(!msg.cc.is_empty() =>div![
C!["text-xs"],
span![
C!["font-semibold"],
"CC: "
],
span![
msg.cc.iter().enumerate().map(|(i, cc)| {
let ShowThreadQueryThreadOnEmailThreadMessagesCc { name, addr } = cc;
span![
if i > 0 { ", " } else { "" },
&name,
]
})
]
]),
msg.timestamp.map(|ts| span![C!["header"], human_age(ts)]),
],
div![
C!["media-right"],
span![
C!["read-status"],
i![
C![
"far",
if is_unread {
"fa-envelope"
} else {
"fa-envelope-open"
},
],
div![span![
C!["m-4", "read-status"],
i![
C![
"far",
if is_unread {
"fa-envelope"
} else {
"fa-envelope-open"
},
],
{
// TODO remove clone and code block when removing article![] below
let id = id.clone();
ev(Ev::Click, move |e| {
e.stop_propagation();
Msg::SetUnread(id, !is_unread)
})
]
}
]
]
]
]]
],]
}
fn message_render(msg: &ShowThreadQueryThreadOnEmailThreadMessages, open: bool) -> Node<Msg> {
@ -1127,7 +1102,6 @@ fn news_post(
}
fn render_news_post_header(post: &ShowThreadQueryThreadOnNewsPost) -> Node<Msg> {
let from = &post.site;
let from_detail = post.url.clone();
let avatar: Option<String> = None;
//let avatar: Option<String> = Some(String::from("https://bulma.io/images/placeholders/64x64.png"));
let id = post.thread_id.clone();

9
web/tailwind.config.js Normal file
View File

@ -0,0 +1,9 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ['./src/**/*.rs'],
theme: {
extend: {},
},
plugins: [],
}