Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5029e0a

Browse files
committed
Directly reply to a comment notification
1 parent 302b001 commit 5029e0a

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/components/goals/UpdateComment.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
import { Avatar, Button, Menu } from '@/ui'
22
import React, { useRef, useState } from 'react'
3-
import { Markdown, A, LikeModal, useLikes, EditComment } from '@/components'
3+
import {
4+
Markdown,
5+
A,
6+
LikeModal,
7+
useLikes,
8+
EditComment,
9+
NewComment,
10+
} from '@/components'
411
import { DateTime } from 'luxon'
512
import { HomePageFeedUpdateType, UpdateCommentType } from 'src/pages'
613
import { useSession } from 'next-auth/client'
@@ -27,9 +34,11 @@ export type GoalUpdateType = {
2734
export default function UpdateComment({
2835
comment,
2936
children,
37+
canAddNewComment = false,
3038
}: {
3139
children: string
3240
comment: UpdateCommentType
41+
canAddNewComment?: boolean
3342
}) {
3443
const queryClient = useQueryClient()
3544
const [isOpen, setIsOpen] = useState(false)
@@ -244,6 +253,7 @@ export default function UpdateComment({
244253
</div>
245254
</div>
246255
)}
256+
{canAddNewComment && <NewComment updateId={comment.updateId} />}
247257
</li>
248258
</>
249259
)

src/pages/comment/[id].tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ const client = new faunadb.Client({
1616
})
1717

1818
export default function Update({ comment }: { comment: UpdateCommentType }) {
19-
return <UpdateComment comment={comment}>{comment.description}</UpdateComment>
19+
return (
20+
<UpdateComment comment={comment} canAddNewComment={true}>
21+
{comment.description}
22+
</UpdateComment>
23+
)
2024
}
2125

2226
export const getServerSideProps = async ({ req, query }) => {

0 commit comments

Comments
 (0)