diff --git a/client/coral-embed-stream/src/Comment.js b/client/coral-embed-stream/src/Comment.js index 1310358fe..e90bcd5cb 100644 --- a/client/coral-embed-stream/src/Comment.js +++ b/client/coral-embed-stream/src/Comment.js @@ -60,6 +60,15 @@ class Comment extends React.Component { }).isRequired } + onReplyBoxClick = () => { + if (this.props.currentUser) { + this.setState({replyBoxVisible: !this.state.replyBoxVisible}); + } else { + const offset = document.getElementById(`c_${this.props.comment.id}`).getBoundingClientRect().top - 75; + this.props.showSignInDialog(offset); + } + } + render () { const { comment, @@ -95,16 +104,11 @@ class Comment extends React.Component { currentUser={currentUser}/> - - { - currentUser - ?
+
{ - this.setState({replyBoxVisible: !this.state.replyBoxVisible}); - }} + onClick={this.onReplyBoxClick} parentCommentId={parentId || comment.id} - currentUserId={currentUser.id} + currentUserId={currentUser && currentUser.id} banned={false} />
- : null - }
- { - currentUser - ? - : null - } -
{