web: conditionally wrap title when large words found

This commit is contained in:
Bill Thiede 2025-04-10 12:16:53 -07:00
parent 147896dc80
commit 2b4c45be74

View File

@ -1097,11 +1097,18 @@ fn thread(
let unread_thread_id = thread.thread_id.clone(); let unread_thread_id = thread.thread_id.clone();
let spam_add_thread_id = thread.thread_id.clone(); let spam_add_thread_id = thread.thread_id.clone();
let spam_unread_thread_id = thread.thread_id.clone(); let spam_unread_thread_id = thread.thread_id.clone();
let mut title_break = None;
const TITLE_LENGTH_WRAP_LIMIT: usize = 40;
for w in subject.split_whitespace() {
if w.len() > TITLE_LENGTH_WRAP_LIMIT {
title_break = Some(C!["break-all", "text-pretty"]);
}
}
div![ div![
C!["lg:p-4", "max-w-4xl"], C!["lg:p-4", "max-w-4xl"],
div![ div![
C!["p-4", "lg:p-0"], C!["p-4", "lg:p-0"],
h3![C!["text-xl", "break-all", "text-pretty"], subject], h3![C!["text-xl"], title_break, subject],
span![removable_tags_chiclet(&thread.thread_id, &tags)], span![removable_tags_chiclet(&thread.thread_id, &tags)],
IF!(!catchup_mode => div![ IF!(!catchup_mode => div![
C!["pt-4", "gap-2", "flex", "justify-around"], C!["pt-4", "gap-2", "flex", "justify-around"],
@ -1397,11 +1404,18 @@ fn news_post(
] ]
} }
let mut title_break = None;
const TITLE_LENGTH_WRAP_LIMIT: usize = 40;
for w in subject.split_whitespace() {
if w.len() > TITLE_LENGTH_WRAP_LIMIT {
title_break = Some(C!["break-all", "text-pretty"]);
}
}
div![ div![
C!["lg:p-4", "max-w-4xl"], C!["lg:p-4", "max-w-4xl"],
div![ div![
C!["p-4", "lg:p-0"], C!["p-4", "lg:p-0"],
h3![C!["text-xl", "break-all", "text-pretty"], subject], h3![C!["text-xl"], title_break, subject],
span![tag(format!("News/{}", post.slug))], span![tag(format!("News/{}", post.slug))],
IF!(!catchup_mode => div![ IF!(!catchup_mode => div![
C!["pt-4", "gap-2", "flex", "justify-around"], C!["pt-4", "gap-2", "flex", "justify-around"],