"use client"; import { useEffect, useRef } from "react"; import { Trash2, X } from "lucide-react"; import { useTrashPanel } from "./TrashPanelProvider"; import { TrashGrid } from "./TrashGrid"; import { EmptyTrashButton } from "./EmptyTrashButton"; import { useClickOutside } from "@/lib/hooks/useClickOutside"; import type { TrashCardImage } from "./TrashCard"; interface PanelData { images: TrashCardImage[]; retentionDays: number; } export function TrashPanel({ data }: { data: PanelData }) { const { open, close } = useTrashPanel(); const ref = useRef(null); useClickOutside(ref, close, open); useEffect(() => { if (!open) return; const onKey = (e: KeyboardEvent) => { if (e.key === "Escape") close(); }; window.addEventListener("keydown", onKey); document.body.style.overflow = "hidden"; return () => { window.removeEventListener("keydown", onKey); document.body.style.overflow = ""; }; }, [open, close]); if (!open) return null; const { images, retentionDays } = data; return (

Recycle Bin

{images.length} image{images.length === 1 ? "" : "s"} {retentionDays > 0 && images.length > 0 && ( ยท auto-purged after {retentionDays} day{retentionDays === 1 ? "" : "s"} )}

{images.length === 0 ? (

Trash Is Empty

Deleted images appear here for {retentionDays > 0 ? `${retentionDays} day${retentionDays === 1 ? "" : "s"}` : "as long as you keep them"} before they’re gone for good.

) : ( )}
); }