From bd338c0c963314aeaaf300fc29b0d2c104d2dd83 Mon Sep 17 00:00:00 2001 From: Pranita Fulsundar Date: Mon, 21 Jul 2025 16:57:52 +0530 Subject: [PATCH] fix(ui): count localisation for widgets (#22475) * fix count localisation string * minor fix * minor fix * dependency array fix --- .../MyData/FeedWidget/FeedWidget.component.tsx | 6 +++++- .../MyData/MyDataWidget/MyDataWidget.component.tsx | 10 ++++++++-- .../components/MyData/RightSidebar/FollowingWidget.tsx | 8 +++++++- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/src/components/MyData/FeedWidget/FeedWidget.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/MyData/FeedWidget/FeedWidget.component.tsx index 603914f442c..204358ecd44 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/MyData/FeedWidget/FeedWidget.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/MyData/FeedWidget/FeedWidget.component.tsx @@ -105,6 +105,10 @@ const MyFeedWidgetInternal = ({ ); }, []); + const showMoreCount = useMemo(() => { + return String(entityThread.length > 0 ? entityThread.length : ''); + }, [entityThread]); + const widgetBody = useMemo(() => { return ( <> @@ -163,7 +167,7 @@ const MyFeedWidgetInternal = ({ EntityTabs.ACTIVITY_FEED )} moreButtonText={t('label.view-more-count', { - count: String(entityThread.length > 0 ? entityThread.length : ''), + count: showMoreCount, })} showMoreButton={Boolean(!loading) && !isEmpty(entityThread)} /> diff --git a/openmetadata-ui/src/main/resources/ui/src/components/MyData/MyDataWidget/MyDataWidget.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/MyData/MyDataWidget/MyDataWidget.component.tsx index bc49e1f87cc..36d7beac2a2 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/MyData/MyDataWidget/MyDataWidget.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/MyData/MyDataWidget/MyDataWidget.component.tsx @@ -260,6 +260,11 @@ const MyDataWidgetInternal = ({ ); }, [data, isExpanded]); + + const showMoreCount = useMemo(() => { + return String(data.length > 0 ? data.length : ''); + }, [data]); + const widgetContent = useMemo(() => { return (
@@ -284,8 +289,8 @@ const MyDataWidgetInternal = ({ EntityTabs.ACTIVITY_FEED )} moreButtonText={t('label.view-more-count', { - count: String(data.length > 0 ? data.length : ''), - })} // if data is empty then show view more + count: showMoreCount, + })} showMoreButton={Boolean(!isLoading) && !isEmpty(data)} />
@@ -301,6 +306,7 @@ const MyDataWidgetInternal = ({ widgetKey, widgetData, isEditView, + showMoreCount, ]); return ( diff --git a/openmetadata-ui/src/main/resources/ui/src/components/MyData/RightSidebar/FollowingWidget.tsx b/openmetadata-ui/src/main/resources/ui/src/components/MyData/RightSidebar/FollowingWidget.tsx index 348b25f27ac..5fe6ea9265a 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/MyData/RightSidebar/FollowingWidget.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/MyData/RightSidebar/FollowingWidget.tsx @@ -179,6 +179,11 @@ function FollowingWidget({ ), [] ); + + const showMoreCount = useMemo(() => { + return String(followedData.length > 0 ? followedData.length : ''); + }, [followedData]); + const followingContent = useMemo(() => { return (
@@ -271,7 +276,7 @@ function FollowingWidget({ EntityTabs.ACTIVITY_FEED )} moreButtonText={t('label.view-more-count', { - count: String(followedData.length > 0 ? followedData.length : ''), + count: showMoreCount, })} showMoreButton={ Boolean(!isLoadingOwnedData) && !isEmpty(followedData) @@ -292,6 +297,7 @@ function FollowingWidget({ widgetKey, widgetData, isEditView, + showMoreCount, ]); return (