"use client"; import { CornerDownRight, GitBranch } from "lucide-react"; import { Badge } from "@/shared/components/ui/badge"; import type { RegistryEntry } from "../types"; import { cn } from "@/shared/lib/utils"; interface ThreadViewProps { /** The current entry being viewed */ entry: RegistryEntry; /** All entries in the registry (to resolve references) */ allEntries: RegistryEntry[]; /** Click on an entry to navigate to it */ onNavigate?: (entry: RegistryEntry) => void; } /** * Shows thread relationships for a registry entry: * - Parent entry (this is a reply to...) * - Child entries (replies to this entry) * Displays as an indented tree with direction badges. */ export function ThreadView({ entry, allEntries, onNavigate }: ThreadViewProps) { // Find the parent entry (if this is a reply) const parent = entry.threadParentId ? allEntries.find((e) => e.id === entry.threadParentId) : null; // Find child entries (replies to this entry) const children = allEntries.filter((e) => e.threadParentId === entry.id); // Find siblings (other replies to the same parent, excluding this one) const siblings = entry.threadParentId ? allEntries.filter( (e) => e.threadParentId === entry.threadParentId && e.id !== entry.id, ) : []; if (!parent && children.length === 0) return null; return (
Răspuns la:
Alte ramuri ({siblings.length}):
{siblings.map((s) => (Răspunsuri ({children.length}):
{children.map((child) => (