From 5be90706b0dbed4d084efdf3c2a49e706578567e Mon Sep 17 00:00:00 2001 From: Danny Avila Date: Sun, 1 Mar 2026 16:44:57 -0500 Subject: [PATCH] =?UTF-8?q?=E2=9C=82=EF=B8=8F=20fix:=20Unicode-Safe=20Titl?= =?UTF-8?q?e=20Truncation=20and=20Shared=20View=20Layout=20Polish=20(#1200?= =?UTF-8?q?3)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: title sanitization with max length truncation and update ShareView for better text display - Added functionality to `sanitizeTitle` to truncate titles exceeding 200 characters with an ellipsis, ensuring consistent title length. - Updated `ShareView` component to apply a line clamp on the title, improving text display and preventing overflow in the UI. * refactor: Update layout and styling in MessagesView and ShareView components - Removed unnecessary padding in MessagesView to streamline the layout. - Increased bottom padding in the message container for better spacing. - Enhanced ShareView footer positioning and styling for improved visibility. - Adjusted section and div classes in ShareView for better responsiveness and visual consistency. * fix: Correct title fallback and enhance sanitization logic in sanitizeTitle - Updated the fallback title in sanitizeTitle to use DEFAULT_TITLE_FALLBACK instead of a hardcoded string. - Improved title truncation logic to ensure proper handling of maximum length and whitespace, including edge cases for emoji and whitespace-only titles. - Added tests to validate the new sanitization behavior, ensuring consistent and expected results across various input scenarios. --- client/src/components/Share/MessagesView.tsx | 6 +- client/src/components/Share/ShareView.tsx | 16 +++--- packages/api/src/utils/sanitizeTitle.spec.ts | 59 ++++++++++++++++++-- packages/api/src/utils/sanitizeTitle.ts | 35 +++++++----- 4 files changed, 85 insertions(+), 31 deletions(-) diff --git a/client/src/components/Share/MessagesView.tsx b/client/src/components/Share/MessagesView.tsx index 9fa4276024..0b2e7b1c2d 100644 --- a/client/src/components/Share/MessagesView.tsx +++ b/client/src/components/Share/MessagesView.tsx @@ -13,7 +13,7 @@ export default function MessagesView({ const localize = useLocalize(); const [currentEditId, setCurrentEditId] = useState(-1); return ( -
+
-
- {(_messagesTree && _messagesTree.length == 0) || _messagesTree === null ? ( +
+ {(_messagesTree && _messagesTree.length === 0) || _messagesTree === null ? (
{localize('com_ui_nothing_found')}
diff --git a/client/src/components/Share/ShareView.tsx b/client/src/components/Share/ShareView.tsx index 99ab7f35eb..00a0d36398 100644 --- a/client/src/components/Share/ShareView.tsx +++ b/client/src/components/Share/ShareView.tsx @@ -123,14 +123,14 @@ function SharedView() { } const footer = ( -
-