web: make +6 month button work from post date

This commit is contained in:
Bill Thiede 2025-11-05 15:01:56 -08:00
parent c0982e82c6
commit 2aa85a03f8

View File

@ -739,7 +739,7 @@ fn render_open_header(msg: &ShowThreadQueryThreadOnEmailThreadMessages) -> Node<
" ", " ",
from_detail.as_ref().map(|text| copy_text_widget(&text)) from_detail.as_ref().map(|text| copy_text_widget(&text))
], ],
snooze_buttons(&id), snooze_buttons(msg.timestamp, &id),
], ],
IF!(!msg.to.is_empty() =>div![ IF!(!msg.to.is_empty() =>div![
C!["text-xs"], C!["text-xs"],
@ -1603,7 +1603,7 @@ fn render_news_post_header(post: &ShowThreadQueryThreadOnNewsPost) -> Node<Msg>
div![ div![
C!["flex"], C!["flex"],
div![C!["font-semibold", "text-sm", "flex-1"], from], div![C!["font-semibold", "text-sm", "flex-1"], from],
snooze_buttons(&id), snooze_buttons(Some(post.timestamp), &id),
], ],
div![ div![
C!["flex", "gap-2", "pt-2", "text-sm"], C!["flex", "gap-2", "pt-2", "text-sm"],
@ -1700,7 +1700,7 @@ fn click_to_top() -> Node<Msg> {
] ]
} }
fn snooze_buttons(id: &str) -> Node<Msg> { fn snooze_buttons(timestamp: Option<i64>, id: &str) -> Node<Msg> {
div![ div![
span![C!["px-2"], ""], span![C!["px-2"], ""],
button![ button![
@ -1727,17 +1727,19 @@ fn snooze_buttons(id: &str) -> Node<Msg> {
} }
}) })
], ],
button![ timestamp.map(
tw_classes::button(), |ts| chrono::DateTime::from_timestamp(ts, 0).map(|ts| button![
C!["rounded-l-none"], tw_classes::button(),
"6m", C!["rounded-l-none"],
ev(Ev::Click, { "+6m",
let id = id.to_string(); ev(Ev::Click, {
move |e| { let id = id.to_string();
e.stop_propagation(); move |e| {
Msg::Snooze(id, Utc::now() + chrono::Days::new(180)) e.stop_propagation();
} Msg::Snooze(id, ts + chrono::Days::new(180))
}) }
], })
])
),
] ]
} }