2021-06-11 14:49:57 +02:00
|
|
|
import React, { FunctionComponent, useState } from 'react';
|
2021-05-28 13:38:28 -04:00
|
|
|
|
2021-06-01 15:19:02 -04:00
|
|
|
import SearchFields from '../search/SearchFields';
|
2021-06-03 10:11:49 -04:00
|
|
|
import SearchResults from '../search/SearchResults';
|
2021-06-02 10:00:24 -04:00
|
|
|
import SearchSuggestions from '../search/SearchSuggestions';
|
2021-06-03 10:11:49 -04:00
|
|
|
import LiveTVSearchResults from '../search/LiveTVSearchResults';
|
2021-05-28 13:38:28 -04:00
|
|
|
|
2021-06-11 14:49:57 +02:00
|
|
|
type SearchProps = {
|
2021-06-18 16:59:54 +02:00
|
|
|
serverId?: string,
|
|
|
|
parentId?: string,
|
|
|
|
collectionType?: string
|
2021-06-11 14:49:57 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
const SearchPage: FunctionComponent<SearchProps> = ({ serverId, parentId, collectionType }: SearchProps) => {
|
2021-05-28 15:58:41 -04:00
|
|
|
const [ query, setQuery ] = useState(null);
|
2021-05-28 13:38:28 -04:00
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
2021-06-01 15:19:02 -04:00
|
|
|
<SearchFields onSearch={setQuery} />
|
2021-06-02 10:00:24 -04:00
|
|
|
{!query &&
|
|
|
|
<SearchSuggestions
|
2021-06-11 14:49:57 +02:00
|
|
|
serverId={serverId || window.ApiClient.serverId()}
|
2021-06-02 10:00:24 -04:00
|
|
|
parentId={parentId}
|
|
|
|
/>
|
|
|
|
}
|
2021-06-01 15:19:02 -04:00
|
|
|
<SearchResults
|
2021-06-11 14:49:57 +02:00
|
|
|
serverId={serverId || window.ApiClient.serverId()}
|
2021-05-28 15:58:41 -04:00
|
|
|
parentId={parentId}
|
|
|
|
collectionType={collectionType}
|
|
|
|
query={query}
|
2021-05-28 13:38:28 -04:00
|
|
|
/>
|
2021-06-03 10:11:49 -04:00
|
|
|
<LiveTVSearchResults
|
2021-06-11 14:49:57 +02:00
|
|
|
serverId={serverId || window.ApiClient.serverId()}
|
2021-06-03 10:11:49 -04:00
|
|
|
parentId={parentId}
|
|
|
|
collectionType={collectionType}
|
|
|
|
query={query}
|
|
|
|
/>
|
2021-05-28 13:38:28 -04:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default SearchPage;
|