import { Link } from 'react-router-dom' import { Pencil, Globe, Lock, Trash2, GitBranch, FileText, Wrench, Star } 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 TreeGridViewProps { trees: TreeListItem[] onStartSession: (treeId: string, treeType?: string) => void onTagClick: (tag: string) => void onFolderCreated: (parentId?: string | null) => void onDeleteTree: (tree: TreeListItem) => void onForkTree?: (treeId: string) => void pinnedTreeIds?: Set onTogglePin?: (treeId: string) => void pinLoadingTreeIds?: Set } export function TreeGridView({ trees, onStartSession, onTagClick, onDeleteTree, onForkTree, pinnedTreeIds, onTogglePin, pinLoadingTreeIds, }: TreeGridViewProps) { const { canEditTree, canDeleteTree } = usePermissions() return (
{trees.map((tree) => (

{tree.name}

{tree.status === 'draft' && ( Draft )} {tree.tree_type === 'maintenance' && ( Maintenance )} {'fork_info' in tree && Boolean((tree as Record).fork_info) && ( Fork )}
{onTogglePin && ( )} {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
{onForkTree && ( )} {canEditTree({ author_id: tree.author_id, account_id: tree.account_id }) && ( )} {canDeleteTree() && ( )}
))}
) }