Skip to content

Commit

Permalink
update search label and ensure it is updated in the hook (#94343)
Browse files Browse the repository at this point in the history
  • Loading branch information
Addison-Stavlo authored Sep 9, 2024
1 parent d30a7d3 commit 910c4da
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions client/hosting/sites/components/sites-dataviews/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useHasEnTranslation } from '@automattic/i18n-utils';
import { useI18n } from '@wordpress/react-i18n';
import { useCallback, useEffect, useMemo, useState } from 'react';
import ItemsDataViews from 'calypso/a8c-for-agencies/components/items-dashboard/items-dataviews';
Expand Down Expand Up @@ -52,6 +53,7 @@ const DotcomSitesDataViews = ( {
setDataViewsState,
}: Props ) => {
const { __ } = useI18n();
const hasEnTranslation = useHasEnTranslation();
const userId = useSelector( getCurrentUserId );

const openSitePreviewPane = useCallback(
Expand Down Expand Up @@ -176,11 +178,15 @@ const DotcomSitesDataViews = ( {
[ __, openSitePreviewPane, userId, dataViewsState, setDataViewsState, siteStatusGroups ]
);

const siteSearchLabel = hasEnTranslation( 'Search sites…' )
? __( 'Search sites…' )
: __( 'Search sites' );

// Create the itemData packet state
const [ itemsData, setItemsData ] = useState< ItemsDataViewsType< SiteExcerptData > >( {
items: sites,
itemFieldId: 'ID',
searchLabel: __( 'Search by name or domain…' ),
searchLabel: siteSearchLabel,
fields,
actions: [],
setDataViewsState: setDataViewsState,
Expand All @@ -198,10 +204,11 @@ const DotcomSitesDataViews = ( {
// actions: actions,
setDataViewsState,
dataViewsState,
searchLabel: siteSearchLabel,
selectedItem: dataViewsState.selectedItem,
pagination: paginationInfo,
} ) );
}, [ fields, dataViewsState, paginationInfo, setDataViewsState, sites ] ); // add actions when implemented
}, [ fields, dataViewsState, paginationInfo, setDataViewsState, sites, siteSearchLabel ] ); // add actions when implemented

return (
<ItemsDataViews
Expand Down

0 comments on commit 910c4da

Please sign in to comment.