import { Link } from 'react-router-dom' import { Pencil, Globe, Lock, Trash2, GitBranch, FileText, Download, ClipboardList } from 'lucide-react' import type { TreeListItem } from '@/types' import { TagBadges } from '@/components/common/TagBadges' import { StaggerList } from '@/components/common/StaggerList' import { cn } from '@/lib/utils' import { usePermissions } from '@/hooks/usePermissions' import { getTreeEditorPath } from '@/lib/routing' interface TreeGridViewProps { 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 TreeGridView({ trees, onStartSession, onPrepareSession, onTagClick, onDeleteTree, onForkTree, onExportTree, }: TreeGridViewProps) { const { canEditTree, canDeleteTree } = usePermissions() return ( {trees.map((tree) => (

{tree.name}

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

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

{/* Tags */} {tree.tags && tree.tags.length > 0 && (
)}
v{tree.version} ยท {tree.usage_count} uses
{onExportTree && ( )} {onForkTree && ( )} {canEditTree({ author_id: tree.author_id, account_id: tree.account_id }) && ( )} {canDeleteTree() && ( )} {onPrepareSession && tree.tree_type !== 'troubleshooting' && ( )}
))}
) }