bigbuffet-rw/app/soapbox/features/compose/containers/schedule_button_container.js
marcin mikołajczak b8be588b60 Post editing: Compose improvements
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2022-05-03 23:00:07 +02:00

25 lines
665 B
JavaScript

import { connect } from 'react-redux';
import { addSchedule, removeSchedule } from '../../../actions/compose';
import ScheduleButton from '../components/schedule_button';
const mapStateToProps = state => ({
active: state.getIn(['compose', 'schedule']) ? true : false,
unavailable: !!state.getIn(['compose', 'id']),
});
const mapDispatchToProps = dispatch => ({
onClick() {
dispatch((dispatch, getState) => {
if (getState().getIn(['compose', 'schedule'])) {
dispatch(removeSchedule());
} else {
dispatch(addSchedule());
}
});
},
});
export default connect(mapStateToProps, mapDispatchToProps)(ScheduleButton);