diff --git a/components/ui/Comments.tsx b/components/ui/Comments.tsx index 89de3a6..249889a 100644 --- a/components/ui/Comments.tsx +++ b/components/ui/Comments.tsx @@ -30,10 +30,14 @@ type ReplyButton = { Comments.ReplyButton = function ReplyButton({comment}: ReplyButton) { const replyContext = useContext(ReplyContext) const commentFormContext = useContext(CommentFormContext) + const {data: session} = useSession() - const handleReplyButton = (e: React.MouseEvent) => { + const handleReplyButton = async (e: React.MouseEvent) => { e.preventDefault() - replyContext?.setReplyTo(comment) + if (!session) { + await loginWithGitHub() + } + replyContext?.setReplyTo(comment); commentFormContext?.focusCommentForm() } @@ -71,9 +75,7 @@ Comments.Comment = function Comment({comment, children, isReply = false}: {

{comment.content}

- {session && - - } + {children}