From cb86f4fa50fd4755ad90a858fe70a229a7ca2975 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 15 Mar 2023 21:55:17 -0700 Subject: [PATCH] New: Closing Move Series modal without selecting will cancel save Closes #5448 --- frontend/src/Series/Edit/EditSeriesModalContent.js | 5 +++++ .../src/Series/Index/Select/Edit/EditSeriesModalContent.tsx | 5 +++++ frontend/src/Series/MoveSeries/MoveSeriesModal.js | 6 ++++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/frontend/src/Series/Edit/EditSeriesModalContent.js b/frontend/src/Series/Edit/EditSeriesModalContent.js index 061d95cd4..5f3aa5670 100644 --- a/frontend/src/Series/Edit/EditSeriesModalContent.js +++ b/frontend/src/Series/Edit/EditSeriesModalContent.js @@ -30,6 +30,10 @@ class EditSeriesModalContent extends Component { // // Listeners + onCancelPress = () => { + this.setState({ isConfirmMoveModalOpen: false }); + }; + onSavePress = () => { const { isPathChanging, @@ -180,6 +184,7 @@ class EditSeriesModalContent extends Component { originalPath={originalPath} destinationPath={path.value} isOpen={this.state.isConfirmMoveModalOpen} + onModalClose={this.onCancelPress} onSavePress={this.onSavePress} onMoveSeriesPress={this.onMoveSeriesPress} /> diff --git a/frontend/src/Series/Index/Select/Edit/EditSeriesModalContent.tsx b/frontend/src/Series/Index/Select/Edit/EditSeriesModalContent.tsx index 677790d77..102dad11c 100644 --- a/frontend/src/Series/Index/Select/Edit/EditSeriesModalContent.tsx +++ b/frontend/src/Series/Index/Select/Edit/EditSeriesModalContent.tsx @@ -134,6 +134,10 @@ function EditSeriesModalContent(props: EditSeriesModalContentProps) { } }, [rootFolderPath, save]); + const onCancelPress = useCallback(() => { + setIsConfirmMoveModalOpen(false); + }, [setIsConfirmMoveModalOpen]); + const onDoNotMoveSeriesPress = useCallback(() => { setIsConfirmMoveModalOpen(false); save(false); @@ -236,6 +240,7 @@ function EditSeriesModalContent(props: EditSeriesModalContentProps) { diff --git a/frontend/src/Series/MoveSeries/MoveSeriesModal.js b/frontend/src/Series/MoveSeries/MoveSeriesModal.js index 5a173c35e..6276a3c6c 100644 --- a/frontend/src/Series/MoveSeries/MoveSeriesModal.js +++ b/frontend/src/Series/MoveSeries/MoveSeriesModal.js @@ -15,6 +15,7 @@ function MoveSeriesModal(props) { destinationPath, destinationRootFolder, isOpen, + onModalClose, onSavePress, onMoveSeriesPress } = props; @@ -33,11 +34,11 @@ function MoveSeriesModal(props) { isOpen={isOpen} size={sizes.MEDIUM} closeOnBackgroundClick={false} - onModalClose={onSavePress} + onModalClose={onModalClose} > Move Files @@ -76,6 +77,7 @@ MoveSeriesModal.propTypes = { destinationPath: PropTypes.string, destinationRootFolder: PropTypes.string, isOpen: PropTypes.bool.isRequired, + onModalClose: PropTypes.func.isRequired, onSavePress: PropTypes.func.isRequired, onMoveSeriesPress: PropTypes.func.isRequired };