pleroma/app/soapbox/features/ui/containers/modal_container.js
marcin mikołajczak 807b3c7e5b Use stack for modals
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2022-01-30 18:53:47 +01:00

29 lines
659 B
JavaScript

import { connect } from 'react-redux';
import { cancelReplyCompose } from '../../../actions/compose';
import { closeModal } from '../../../actions/modal';
import ModalRoot from '../components/modal_root';
const mapStateToProps = state => {
const modal = state.get('modal').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);