From 63d88d00136ca6a4a4ec8c315056ebc5653382f5 Mon Sep 17 00:00:00 2001 From: Elyor Djalilov Date: Mon, 19 Aug 2024 13:06:37 +0500 Subject: [PATCH] Web: Client: InfoPanel: History: fixed display more label --- .../Body/views/History/HistoryBlockContent/ItemList.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/client/src/pages/Home/InfoPanel/Body/views/History/HistoryBlockContent/ItemList.tsx b/packages/client/src/pages/Home/InfoPanel/Body/views/History/HistoryBlockContent/ItemList.tsx index f26e217408..44d887c91f 100644 --- a/packages/client/src/pages/Home/InfoPanel/Body/views/History/HistoryBlockContent/ItemList.tsx +++ b/packages/client/src/pages/Home/InfoPanel/Body/views/History/HistoryBlockContent/ItemList.tsx @@ -69,9 +69,10 @@ export const HistoryItemList = ({ getInfoPanelItemIcon, checkAndOpenLocationAction, }: HistoryItemListProps) => { - const [isExpanded, setIsExpanded] = useState( - 1 + feed.related.length <= EXPANSION_THRESHOLD, - ); + const totalItems = feed.related.length + 1; + const isExpandable = totalItems > EXPANSION_THRESHOLD; + const [isExpanded, setIsExpanded] = useState(!isExpandable); + const onExpand = () => setIsExpanded(true); const items = [ @@ -151,7 +152,7 @@ export const HistoryItemList = ({ )} - {!isExpanded && ( + {isExpandable && !isExpanded && (