/** * @file trash/TrashList.tsx * @description Client component rendering the list of deleted tasks with rich metadata, priority badges, and restore/delete actions. */ "use client"; import { Task, PRIORITY_CONFIG } from "@/types/task"; import { Calendar } from "lucide-react"; import TaskActionButton from "./components/TaskActionButton"; import HighlightText from "@/app/components/ui/HighlightText"; import { useSearchParams } from "next/navigation"; /** * Renders a list of deleted tasks stored in the trash with search term highlighting, * featuring priority badges, deletion dates, and action controls for permanent deletion or restoration. * * @param {Object} props - The component props. * @param {Task[]} props.tasks - The array of deleted tasks to render. * @returns {JSX.Element} The rendered trash list component or an empty state placeholder. */ export default function TrashList({ tasks }: { tasks: Task[] }) { const searchParams = useSearchParams(); const searchQuery = searchParams.get("search") || ""; return (
{tasks.length === 0 ? (

No deleted tasks found.

Your trash is completely empty.

) : ( tasks.map((task) => { const priorityConfig = PRIORITY_CONFIG[task.priority as keyof typeof PRIORITY_CONFIG] || PRIORITY_CONFIG.medium; const deletedDate = task.deletedAt ? new Date(task.deletedAt).toLocaleDateString("de-DE", { day: "2-digit", month: "2-digit", year: "numeric", }) : "Unknown"; return (
{/* --- Left Side --- */}

{priorityConfig.label}
{task.description && (

)}
Deleted {deletedDate}
{/* --- Right Side --- */}
); }) )}
); }