From 327b0e67cde4d2f3180c23cb3281bce721ef3732 Mon Sep 17 00:00:00 2001
From: Ryan Freeman
Date: Fri, 4 Apr 2025 22:33:08 +0100
Subject: [PATCH] Reply button changes
---
components/ui/Comments.tsx | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
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}