New: Closing Move Series modal without selecting will cancel save

Closes #5448
This commit is contained in:
Mark McDowall 2023-03-15 21:55:17 -07:00
parent c80c1db947
commit cb86f4fa50
3 changed files with 14 additions and 2 deletions

View File

@ -30,6 +30,10 @@ class EditSeriesModalContent extends Component {
// //
// Listeners // Listeners
onCancelPress = () => {
this.setState({ isConfirmMoveModalOpen: false });
};
onSavePress = () => { onSavePress = () => {
const { const {
isPathChanging, isPathChanging,
@ -180,6 +184,7 @@ class EditSeriesModalContent extends Component {
originalPath={originalPath} originalPath={originalPath}
destinationPath={path.value} destinationPath={path.value}
isOpen={this.state.isConfirmMoveModalOpen} isOpen={this.state.isConfirmMoveModalOpen}
onModalClose={this.onCancelPress}
onSavePress={this.onSavePress} onSavePress={this.onSavePress}
onMoveSeriesPress={this.onMoveSeriesPress} onMoveSeriesPress={this.onMoveSeriesPress}
/> />

View File

@ -134,6 +134,10 @@ function EditSeriesModalContent(props: EditSeriesModalContentProps) {
} }
}, [rootFolderPath, save]); }, [rootFolderPath, save]);
const onCancelPress = useCallback(() => {
setIsConfirmMoveModalOpen(false);
}, [setIsConfirmMoveModalOpen]);
const onDoNotMoveSeriesPress = useCallback(() => { const onDoNotMoveSeriesPress = useCallback(() => {
setIsConfirmMoveModalOpen(false); setIsConfirmMoveModalOpen(false);
save(false); save(false);
@ -236,6 +240,7 @@ function EditSeriesModalContent(props: EditSeriesModalContentProps) {
<MoveSeriesModal <MoveSeriesModal
isOpen={isConfirmMoveModalOpen} isOpen={isConfirmMoveModalOpen}
destinationRootFolder={rootFolderPath} destinationRootFolder={rootFolderPath}
onModalClose={onCancelPress}
onSavePress={onDoNotMoveSeriesPress} onSavePress={onDoNotMoveSeriesPress}
onMoveSeriesPress={onMoveSeriesPress} onMoveSeriesPress={onMoveSeriesPress}
/> />

View File

@ -15,6 +15,7 @@ function MoveSeriesModal(props) {
destinationPath, destinationPath,
destinationRootFolder, destinationRootFolder,
isOpen, isOpen,
onModalClose,
onSavePress, onSavePress,
onMoveSeriesPress onMoveSeriesPress
} = props; } = props;
@ -33,11 +34,11 @@ function MoveSeriesModal(props) {
isOpen={isOpen} isOpen={isOpen}
size={sizes.MEDIUM} size={sizes.MEDIUM}
closeOnBackgroundClick={false} closeOnBackgroundClick={false}
onModalClose={onSavePress} onModalClose={onModalClose}
> >
<ModalContent <ModalContent
showCloseButton={true} showCloseButton={true}
onModalClose={onSavePress} onModalClose={onModalClose}
> >
<ModalHeader> <ModalHeader>
Move Files Move Files
@ -76,6 +77,7 @@ MoveSeriesModal.propTypes = {
destinationPath: PropTypes.string, destinationPath: PropTypes.string,
destinationRootFolder: PropTypes.string, destinationRootFolder: PropTypes.string,
isOpen: PropTypes.bool.isRequired, isOpen: PropTypes.bool.isRequired,
onModalClose: PropTypes.func.isRequired,
onSavePress: PropTypes.func.isRequired, onSavePress: PropTypes.func.isRequired,
onMoveSeriesPress: PropTypes.func.isRequired onMoveSeriesPress: PropTypes.func.isRequired
}; };