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
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}
/>

View File

@ -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) {
<MoveSeriesModal
isOpen={isConfirmMoveModalOpen}
destinationRootFolder={rootFolderPath}
onModalClose={onCancelPress}
onSavePress={onDoNotMoveSeriesPress}
onMoveSeriesPress={onMoveSeriesPress}
/>

View File

@ -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}
>
<ModalContent
showCloseButton={true}
onModalClose={onSavePress}
onModalClose={onModalClose}
>
<ModalHeader>
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
};