diff --git a/packages/components/src/ButtonShowReplies/ButtonShowReplies.tsx b/packages/components/src/ButtonShowReplies/ButtonShowReplies.tsx index b6708cc1c2..ca8b0f14ea 100644 --- a/packages/components/src/ButtonShowReplies/ButtonShowReplies.tsx +++ b/packages/components/src/ButtonShowReplies/ButtonShowReplies.tsx @@ -1,4 +1,5 @@ import { Button } from '../Button/Button' +import { nonDeletedCommentsCount } from '../DiscussionTitle/DiscussionTitle' import type { IComment } from '../CommentItem/types' @@ -12,12 +13,10 @@ export interface Props { export const ButtonShowReplies = (props: Props) => { const { creatorName, isShowReplies, replies, setIsShowReplies } = props - const length = replies && replies.length ? replies.length : 0 + const count = nonDeletedCommentsCount(replies) const icon = isShowReplies ? 'arrow-full-up' : 'arrow-full-down' - const text = length - ? `${length} ${length === 1 ? 'reply' : 'replies'}` - : `Reply` + const text = count ? `${count} ${count === 1 ? 'reply' : 'replies'}` : `Reply` return (