sforkowany z mirror/soapbox
Placeholder: render placeholder parent status in thread
rodzic
8a26db57f7
commit
ecdef1d95b
|
@ -3,12 +3,14 @@ import { connect } from 'react-redux';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import StatusContainer from 'soapbox/containers/status_container';
|
import StatusContainer from 'soapbox/containers/status_container';
|
||||||
import { OrderedSet as ImmutableOrderedSet } from 'immutable';
|
import { OrderedSet as ImmutableOrderedSet } from 'immutable';
|
||||||
|
import PlaceholderStatus from 'soapbox/features/placeholder/components/placeholder_status';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
const mapStateToProps = (state, { id }) => {
|
const mapStateToProps = (state, { id }) => {
|
||||||
return {
|
return {
|
||||||
replyToId: state.getIn(['statuses', id, 'in_reply_to_id']),
|
replyToId: state.getIn(['contexts', 'inReplyTos', id]),
|
||||||
replyCount: state.getIn(['contexts', 'replies', id], ImmutableOrderedSet()).size,
|
replyCount: state.getIn(['contexts', 'replies', id], ImmutableOrderedSet()).size,
|
||||||
|
isLoaded: Boolean(state.getIn(['statuses', id])),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -19,6 +21,7 @@ class ThreadStatus extends React.Component {
|
||||||
focusedStatusId: PropTypes.string,
|
focusedStatusId: PropTypes.string,
|
||||||
replyToId: PropTypes.string,
|
replyToId: PropTypes.string,
|
||||||
replyCount: PropTypes.number,
|
replyCount: PropTypes.number,
|
||||||
|
isLoaded: PropTypes.bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
renderConnector() {
|
renderConnector() {
|
||||||
|
@ -43,10 +46,16 @@ class ThreadStatus extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
const { isLoaded } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='thread__status'>
|
<div className='thread__status'>
|
||||||
{this.renderConnector()}
|
{this.renderConnector()}
|
||||||
|
{isLoaded ? (
|
||||||
<StatusContainer {...this.props} />
|
<StatusContainer {...this.props} />
|
||||||
|
) : (
|
||||||
|
<PlaceholderStatus />
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue