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(() => { const widgetBody = useMemo(() => {
return ( return (
<> <>
@ -163,7 +167,7 @@ const MyFeedWidgetInternal = ({
EntityTabs.ACTIVITY_FEED EntityTabs.ACTIVITY_FEED
)} )}
moreButtonText={t('label.view-more-count', { moreButtonText={t('label.view-more-count', {
count: String(entityThread.length > 0 ? entityThread.length : ''), count: showMoreCount,
})} })}
showMoreButton={Boolean(!loading) && !isEmpty(entityThread)} showMoreButton={Boolean(!loading) && !isEmpty(entityThread)}
/> />

View File

@ -260,6 +260,11 @@ const MyDataWidgetInternal = ({
</div> </div>
); );
}, [data, isExpanded]); }, [data, isExpanded]);
const showMoreCount = useMemo(() => {
return String(data.length > 0 ? data.length : '');
}, [data]);
const widgetContent = useMemo(() => { const widgetContent = useMemo(() => {
return ( return (
<div className="my-data-widget-container"> <div className="my-data-widget-container">
@ -284,8 +289,8 @@ const MyDataWidgetInternal = ({
EntityTabs.ACTIVITY_FEED EntityTabs.ACTIVITY_FEED
)} )}
moreButtonText={t('label.view-more-count', { moreButtonText={t('label.view-more-count', {
count: String(data.length > 0 ? data.length : ''), count: showMoreCount,
})} // if data is empty then show view more })}
showMoreButton={Boolean(!isLoading) && !isEmpty(data)} showMoreButton={Boolean(!isLoading) && !isEmpty(data)}
/> />
</div> </div>
@ -301,6 +306,7 @@ const MyDataWidgetInternal = ({
widgetKey, widgetKey,
widgetData, widgetData,
isEditView, isEditView,
showMoreCount,
]); ]);
return ( return (

View File

@ -179,6 +179,11 @@ function FollowingWidget({
), ),
[] []
); );
const showMoreCount = useMemo(() => {
return String(followedData.length > 0 ? followedData.length : '');
}, [followedData]);
const followingContent = useMemo(() => { const followingContent = useMemo(() => {
return ( return (
<div className="entity-list-body"> <div className="entity-list-body">
@ -271,7 +276,7 @@ function FollowingWidget({
EntityTabs.ACTIVITY_FEED EntityTabs.ACTIVITY_FEED
)} )}
moreButtonText={t('label.view-more-count', { moreButtonText={t('label.view-more-count', {
count: String(followedData.length > 0 ? followedData.length : ''), count: showMoreCount,
})} })}
showMoreButton={ showMoreButton={
Boolean(!isLoadingOwnedData) && !isEmpty(followedData) Boolean(!isLoadingOwnedData) && !isEmpty(followedData)
@ -292,6 +297,7 @@ function FollowingWidget({
widgetKey, widgetKey,
widgetData, widgetData,
isEditView, isEditView,
showMoreCount,
]); ]);
return ( return (