bigbuffet-rw/app/soapbox/features/ui/containers/modal_container.js
marcin mikołajczak a041a4452b Rename modal -> modals
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2022-02-02 16:36:20 +01:00

29 lines
661 B
JavaScript

import { connect } from 'react-redux';
import { cancelReplyCompose } from '../../../actions/compose';
import { closeModal } from '../../../actions/modals';
import ModalRoot from '../components/modal_root';
const mapStateToProps = state => {
const modal = state.get('modals').last({
modalType: null,
modalProps: {},
});
return {
type: modal.modalType,
props: modal.modalProps,
};
};
const mapDispatchToProps = (dispatch) => ({
onClose(type) {
if (type === 'COMPOSE') {
dispatch(cancelReplyCompose());
}
dispatch(closeModal(type));
},
});
export default connect(mapStateToProps, mapDispatchToProps)(ModalRoot);