import CommentContent from './comment-content'; import React from 'react'; import { Avatar, Button, LoadingIndicator } from '@tryghost/shade/components'; import { type Comment, useHideComment, useShowComment, useUnpinComment, } from '@tryghost/admin-x-framework/api/comments'; import { CommentHeader } from './comment-header'; import { CommentMenu } from './comment-menu'; import { CommentMetrics } from './comment-metrics'; import { buildThreadLink } from './thread-link'; import { memberAvatarProps } from '@/members/api'; import { Link, useSearchParams } from '@tryghost/admin-x-framework'; import { LucideIcon, cn } from '@tryghost/shade/utils'; function RepliesLine({ hasReplies }: { hasReplies: boolean }) { if (!hasReplies) { return null; } return (
); } interface CommentRowProps { comment: Comment; dislikesEnabled: boolean; isReply?: boolean; isSelectedComment?: boolean; selectedCommentId?: string; } function CommentRow({ comment, dislikesEnabled, isReply = false, isSelectedComment = false, selectedCommentId, }: CommentRowProps) { const [searchParams] = useSearchParams(); const { mutate: hideComment } = useHideComment(); const { mutate: showComment } = useShowComment(); const { mutate: unpinComment } = useUnpinComment(); // Check replies array for loaded objects, or count.direct_replies for unloaded // TODO: remove count.replies fallback once backend is fully rolled out const hasReplies = (comment.replies?.length ?? 0) > 0 || (comment.count?.direct_replies ?? comment.count?.replies ?? 0) > 0; const containerClassName = !hasReplies || isReply ? 'mb-7' : 'mb-0'; return (