1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2026-06-05 20:15:31 -04:00
Files
jarv.is/components/comments/comment-thread.tsx
T
jake 5a1636baa3 refactor: migrate from Biome to oxlint/oxfmt, remove contact form
- Replace Biome with oxlint + oxfmt (OXC toolchain) for linting and formatting
- Add .oxlintrc.json and .oxfmtrc.json configuration files
- Update VS Code settings and devcontainer to use oxc-vscode extension
- Remove contact form, Resend email integration, and related server action/schema
- Remove unused UI components (accordion, alert, card, tabs, toggle, etc.)
2026-04-05 19:45:18 -04:00

40 lines
961 B
TypeScript

import type { CommentWithUser } from "@/lib/server/comments";
import { cn } from "@/lib/utils";
import { CommentSingle } from "./comment-single";
/** Maximum nesting depth for comment threads (0-indexed, so 2 = 3 levels deep) */
const MAX_NESTING_LEVEL = 2;
const CommentThread = ({
comment,
replies,
allComments,
level = 0,
}: {
comment: CommentWithUser;
replies: CommentWithUser[];
allComments: Record<string, CommentWithUser[]>;
level?: number;
}) => (
<>
<CommentSingle comment={comment} />
{replies.length > 0 && (
<div className={cn("mt-6 space-y-6", level < MAX_NESTING_LEVEL && "ml-6 border-l-2 pl-6")}>
{replies.map((reply) => (
<CommentThread
key={reply.id}
comment={reply}
replies={allComments[reply.id] || []}
allComments={allComments}
level={level + 1}
/>
))}
</div>
)}
</>
);
export { CommentThread };