2017-02-22 14:43:07 +00:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { cancelReplyCompose } from '../../../actions/compose';
|
|
|
|
import { makeGetStatus } from '../../../selectors';
|
|
|
|
import ReplyIndicator from '../components/reply_indicator';
|
|
|
|
|
|
|
|
const makeMapStateToProps = () => {
|
|
|
|
const getStatus = makeGetStatus();
|
|
|
|
|
2022-02-09 23:15:30 +00:00
|
|
|
const mapStateToProps = state => {
|
|
|
|
let statusId = state.getIn(['compose', 'id'], null);
|
|
|
|
let editing = true;
|
|
|
|
|
|
|
|
if (statusId === null) {
|
|
|
|
statusId = state.getIn(['compose', 'in_reply_to']);
|
|
|
|
editing = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
status: getStatus(state, { id: statusId }),
|
|
|
|
editing,
|
|
|
|
};
|
|
|
|
};
|
2017-02-22 14:43:07 +00:00
|
|
|
|
|
|
|
return mapStateToProps;
|
|
|
|
};
|
|
|
|
|
|
|
|
const mapDispatchToProps = dispatch => ({
|
|
|
|
|
|
|
|
onCancel () {
|
|
|
|
dispatch(cancelReplyCompose());
|
2017-05-20 15:31:47 +00:00
|
|
|
},
|
2017-02-22 14:43:07 +00:00
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
export default connect(makeMapStateToProps, mapDispatchToProps)(ReplyIndicator);
|