import { Controller, useForm } from "react-hook-form"; // ui import { Button, Input, Tooltip } from "@plane/ui"; // types // constants import { PAGE_ACCESS_SPECIFIERS } from "constants/page"; import { IPageStore } from "store/page.store"; import { IPage } from "@plane/types"; type Props = { handleFormSubmit: (values: IPage) => Promise; handleClose: () => void; pageStore?: IPageStore; }; const defaultValues = { name: "", description: "", access: 0, }; export const PageForm: React.FC = (props) => { const { handleFormSubmit, handleClose, pageStore } = props; const { formState: { errors, isSubmitting }, handleSubmit, control, } = useForm({ defaultValues: pageStore ? { name: pageStore.name, description: pageStore.description, access: pageStore.access } : defaultValues, }); const handleCreateUpdatePage = (formData: IPage) => handleFormSubmit(formData); return (

{pageStore ? "Update" : "Create"} Page

( )} />
(
{PAGE_ACCESS_SPECIFIERS.map((access, index) => ( ))}
{PAGE_ACCESS_SPECIFIERS.find((access) => access.key === value)?.label}
)} />
); };