55} from '@wordpress/components' ;
66import { check , Icon } from '@wordpress/icons' ;
77import { useI18n } from '@wordpress/react-i18n' ;
8- import { PropsWithChildren , useEffect } from 'react' ;
8+ import { PropsWithChildren , useEffect , useState } from 'react' ;
99import { ArrowIcon } from 'src/components/arrow-icon' ;
1010import Button from 'src/components/button' ;
1111import offlineIcon from 'src/components/offline-icon' ;
@@ -14,7 +14,7 @@ import { useSyncSites } from 'src/hooks/sync-sites';
1414import { useAuth } from 'src/hooks/use-auth' ;
1515import { useOffline } from 'src/hooks/use-offline' ;
1616import { getIpcApi } from 'src/lib/get-ipc-api' ;
17- import { ListSites } from 'src/modules/sync/components/sync-sites-modal-selector' ;
17+ import { ListSites , SearchSites } from 'src/modules/sync/components/sync-sites-modal-selector' ;
1818import { SyncTabImage } from 'src/modules/sync/components/sync-tab-image' ;
1919import type { SyncSite } from 'src/hooks/use-fetch-wpcom-sites/types' ;
2020
@@ -121,6 +121,15 @@ export function PullRemoteSite( {
121121 const { isAuthenticated } = useAuth ( ) ;
122122 const { location } = useNavigator ( ) ;
123123 const { syncSites, refetchSites } = useSyncSites ( ) ;
124+ const [ searchQuery , setSearchQuery ] = useState < string > ( '' ) ;
125+
126+ const filteredSites = syncSites . filter ( ( site ) => {
127+ const searchQueryLower = searchQuery . toLowerCase ( ) ;
128+ return (
129+ site . name ?. toLowerCase ( ) . includes ( searchQueryLower ) ||
130+ site . url ?. toLowerCase ( ) . includes ( searchQueryLower )
131+ ) ;
132+ } ) ;
124133
125134 useEffect ( ( ) => {
126135 if ( location . path === '/pullRemote' && isAuthenticated ) {
@@ -138,15 +147,20 @@ export function PullRemoteSite( {
138147 } ;
139148
140149 return (
141- < VStack className = "text-center w-full" alignment = "top" spacing = "3" >
142- < Heading className = "text-[32px] text-gray-900" weight = { 500 } >
150+ < VStack className = "w-full" alignment = "top" spacing = "3" >
151+ < Heading className = "text-center text- [32px] text-gray-900" weight = { 500 } >
143152 { __ ( 'Pull your remote site' ) }
144153 </ Heading >
145- < ListSites
146- syncSites = { syncSites }
147- selectedSiteId = { selectedRemoteSite ?. id || null }
148- onSelectSite = { handleSiteSelect }
149- />
154+ < VStack className = "flex flex-col w-full max-w-[650px] flex-1" >
155+ < SearchSites searchQuery = { searchQuery } setSearchQuery = { setSearchQuery } />
156+ < div className = "h-full" >
157+ < ListSites
158+ syncSites = { filteredSites }
159+ selectedSiteId = { selectedRemoteSite ?. id || null }
160+ onSelectSite = { handleSiteSelect }
161+ />
162+ </ div >
163+ </ VStack >
150164 </ VStack >
151165 ) ;
152166}
0 commit comments