From dc4dd8300ccc0eaace1ef379c624ae247c08d4ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Sun, 22 Sep 2024 14:50:56 +0200 Subject: [PATCH] pl-fe: change conditions for status collapse MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- packages/pl-fe/src/components/status-content.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/pl-fe/src/components/status-content.tsx b/packages/pl-fe/src/components/status-content.tsx index 954e4ffc8..b5c68b05e 100644 --- a/packages/pl-fe/src/components/status-content.tsx +++ b/packages/pl-fe/src/components/status-content.tsx @@ -20,7 +20,6 @@ import Poll from './polls/poll'; import type { Sizes } from 'pl-fe/components/ui/text/text'; import type { MinifiedStatus } from 'pl-fe/reducers/statuses'; -const MAX_HEIGHT = 322; // 20px * 16 (+ 2px padding at the top) const BIG_EMOJI_LIMIT = 10; const nodesToText = (nodes: Array): string => @@ -81,7 +80,8 @@ const StatusContent: React.FC = React.memo(({ if (!node.current) return; if (collapsable && !collapsed) { - if (node.current.clientHeight > MAX_HEIGHT) { + // 20px * x lines (+ 2px padding at the top) + if (node.current.clientHeight > (quote ? 202 : 282)) { setCollapsed(true); } } @@ -189,7 +189,8 @@ const StatusContent: React.FC = React.memo(({ const direction = getTextDirection(status.search_index); const className = clsx('relative overflow-hidden text-ellipsis break-words text-gray-900 focus:outline-none dark:text-gray-100', { 'cursor-pointer': onClick, - 'max-h-[200px]': collapsed, + 'max-h-[200px]': collapsed && !quote, + 'max-h-[120px]': collapsed && quote, 'leading-normal big-emoji': onlyEmoji, });