@@ -3,7 +3,7 @@ import { User } from "../../models/User";
33import  {  Content  }  from  "../../models/Content" ; 
44import  {  useSearchParams  }  from  "react-router-dom" ; 
55import  ContentSearchResult  from  "./ContentSearchResult" ; 
6- import  UserSearchResults  from  "./UserSearchResult" ; 
6+ import  UserSearchResult  from  "./UserSearchResult" ; 
77import  {  SearchService  }  from  "../../services/SearchService" ; 
88
99function  SearchListResults ( { 
@@ -94,7 +94,7 @@ function SearchListResults({
9494      setUserStartingPoint ( uniqueUsers [ uniqueUsers . length  -  1 ] ?. uid  ||  null ) ; 
9595
9696      // Enable or disable the "Fetch more" button based on the number of users 
97-       setUserDisabled ( usersReturned . length   +   uniqueUsers . length   <   5 ) ; 
97+       setUserDisabled ( ! userSearchResults . nextStartingPoint ) ; 
9898    }  else  { 
9999      setUserDisabled ( true ) ;  // Disable the button if no unique users are found 
100100    } 
@@ -143,8 +143,8 @@ function SearchListResults({
143143        uniqueContents [ uniqueContents . length  -  1 ] ?. uid  ||  null 
144144      ) ; 
145145
146-       // Enable or disable the "Fetch more" button based on the number of users  
147-       setContentDisabled ( contentReturned . length   +   uniqueContents . length   <   5 ) ; 
146+       // Enable or disable the "Fetch more" button based on the number of contents  
147+       setContentDisabled ( ! searchContentResults . nextStartingPoint ) ; 
148148    }  else  { 
149149      setContentDisabled ( true ) ;  // Disable the button if no unique content are found 
150150    } 
@@ -163,10 +163,11 @@ function SearchListResults({
163163        )  : ( 
164164          usersReturned . map ( ( user : User ,  index )  =>  ( 
165165            < div  key = { index }  className = 'searchItem' > 
166-               < UserSearchResults  user = { user }  /> 
166+               < UserSearchResult  user = { user }  /> 
167167            </ div > 
168168          ) ) 
169169        ) } 
170+         { fetching  &&  < p > Loading...</ p > } 
170171        { ! userDisabled  &&  ( 
171172          < button  className = 'fetchMoreButton'  onClick = { fetchUserData } > 
172173            Fetch more users
@@ -183,7 +184,7 @@ function SearchListResults({
183184            </ div > 
184185          ) ) 
185186        ) } 
186- 
187+          { fetching   &&   < p > Loading... </ p > } 
187188        { ! contentDisabled  &&  ( 
188189          < button  className = 'fetchMoreButton'  onClick = { fetchContentData } > 
189190            Fetch more contents
0 commit comments