mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-20 21:55:03 -04:00
3945a2eeb8
(cherry picked from commit 6e008a8e855e67bb14b0e04bdb9042eebcacb59f)
46 lines
1.2 KiB
TypeScript
46 lines
1.2 KiB
TypeScript
import React, { useCallback } from 'react';
|
|
import { useDispatch } from 'react-redux';
|
|
import Modal from 'Components/Modal/Modal';
|
|
import { sizes } from 'Helpers/Props';
|
|
import { clearPendingChanges } from 'Store/Actions/baseActions';
|
|
import {
|
|
cancelSaveIndexer,
|
|
cancelTestIndexer,
|
|
} from 'Store/Actions/settingsActions';
|
|
import EditIndexerModalContent, {
|
|
EditIndexerModalContentProps,
|
|
} from './EditIndexerModalContent';
|
|
|
|
const section = 'settings.indexers';
|
|
|
|
interface EditIndexerModalProps extends EditIndexerModalContentProps {
|
|
isOpen: boolean;
|
|
}
|
|
|
|
function EditIndexerModal({
|
|
isOpen,
|
|
onModalClose,
|
|
...otherProps
|
|
}: EditIndexerModalProps) {
|
|
const dispatch = useDispatch();
|
|
|
|
const handleModalClose = useCallback(() => {
|
|
dispatch(clearPendingChanges({ section }));
|
|
dispatch(cancelTestIndexer({ section }));
|
|
dispatch(cancelSaveIndexer({ section }));
|
|
|
|
onModalClose();
|
|
}, [dispatch, onModalClose]);
|
|
|
|
return (
|
|
<Modal size={sizes.MEDIUM} isOpen={isOpen} onModalClose={handleModalClose}>
|
|
<EditIndexerModalContent
|
|
{...otherProps}
|
|
onModalClose={handleModalClose}
|
|
/>
|
|
</Modal>
|
|
);
|
|
}
|
|
|
|
export default EditIndexerModal;
|