"use client"; import { useEffect, useState, useCallback } from "react"; import { Group, Task } from "@/lib/api"; import { useTranslation } from "@/lib/i18n"; import TaskForm from "@/components/TaskForm"; interface TaskModalProps { groups: Group[]; onSubmit: (data: Partial) => Promise; onClose: () => void; } export default function TaskModal({ groups, onSubmit, onClose }: TaskModalProps) { const [visible, setVisible] = useState(false); const { t } = useTranslation(); const handleClose = useCallback(() => { setVisible(false); setTimeout(onClose, 200); }, [onClose]); useEffect(() => { // Trigger enter animation on next frame requestAnimationFrame(() => setVisible(true)); }, []); useEffect(() => { function handleKeyDown(e: KeyboardEvent) { if (e.key === "Escape") handleClose(); } document.addEventListener("keydown", handleKeyDown); // Prevent body scroll document.body.style.overflow = "hidden"; return () => { document.removeEventListener("keydown", handleKeyDown); document.body.style.overflow = ""; }; }, [handleClose]); return (
{/* Backdrop */}
{/* Modal panel with slide-up animation */}
{/* Drag handle for mobile */}

{t("tasks.newTask")}

); }