Support fragments in plugins

This commit is contained in:
Chi Vinh Le
2017-04-25 18:24:25 +07:00
parent 027358913d
commit 54ea71bedf
8 changed files with 111 additions and 19 deletions
@@ -174,8 +174,14 @@ class Comment extends React.Component {
? <TagLabel><BestIndicator /></TagLabel>
: null }
<PubDate created_at={comment.created_at} />
<Slot fill="commentInfoBar" comment={comment} commentId={comment.id} inline/>
<Slot
fill="commentInfoBar"
data={this.props.data}
root={this.props.root}
comment={comment}
commentId={comment.id}
inline
/>
{ (currentUser && (comment.user.id !== currentUser.id))
? <span className={styles.topRightMenu}>
<TopRightMenu
@@ -217,7 +223,14 @@ class Comment extends React.Component {
removeBest={removeBestTag} />
</IfUserCanModifyBest>
</ActionButton>
<Slot fill="commentDetail" comment={comment} commentId={comment.id} inline/>
<Slot
fill="commentDetail"
data={this.props.data}
root={this.props.root}
comment={comment}
commentId={comment.id}
inline
/>
</div>
<div className="commentActionsRight comment__action-container">
<ActionButton>
@@ -257,6 +270,8 @@ class Comment extends React.Component {
return commentIsIgnored(reply)
? <IgnoredCommentTombstone key={reply.id} />
: <Comment
data={this.props.data}
root={this.props.root}
setActiveReplyBox={setActiveReplyBox}
disableReply={disableReply}
activeReplyBox={activeReplyBox}
@@ -35,7 +35,7 @@ export default class Embed extends React.Component {
render () {
const {activeTab, logout, viewAllComments, commentId} = this.props;
const {asset: {totalCommentCount}} = this.props.data;
const {asset: {totalCommentCount}} = this.props.root;
const {loggedIn, isAdmin, user} = this.props.auth;
const userBox = <UserBox user={user} logout={logout} changeTab={this.changeTab}/>;
@@ -60,7 +60,7 @@ export default class Embed extends React.Component {
}
<TabContent show={activeTab === 'stream'}>
{ loggedIn ? userBox : null }
<Stream data={this.props.data} />
<Stream data={this.props.data} root={this.props.root} />
</TabContent>
<TabContent show={activeTab === 'profile'}>
<ProfileContainer />
@@ -24,7 +24,7 @@ class Stream extends React.Component {
render () {
const {
data: {asset, asset: {comments}, comment, myIgnoredUsers},
root: {asset, asset: {comments}, comment, myIgnoredUsers},
postItem,
addNotification,
postFlag,
@@ -106,6 +106,8 @@ class Stream extends React.Component {
{
highlightedComment
? <Comment
data={this.props.data}
root={this.props.root}
setActiveReplyBox={this.setActiveReplyBox}
activeReplyBox={this.props.activeReplyBox}
addNotification={addNotification}
@@ -141,6 +143,8 @@ class Stream extends React.Component {
key={comment.id}
/>
: <Comment
data={this.props.data}
root={this.props.root}
disableReply={!open}
setActiveReplyBox={this.setActiveReplyBox}
activeReplyBox={this.props.activeReplyBox}