2022-04-14 01:19:27 -04:00
|
|
|
import React, { FunctionComponent, useState } from 'react';
|
|
|
|
import { useSearchParams } from 'react-router-dom';
|
|
|
|
|
|
|
|
import Page from '../components/Page';
|
|
|
|
import SearchFields from '../components/search/SearchFields';
|
|
|
|
import SearchResults from '../components/search/SearchResults';
|
|
|
|
import SearchSuggestions from '../components/search/SearchSuggestions';
|
|
|
|
import LiveTVSearchResults from '../components/search/LiveTVSearchResults';
|
|
|
|
import globalize from '../scripts/globalize';
|
|
|
|
|
|
|
|
const SearchPage: FunctionComponent = () => {
|
|
|
|
const [ query, setQuery ] = useState<string>();
|
|
|
|
const [ searchParams ] = useSearchParams();
|
|
|
|
|
|
|
|
return (
|
2022-06-14 12:48:49 -04:00
|
|
|
<Page title={globalize.translate('Search')} className='mainAnimatedPage libraryPage allLibraryPage noSecondaryNavPage'>
|
2022-04-14 01:19:27 -04:00
|
|
|
<SearchFields onSearch={setQuery} />
|
|
|
|
{!query &&
|
|
|
|
<SearchSuggestions
|
|
|
|
serverId={searchParams.get('serverId') || window.ApiClient.serverId()}
|
|
|
|
parentId={searchParams.get('parentId')}
|
|
|
|
/>
|
|
|
|
}
|
|
|
|
<SearchResults
|
|
|
|
serverId={searchParams.get('serverId') || window.ApiClient.serverId()}
|
|
|
|
parentId={searchParams.get('parentId')}
|
|
|
|
collectionType={searchParams.get('collectionType')}
|
|
|
|
query={query}
|
|
|
|
/>
|
|
|
|
<LiveTVSearchResults
|
|
|
|
serverId={searchParams.get('serverId') || window.ApiClient.serverId()}
|
|
|
|
parentId={searchParams.get('parentId')}
|
|
|
|
collectionType={searchParams.get('collectionType')}
|
|
|
|
query={query}
|
|
|
|
/>
|
|
|
|
</Page>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default SearchPage;
|