"use client"; import type { DragEndEvent, DragStartEvent } from "@dnd-kit/core"; import { closestCenter, DndContext, DragOverlay, KeyboardSensor, PointerSensor, useSensor, useSensors, } from "@dnd-kit/core"; import { arrayMove, SortableContext, sortableKeyboardCoordinates, useSortable, verticalListSortingStrategy, } from "@dnd-kit/sortable"; import { CSS } from "@dnd-kit/utilities"; import { GripVertical } from "lucide-react"; import { useState } from "react"; import { Button } from "@/components/ui/button"; import { Checkbox } from "@/components/ui/checkbox"; import { Item, ItemContent, ItemGroup, ItemMedia, ItemTitle, } from "@/components/ui/item"; import { cn } from "@/lib/utils"; interface Todo { id: string; title: string; completed: boolean; } interface Todo2Props { heading?: string; description?: string; initialTodos?: Todo[]; className?: string; } const defaultTodos: Todo[] = [ { id: "1", title: "تکمیل مستندات فنی پروژه", completed: false, }, { id: "2", title: "بررسی و تأیید طراحی رابط کاربری", completed: false, }, { id: "3", title: "آمادهسازی گزارش هفتگی", completed: false, }, { id: "4", title: "بازبینی کد منابع", completed: true, }, { id: "5", title: "هماهنگی با تیم طراحی", completed: false, }, ]; interface SortableTodoItemProps { todo: Todo; onToggle: (id: string) => void; } const SortableTodoItem = ({ todo, onToggle }: SortableTodoItemProps) => { const { attributes, listeners, setNodeRef, transform, transition, isDragging, } = useSortable({ id: todo.id }); const style = { transform: CSS.Translate.toString(transform), transition, opacity: isDragging ? 0.5 : 1, }; return (
{description}