fix(ui): count localisation for widgets (#22475)

* fix count localisation string

* minor fix

* minor fix

* dependency array fix
This commit is contained in:
Pranita Fulsundar 2025-07-21 16:57:52 +05:30 committed by GitHub
parent dfc9672016
commit bd338c0c96
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 20 additions and 4 deletions

View File

@ -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)}
/>

View File

@ -260,6 +260,11 @@ const MyDataWidgetInternal = ({
</div>
);
}, [data, isExpanded]);
const showMoreCount = useMemo(() => {
return String(data.length > 0 ? data.length : '');
}, [data]);
const widgetContent = useMemo(() => {
return (
<div className="my-data-widget-container">
@ -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)}
/>
</div>
@ -301,6 +306,7 @@ const MyDataWidgetInternal = ({
widgetKey,
widgetData,
isEditView,
showMoreCount,
]);
return (

View File

@ -179,6 +179,11 @@ function FollowingWidget({
),
[]
);
const showMoreCount = useMemo(() => {
return String(followedData.length > 0 ? followedData.length : '');
}, [followedData]);
const followingContent = useMemo(() => {
return (
<div className="entity-list-body">
@ -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 (