import React, { FC, useState } from 'react'; import { useTranslation } from 'react-i18next'; import SearchPageForm from './SearchPageForm'; import AppContainer from '../../client/services/AppContainer'; import DeleteSelectedPageGroup from './DeleteSelectedPageGroup'; import SearchOptionModal from './SearchOptionModal'; import SortControl from './SortControl'; import { CheckboxType, SORT_AXIS, SORT_ORDER } from '../../interfaces/search'; type Props = { searchingKeyword: string, sort: SORT_AXIS, order: SORT_ORDER, appContainer: AppContainer, searchResultCount: number, selectAllCheckboxType: CheckboxType, onClickDeleteAllButton?: () => void onClickSelectAllCheckbox?: (nextSelectAllCheckboxType: CheckboxType) => void, excludeUserPages: boolean, excludeTrashPages: boolean, onSearchInvoked: (data: {keyword: string}) => boolean, onExcludeUserPagesSwitched?: () => void, onExcludeTrashPagesSwitched?: () => void, onChangeSortInvoked?: (nextSort: SORT_AXIS, nextOrder: SORT_ORDER) => void, } const SearchControl: FC = (props: Props) => { const [isFileterOptionModalShown, setIsFileterOptionModalShown] = useState(false); // Temporaly workaround for lint error // later needs to be fixed: SearchControl to typescript componet const SearchPageFormTypeAny : any = SearchPageForm; const { t } = useTranslation(''); const { searchResultCount } = props; const switchExcludeUserPagesHandler = () => { if (props.onExcludeUserPagesSwitched != null) { props.onExcludeUserPagesSwitched(); } }; const switchExcludeTrashPagesHandler = () => { if (props.onExcludeTrashPagesSwitched != null) { props.onExcludeTrashPagesSwitched(); } }; const onChangeSortInvoked = (nextSort: SORT_AXIS, nextOrder:SORT_ORDER) => { if (props.onChangeSortInvoked != null) { props.onChangeSortInvoked(nextSort, nextOrder); } }; const openSearchOptionModalHandler = () => { setIsFileterOptionModalShown(true); }; const closeSearchOptionModalHandler = () => { setIsFileterOptionModalShown(false); }; const onRetrySearchInvoked = () => { if (props.onSearchInvoked != null) { props.onSearchInvoked({ keyword: props.searchingKeyword }); } }; const rednerSearchOptionModal = () => { return ( ); }; return (
{/* TODO: replace the following elements deleteAll button , relevance button and include specificPath button component */}
{/* Todo: design will be fixed in #80324. Function will be implemented in #77525 */}
{/** filter option */}
{rednerSearchOptionModal()}
); }; export default SearchControl;