mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2026-04-20 22:14:34 -04:00
Convert Add Indexer Modal to Typescript
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import React, { useCallback } from 'react';
|
||||
import { useDispatch } from 'react-redux';
|
||||
import Modal from 'Components/Modal/Modal';
|
||||
import { sizes } from 'Helpers/Props';
|
||||
import { clearIndexerSchema } from 'Store/Actions/indexerActions';
|
||||
import AddIndexerModalContent from './AddIndexerModalContent';
|
||||
import styles from './AddIndexerModal.css';
|
||||
|
||||
interface AddIndexerModalProps {
|
||||
isOpen: boolean;
|
||||
onSelectIndexer(): void;
|
||||
onModalClose(): void;
|
||||
}
|
||||
|
||||
function AddIndexerModal({
|
||||
isOpen,
|
||||
onSelectIndexer,
|
||||
onModalClose,
|
||||
...otherProps
|
||||
}: AddIndexerModalProps) {
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const onModalClosePress = useCallback(() => {
|
||||
dispatch(clearIndexerSchema());
|
||||
onModalClose();
|
||||
}, [dispatch, onModalClose]);
|
||||
|
||||
return (
|
||||
<Modal
|
||||
isOpen={isOpen}
|
||||
size={sizes.EXTRA_LARGE}
|
||||
onModalClose={onModalClosePress}
|
||||
className={styles.modal}
|
||||
>
|
||||
<AddIndexerModalContent
|
||||
{...otherProps}
|
||||
onSelectIndexer={onSelectIndexer}
|
||||
onModalClose={onModalClosePress}
|
||||
/>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
||||
AddIndexerModal.propTypes = {
|
||||
isOpen: PropTypes.bool.isRequired,
|
||||
onModalClose: PropTypes.func.isRequired,
|
||||
onSelectIndexer: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
export default AddIndexerModal;
|
||||
Reference in New Issue
Block a user