"use client";
import { useState } from "react";
import { ChevronRight, ChevronDown, Circle, CheckCircle2, Clock } from "lucide-react";
import { cn } from "@/lib/utils";
export interface TreeNode {
id: string;
label: string;
status?: "built" | "in_progress" | "missing";
children?: TreeNode[];
metadata?: {
sessionsCount?: number;
commitsCount?: number;
cost?: number;
};
}
interface TreeViewProps {
data: TreeNode[];
selectedId?: string | null;
onSelect?: (node: TreeNode) => void;
className?: string;
}
interface TreeNodeItemProps {
node: TreeNode;
level: number;
selectedId?: string | null;
onSelect?: (node: TreeNode) => void;
}
function TreeNodeItem({ node, level, selectedId, onSelect }: TreeNodeItemProps) {
const [isExpanded, setIsExpanded] = useState(level === 0); // Auto-expand top level
const hasChildren = node.children && node.children.length > 0;
const isSelected = selectedId === node.id;
const getStatusIcon = () => {
if (!node.status) return null;
switch (node.status) {
case "built":
return