/** * @file tasks/TaskForm.tsx * @description Client component orchestrating modular sub-components for task creation and editing. */ "use client"; import { AlertCircle } from "lucide-react"; import Link from "next/link"; import { DbTask } from "@/types/task"; import { useTaskForm } from "./useTaskForm"; import TaskHeader from "./task/TaskHeader"; import TaskBasicInfo from "./task/TaskBasicInfo"; import TaskOptions from "./task/TaskOptions"; import TaskAssignees from "./task/TaskAssignees"; import TaskDateTime from "./task/TaskDateTime"; /** * Properties for the TaskForm component. * * @interface TaskFormProps * @property {{ id: string; email: string }[]} users - The list of available users who can be assigned to the task. * @property {DbTask & { assignees?: { id: string }[] }} [initialData] - Optional initial task data for editing an existing task. * @property {string} [mode] - Optional mode indicator (e.g., create or edit). */ interface TaskFormProps { users: { id: string; email: string }[]; initialData?: DbTask & { assignees?: { id: string }[] }; mode?: string; serverError?: string | null; } /** * Renders a complete task form layout combining various sub-components for basic info, * options, assignees, and date/time selections, alongside error alerts and form submission controls. * * @param {TaskFormProps} props - The component props. * @returns {JSX.Element} The rendered task form component. */ export default function TaskForm({ users, initialData, mode }: TaskFormProps) { const { form, error, isEditMode, todayString, updateField, handleAssigneeToggle, handleSubmit, } = useTaskForm(initialData, mode); return (
); }