import React, { type JSX, useState } from 'react'; import type { IUser } from '@growi/core'; import { useAtomValue } from 'jotai'; import { Collapse } from 'reactstrap'; import type { ICommentHasId, ICommentHasIdList } from '~/interfaces/comment'; import type { RendererOptions } from '~/interfaces/renderer-options'; import { isAllReplyShownAtom } from '~/states/server-configurations'; import { Comment } from './Comment'; import styles from './ReplyComments.module.scss'; type ReplycommentsProps = { rendererOptions: RendererOptions; isReadOnly: boolean; revisionId: string; revisionCreatedAt: Date; currentUser: IUser; replyList: ICommentHasIdList; pageId: string; pagePath: string; deleteBtnClicked: (comment: ICommentHasId) => void; onComment: () => void; }; export const ReplyComments = (props: ReplycommentsProps): JSX.Element => { const { rendererOptions, isReadOnly, revisionId, revisionCreatedAt, currentUser, replyList, pageId, pagePath, deleteBtnClicked, onComment, } = props; const isAllReplyShown = useAtomValue(isAllReplyShownAtom); const [isOlderRepliesShown, setIsOlderRepliesShown] = useState(false); const renderReply = (reply: ICommentHasId) => { return (