@@ -131,10 +131,10 @@ export default class App extends React.Component <{}, AppState>{
131131 this . listDataSourceTypes ( ) ;
132132 }
133133
134- this . handleQueryInUrl ( ) ;
134+ this . handleSearch ( ) ;
135135 }
136136
137- handleQueryInUrl ( ) {
137+ handleSearch ( ) {
138138 const path = window . location . pathname ;
139139 const query = new URLSearchParams ( window . location . search ) . get ( 'query' ) ;
140140 if ( path === '/search' && query !== null && query !== "" ) {
@@ -397,9 +397,9 @@ export default class App extends React.Component <{}, AppState>{
397397 </ span >
398398 </ h1 >
399399 < SearchBar widthPercentage = { 32 } isDisabled = { this . state . isServerDown } query = { this . state . query } isLoading = { this . state . isLoading } showReset = { this . state . results . length > 0 }
400- onSearch = { this . search } onQueryChange = { this . handleQueryChange } onClear = { this . clear } showSuggestions = { true } />
400+ onSearch = { this . goSearchPage } onQueryChange = { this . handleQueryChange } onClear = { this . clear } showSuggestions = { true } />
401401
402- < button onClick = { this . search } className = "h-9 w-28 mt-8 p-3 flex items-center justify-center hover:shadow-sm
402+ < button onClick = { this . goSearchPage } className = "h-9 w-28 mt-8 p-3 flex items-center justify-center hover:shadow-sm
403403 transition duration-150 ease-in-out hover:shadow-[#6c6c6c] bg-[#2A2A2A] rounded border-[.5px] border-[#6e6e6e88]" >
404404 < span className = "font-bold text-[15px] text-[#B3B3B3]" > Search</ span >
405405 < img alt = "enter" className = "ml-2" src = { EnterImage } > </ img >
@@ -417,7 +417,7 @@ export default class App extends React.Component <{}, AppState>{
417417 </ span >
418418 < div className = "flex flex-col items-start w-10/12 sm:w-full" >
419419 < SearchBar widthPercentage = { 40 } isDisabled = { this . state . isServerDown } query = { this . state . query } isLoading = { this . state . isLoading } showReset = { this . state . results . length > 0 }
420- onSearch = { this . search } onQueryChange = { this . handleQueryChange } onClear = { this . clear } showSuggestions = { true } />
420+ onSearch = { this . goSearchPage } onQueryChange = { this . handleQueryChange } onClear = { this . clear } showSuggestions = { true } />
421421 {
422422 ! this . state . isLoading &&
423423 < span className = "text-[#D2D2D2] font-poppins font-medium text-base leading-[22px] mt-3" >
@@ -455,6 +455,10 @@ export default class App extends React.Component <{}, AppState>{
455455 this . setState ( { query : "" } ) ;
456456 }
457457
458+ goSearchPage = ( ) => {
459+ window . location . replace ( `/search?query=${ this . state . query } ` ) ;
460+ }
461+
458462 search = ( query ?: string ) => {
459463 if ( ! query && this . state . query === "" ) {
460464 console . log ( "empty query" ) ;
0 commit comments