import React from 'react';
import { connect } from 'react-redux';
import ImmutablePureComponent from 'react-immutable-pure-component';
import StatusContainer from 'flavours/glitch/containers/status_container';
import LoadMore from 'flavours/glitch/components/load_more';
const mapStateToProps = (state, { id }) => {
let status = state.getIn(['statuses', id]);
let reblogId = status.get('reblog'); // reblog here is a id
return {
childrenWithGrandchildren: state.getIn(['contexts', 'replies', reblogId || id], []).map((cid) => ({
cid,
grandchildrenIds: state.getIn(['contexts', 'replies', cid], []),
})),
quotedId: reblogId && state.getIn(['statuses', reblogId, 'in_reply_to_id']),
};
};
const N = 3;
export default @connect(mapStateToProps)
class StatusWithComments extends ImmutablePureComponent {
state = {
showAll: false,
};
show = () => this.setState({ showAll: true });
render() {
const { id, childrenWithGrandchildren, quotedId, ...other } = this.props;
const { showAll } = this.state;
const loadMore = (