mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-24 13:58:06 +01:00
64 lines
1.4 KiB
JavaScript
64 lines
1.4 KiB
JavaScript
import { connect } from 'react-redux';
|
|
import Status from '../components/status';
|
|
import { makeGetStatus } from '../selectors';
|
|
import {
|
|
replyCompose,
|
|
mentionCompose
|
|
} from '../actions/compose';
|
|
import {
|
|
reblog,
|
|
favourite,
|
|
unreblog,
|
|
unfavourite
|
|
} from '../actions/interactions';
|
|
import { deleteStatus } from '../actions/statuses';
|
|
import { openMedia } from '../actions/modal';
|
|
|
|
const makeMapStateToProps = () => {
|
|
const getStatus = makeGetStatus();
|
|
|
|
const mapStateToProps = (state, props) => ({
|
|
status: getStatus(state, props.id),
|
|
me: state.getIn(['meta', 'me'])
|
|
});
|
|
|
|
return mapStateToProps;
|
|
};
|
|
|
|
const mapDispatchToProps = (dispatch) => ({
|
|
|
|
onReply (status) {
|
|
dispatch(replyCompose(status));
|
|
},
|
|
|
|
onReblog (status) {
|
|
if (status.get('reblogged')) {
|
|
dispatch(unreblog(status));
|
|
} else {
|
|
dispatch(reblog(status));
|
|
}
|
|
},
|
|
|
|
onFavourite (status) {
|
|
if (status.get('favourited')) {
|
|
dispatch(unfavourite(status));
|
|
} else {
|
|
dispatch(favourite(status));
|
|
}
|
|
},
|
|
|
|
onDelete (status) {
|
|
dispatch(deleteStatus(status.get('id')));
|
|
},
|
|
|
|
onMention (account) {
|
|
dispatch(mentionCompose(account));
|
|
},
|
|
|
|
onOpenMedia (url) {
|
|
dispatch(openMedia(url));
|
|
}
|
|
|
|
});
|
|
|
|
export default connect(makeMapStateToProps, mapDispatchToProps)(Status);
|