'use client' import { useCallback } from 'react' import { motion, AnimatePresence } from 'framer-motion' import { Plus, Trash2, GripVertical } from 'lucide-react' import type { InstallMdTodoItem } from '@/types' import { createEmptyTodoItem } from '@/lib/install-md-generator' interface TodoEditorProps { items: InstallMdTodoItem[] onChange: (items: InstallMdTodoItem[]) => void } export default function TodoEditor({ items, onChange }: TodoEditorProps) { const handleAddItem = useCallback(() => { onChange([...items, createEmptyTodoItem()]) }, [items, onChange]) const handleRemoveItem = useCallback((id: string) => { if (items.length <= 1) return onChange(items.filter(item => item.id !== id)) }, [items, onChange]) const handleUpdateItem = useCallback((id: string, text: string) => { onChange(items.map(item => item.id === id ? { ...item, text } : item )) }, [items, onChange]) const handleToggleCompleted = useCallback((id: string) => { onChange(items.map(item => item.id === id ? { ...item, completed: !item.completed } : item )) }, [items, onChange]) const handleMoveItem = useCallback((fromIndex: number, toIndex: number) => { if (toIndex < 0 || toIndex >= items.length) return const newItems = [...items] const [removed] = newItems.splice(fromIndex, 1) newItems.splice(toIndex, 0, removed) onChange(newItems) }, [items, onChange]) return (
{items.map((item, index) => ( {/* Drag Handle */}
{/* Checkbox */} {/* Text Input */} handleUpdateItem(item.id, e.target.value)} placeholder="Enter TODO item..." className="flex-1 px-3 py-2 bg-white/5 border border-neutral-700 rounded-lg focus:outline-none focus:border-white text-white placeholder-neutral-500" /> {/* Remove Button */}
))}
{/* Add Item Button */} {/* Help Text */}

Tip: These appear as checkboxes in the install.md. The LLM will work through them sequentially.

) }