/** * Copyright (c) 2023-present Plane Software, Inc. and contributors * SPDX-License-Identifier: AGPL-3.0-only * See the LICENSE file for details. */ import { useParams } from "next/navigation"; // react-hook-form import { Controller, useForm } from "react-hook-form"; import { Field } from "@makeplane/propel/components/field"; import { Input, InputGroup } from "@makeplane/propel/components/input"; import { Button } from "@plane/propel/button"; import type { IProject } from "@plane/types"; // ui import { EModalPosition, EModalWidth, ModalCore } from "@plane/ui"; // types type Props = { isOpen: boolean; type: "auto-close" | "auto-archive"; initialValues: Partial; handleClose: () => void; handleChange: (formData: Partial) => Promise; }; export function SelectMonthModal({ type, initialValues, isOpen, handleClose, handleChange }: Props) { const { workspaceSlug, projectId } = useParams(); const { formState: { errors, isSubmitting }, handleSubmit, control, reset, } = useForm({ defaultValues: initialValues, }); const onClose = () => { handleClose(); reset(initialValues); }; const onSubmit = (formData: Partial) => { if (!workspaceSlug && !projectId) return; handleChange(formData); onClose(); }; return (

Customize time range

{type === "auto-close" ? ( <> (
Months
)} /> {errors.close_in && ( Select a month between 1 and 12. )} ) : ( <> (
Months
)} /> {errors.archive_in && ( Select a month between 1 and 12. )} )}
); }