"use client"; import * as React from "react"; import { cn } from "./lib/utils"; export interface CommentNode { id: string; author: string; initials: string; body: string; time?: string; children?: CommentNode[]; } export interface CommentThreadProps { comments: CommentNode[]; maxDepth?: number; } const CommentThread: React.FC = ({ comments, maxDepth = 3, }) => { const renderComment = ( node: CommentNode, depth: number ): React.ReactNode => { if (depth > maxDepth) return null; const isLast = depth === 0; // simplified return (
0 && "ps-4 border-l-2 border-border/40" )} >
{node.initials}
{node.author} {node.time || ""}

{node.body}

{node.children && node.children.length > 0 && depth < maxDepth && (
{node.children.map((child) => renderComment(child, depth + 1))}
)}
); }; return (
{comments.map((comment) => renderComment(comment, 0))}
); }; export { CommentThread };