import type { TreeStructure } from '@/types' import { cn } from '@/lib/utils' interface SharedSessionTreePreviewProps { treeStructure: TreeStructure pathTaken: string[] } const nodeTypeColors: Record = { root: 'bg-[#e2e5eb]', decision: 'bg-blue-400', action: 'bg-yellow-400', solution: 'bg-emerald-400', information: 'bg-[#848b9b]', } function getNodeTitle(node: Record): string { return ( (node.question as string) || (node.title as string) || (node.node_type as string) || 'Untitled' ) } function TreeNode({ node, depth, pathTaken, }: { node: Record depth: number pathTaken: string[] }) { const nodeId = (node.id as string) || '' const nodeType = (node.node_type as string) || 'decision' const isInPath = pathTaken.includes(nodeId) const children = (node.children as Record[]) || [] const colorClass = nodeTypeColors[nodeType] || 'bg-[#848b9b]' return ( <>
{getNodeTitle(node)}
{children.map((child, index) => ( ))} ) } export function SharedSessionTreePreview({ treeStructure, pathTaken, }: SharedSessionTreePreviewProps) { if (!treeStructure) { return null } return (

Tree Structure

} depth={0} pathTaken={pathTaken} />
) } export default SharedSessionTreePreview