New: Closing Move Movie modal without selecting will cancel save

Closes #8225

Co-Authored-By: Mark McDowall <markus101@users.noreply.github.com>
pull/8424/head
Qstick 2 years ago
parent 80d7bdb834
commit a41999f9c2

@ -31,6 +31,10 @@ class EditMovieModalContent extends Component {
// //
// Listeners // Listeners
onCancelPress = () => {
this.setState({ isConfirmMoveModalOpen: false });
};
onSavePress = () => { onSavePress = () => {
const { const {
isPathChanging, isPathChanging,
@ -171,6 +175,7 @@ class EditMovieModalContent 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}
onMoveMoviePress={this.onMoveMoviePress} onMoveMoviePress={this.onMoveMoviePress}
/> />

@ -100,6 +100,10 @@ function EditMoviesModalContent(props: EditMoviesModalContentProps) {
} }
}, [rootFolderPath, save]); }, [rootFolderPath, save]);
const onCancelPress = useCallback(() => {
setIsConfirmMoveModalOpen(false);
}, [setIsConfirmMoveModalOpen]);
const onDoNotMoveMoviePress = useCallback(() => { const onDoNotMoveMoviePress = useCallback(() => {
setIsConfirmMoveModalOpen(false); setIsConfirmMoveModalOpen(false);
save(false); save(false);
@ -177,6 +181,7 @@ function EditMoviesModalContent(props: EditMoviesModalContentProps) {
<MoveMovieModal <MoveMovieModal
isOpen={isConfirmMoveModalOpen} isOpen={isConfirmMoveModalOpen}
destinationRootFolder={rootFolderPath} destinationRootFolder={rootFolderPath}
onModalClose={onCancelPress}
onSavePress={onDoNotMoveMoviePress} onSavePress={onDoNotMoveMoviePress}
onMoveMoviePress={onMoveMoviePress} onMoveMoviePress={onMoveMoviePress}
/> />

@ -16,6 +16,7 @@ function MoveMovieModal(props) {
destinationPath, destinationPath,
destinationRootFolder, destinationRootFolder,
isOpen, isOpen,
onModalClose,
onSavePress, onSavePress,
onMoveMoviePress onMoveMoviePress
} = props; } = props;
@ -34,11 +35,11 @@ function MoveMovieModal(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>
{translate('MoveFiles')} {translate('MoveFiles')}
@ -84,6 +85,7 @@ MoveMovieModal.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,
onMoveMoviePress: PropTypes.func.isRequired onMoveMoviePress: PropTypes.func.isRequired
}; };

Loading…
Cancel
Save