add null return in ModalBase and remove mountModal() calls

This commit is contained in:
KDSBrowne 2018-03-16 16:16:01 -07:00
parent 5fbb6c8e4f
commit c2ff34a194
5 changed files with 10 additions and 26 deletions

View File

@ -1,7 +1,6 @@
import React, { PureComponent } from 'react';
import { defineMessages, injectIntl } from 'react-intl';
import Modal from '/imports/ui/components/modal/simple/component';
import { withModalMounter } from '/imports/ui/components/modal/service';
const intlMessages = defineMessages({
title: {
@ -41,16 +40,12 @@ class AboutComponent extends PureComponent {
intl,
clientBuild,
copyright,
mountModal,
} = this.props;
return (
<Modal
title={intl.formatMessage(intlMessages.title)}
dismiss={{
callback: () => {
mountModal(null);
},
label: intl.formatMessage(intlMessages.dismissLabel),
description: intl.formatMessage(intlMessages.dismissDesc),
}}
@ -62,4 +57,4 @@ class AboutComponent extends PureComponent {
}
}
export default withModalMounter(injectIntl(AboutComponent));
export default injectIntl(AboutComponent);

View File

@ -4,7 +4,6 @@ import { withRouter } from 'react-router';
import { defineMessages, injectIntl } from 'react-intl';
import Button from '/imports/ui/components/button/component';
import Modal from '/imports/ui/components/modal/fullscreen/component';
import { withModalMounter } from '/imports/ui/components/modal/service';
import { styles } from './styles';
const propTypes = {
@ -62,22 +61,18 @@ class LeaveConfirmation extends PureComponent {
router,
handleEndMeeting,
showEndMeeting,
mountModal,
} = this.props;
return (
<Modal
title={intl.formatMessage(intlMessages.title)}
confirm={{
callback: () => {
mountModal(null);
router.push('/logout');
},
callback: () => router.push('/logout'),
label: intl.formatMessage(intlMessages.confirmLabel),
description: intl.formatMessage(intlMessages.confirmDesc),
}}
dismiss={{
callback: () => mountModal(null),
callback: () => null,
label: intl.formatMessage(intlMessages.dismissLabel),
description: intl.formatMessage(intlMessages.dismissDesc),
}}
@ -95,9 +90,9 @@ class LeaveConfirmation extends PureComponent {
<div id="modalEndMeetingDesc" hidden>{intl.formatMessage(intlMessages.endMeetingDesc)}</div>
</Modal>
);
}
}
}
LeaveConfirmation.propTypes = propTypes;
export default withModalMounter(withRouter(injectIntl(LeaveConfirmation)));
export default withRouter(injectIntl(LeaveConfirmation));

View File

@ -20,6 +20,8 @@ const defaultProps = {
export default class ModalBase extends Component {
render() {
if (!this.props.isOpen) return null;
return (
<ReactModal {...this.props}>
{this.props.children}

View File

@ -8,7 +8,6 @@ import _ from 'lodash';
import { notify } from '/imports/ui/services/notification';
import ModalFullscreen from '/imports/ui/components/modal/fullscreen/component';
import { withModalMounter } from '/imports/ui/components/modal/service';
import Icon from '/imports/ui/components/icon/component';
import ButtonBase from '/imports/ui/components/button/base/component';
import Checkbox from '/imports/ui/components/checkbox/component';
@ -168,7 +167,6 @@ class PresentationUploader extends Component {
}
handleConfirm() {
const { mountModal } = this.props;
const presentationsToSave = this.state.presentations
.filter(p => !p.upload.error && !p.conversion.error);
@ -201,7 +199,7 @@ class PresentationUploader extends Component {
this.handleCurrentChange(this.state.oldCurrentId);
}
});
}).then(() => mountModal(null))
})
.catch((error) => {
notify(this.props.intl.formatMessage(intlMessages.genericError), 'error');
@ -215,8 +213,6 @@ class PresentationUploader extends Component {
}
handleDismiss() {
const { mountModal } = this.props;
mountModal(null);
return new Promise((resolve) => {
this.setState({
preventClosing: false,
@ -516,4 +512,4 @@ class PresentationUploader extends Component {
PresentationUploader.propTypes = propTypes;
PresentationUploader.defaultProps = defaultProps;
export default withModalMounter(injectIntl(PresentationUploader));
export default injectIntl(PresentationUploader);

View File

@ -217,7 +217,6 @@ class Settings extends Component {
title={intl.formatMessage(intlMessages.SettingsLabel)}
confirm={{
callback: () => {
this.props.mountModal(null);
if (location.pathname.includes('/users')) {
router.push('/');
}
@ -227,10 +226,7 @@ class Settings extends Component {
description: intl.formatMessage(intlMessages.SaveLabelDesc),
}}
dismiss={{
callback: () => {
this.props.mountModal(null);
Settings.setHtmlFontSize(this.state.saved.application.fontSize);
},
callback: () => Settings.setHtmlFontSize(this.state.saved.application.fontSize),
label: intl.formatMessage(intlMessages.CancelLabel),
description: intl.formatMessage(intlMessages.CancelLabelDesc),
}}