import { Link } from 'react-router-dom' import { Pencil, Globe, Lock, GitBranch, FileText, Trash2, Download, ClipboardList } from 'lucide-react' import type { TreeListItem } from '@/types' import { TagBadges } from '@/components/common/TagBadges' import { cn } from '@/lib/utils' import { usePermissions } from '@/hooks/usePermissions' import { getTreeEditorPath } from '@/lib/routing' interface TreeListViewProps { trees: TreeListItem[] onStartSession: (treeId: string, treeType?: string) => void onPrepareSession?: (tree: TreeListItem) => void onTagClick: (tag: string) => void onFolderCreated: (parentId?: string | null) => void onDeleteTree: (tree: TreeListItem) => void onForkTree?: (treeId: string) => void onExportTree?: (treeId: string) => void } export function TreeListView({ trees, onStartSession, onPrepareSession, onTagClick, onDeleteTree, onForkTree, onExportTree, }: TreeListViewProps) { const { canEditTree } = usePermissions() return (
{trees.map((tree) => (
{/* Left: Name and Description */}

{tree.name}

{tree.status === 'draft' && ( Draft )} {'fork_info' in tree && Boolean((tree as Record).fork_info) && ( Fork )} {tree.is_public ? ( ) : ( )}

{tree.description || 'No description available'}

{/* Center: Category and Tags */}
{tree.category_info && ( {tree.category_info.name} )} {tree.tags && tree.tags.length > 0 && (
)}
{/* Right: Metadata and Actions */}
v{tree.version} {tree.usage_count} uses
{onExportTree && ( )} {onForkTree && ( )} {canEditTree({ author_id: tree.author_id, account_id: tree.account_id }) && ( <> )} {onPrepareSession && tree.tree_type !== 'troubleshooting' && ( )}
))}
) }