diff --git a/app/soapbox/components/column.js b/app/soapbox/components/column.js index a8aec1542..1b5fabb05 100644 --- a/app/soapbox/components/column.js +++ b/app/soapbox/components/column.js @@ -11,6 +11,10 @@ export default class Column extends React.PureComponent { label: PropTypes.string, }; + setRef = c => { + this.node = c; + } + render() { const { className, label, children, transparent, ...rest } = this.props; @@ -20,6 +24,7 @@ export default class Column extends React.PureComponent { aria-label={label} className={classNames('column', className, { 'column--transparent': transparent })} {...rest} + ref={this.setRef} > {children} diff --git a/app/soapbox/components/material_status.js b/app/soapbox/components/material_status.js index 6454497c5..9ff242507 100644 --- a/app/soapbox/components/material_status.js +++ b/app/soapbox/components/material_status.js @@ -4,24 +4,24 @@ import React from 'react'; import PropTypes from 'prop-types'; -import StatusContainer from 'soapbox/containers/status_container'; export default class MaterialStatus extends React.Component { static propTypes = { + children: PropTypes.node, hidden: PropTypes.bool, } render() { // Performance: when hidden, don't render the wrapper divs if (this.props.hidden) { - return ; + return this.props.children; } return (
- + {this.props.children}
); diff --git a/app/soapbox/components/status.js b/app/soapbox/components/status.js index de7a330ca..c13a4d6a1 100644 --- a/app/soapbox/components/status.js +++ b/app/soapbox/components/status.js @@ -95,6 +95,7 @@ class Status extends ImmutablePureComponent { displayMedia: PropTypes.string, allowedEmoji: ImmutablePropTypes.list, focusable: PropTypes.bool, + component: PropTypes.func, }; static defaultProps = { @@ -316,7 +317,7 @@ class Status extends ImmutablePureComponent { const poll = null; let statusAvatar, prepend, rebloggedByText, reblogContent; - const { intl, hidden, featured, otherAccounts, unread, showThread, group } = this.props; + const { intl, hidden, featured, otherAccounts, unread, showThread, group, wrapperComponent: WrapperComponent } = this.props; // FIXME: why does this need to reassign status and account?? let { status, account, ...other } = this.props; // eslint-disable-line prefer-const @@ -494,72 +495,76 @@ class Status extends ImmutablePureComponent { const favicon = status.getIn(['account', 'pleroma', 'favicon']); const domain = getDomain(status.get('account')); + const wrappedStatus = ( +
+ {prepend} + +
+
+
+ + + + + {favicon && +
+ + + +
} + +
+
+ + + {statusAvatar} + + +
+ + + +
+
+ + {!group && status.get('group') && ( +
+ Posted in {status.getIn(['group', 'title'])} +
+ )} + + + + {media} + {poll} + + {showThread && status.get('in_reply_to_id') && status.get('in_reply_to_account_id') === status.getIn(['account', 'id']) && ( + + )} + + +
+
+ ); + return ( -
- {prepend} - -
-
-
- - - - - {favicon && -
- - - -
} - -
-
- - - {statusAvatar} - - -
- - - -
-
- - {!group && status.get('group') && ( -
- Posted in {status.getIn(['group', 'title'])} -
- )} - - - - {media} - {poll} - - {showThread && status.get('in_reply_to_id') && status.get('in_reply_to_account_id') === status.getIn(['account', 'id']) && ( - - )} - - -
-
+ {WrapperComponent ? {wrappedStatus} : wrappedStatus} ); } diff --git a/app/soapbox/components/status_list.js b/app/soapbox/components/status_list.js index a186a8073..a48f63e74 100644 --- a/app/soapbox/components/status_list.js +++ b/app/soapbox/components/status_list.js @@ -3,6 +3,7 @@ import React from 'react'; import { FormattedMessage, defineMessages } from 'react-intl'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; +import StatusContainer from 'soapbox/containers/status_container'; import MaterialStatus from 'soapbox/components/material_status'; import PendingStatus from 'soapbox/features/ui/components/pending_status'; import ImmutablePureComponent from 'react-immutable-pure-component'; @@ -110,7 +111,7 @@ export default class StatusList extends ImmutablePureComponent { const { timelineId, withGroupAdmin, group } = this.props; return ( - ); } @@ -150,7 +153,7 @@ export default class StatusList extends ImmutablePureComponent { if (!featuredStatusIds) return null; return featuredStatusIds.map(statusId => ( - )); } diff --git a/app/soapbox/features/status/index.js b/app/soapbox/features/status/index.js index 79c5d32d1..9a3bcbb5c 100644 --- a/app/soapbox/features/status/index.js +++ b/app/soapbox/features/status/index.js @@ -1,4 +1,4 @@ -import { OrderedSet as ImmutableOrderedSet } from 'immutable'; +import { List as ImmutableList, OrderedSet as ImmutableOrderedSet } from 'immutable'; import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; @@ -410,10 +410,10 @@ class Status extends ImmutablePureComponent { if (id === status.get('id')) { this._selectChild(ancestorsIds.size - 1, true); } else { - let index = ancestorsIds.indexOf(id); + let index = ImmutableList(ancestorsIds).indexOf(id); if (index === -1) { - index = descendantsIds.indexOf(id); + index = ImmutableList(descendantsIds).indexOf(id); this._selectChild(ancestorsIds.size + index, true); } else { this._selectChild(index - 1, true); @@ -427,10 +427,10 @@ class Status extends ImmutablePureComponent { if (id === status.get('id')) { this._selectChild(ancestorsIds.size + 1, false); } else { - let index = ancestorsIds.indexOf(id); + let index = ImmutableList(ancestorsIds).indexOf(id); if (index === -1) { - index = descendantsIds.indexOf(id); + index = ImmutableList(descendantsIds).indexOf(id); this._selectChild(ancestorsIds.size + index + 2, false); } else { this._selectChild(index + 1, false);