import { Link } from 'react-router-dom'
import { Pencil, Globe, Lock, GitBranch, FileText, Trash2 } from 'lucide-react'
import type { TreeListItem } from '@/types'
import { TagBadges } from '@/components/common/TagBadges'
import { AddToFolderMenu } from './AddToFolderMenu'
import { cn } from '@/lib/utils'
import { usePermissions } from '@/hooks/usePermissions'
interface TreeListViewProps {
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
}
export function TreeListView({
trees,
onStartSession,
onTagClick,
onDeleteTree,
onFolderCreated,
onForkTree,
}: TreeListViewProps) {
const { canEditTree } = usePermissions()
return (
{trees.map((tree) => (
{/* Left: Name and Description */}
{tree.name}
{tree.status === 'draft' && (
Draft
)}
{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
{onForkTree && (
)}
{canEditTree({ author_id: tree.author_id, account_id: tree.account_id }) && (
<>
>
)}
))}
)
}