import React, { useRef, useState } from "react"; import { useRouter } from "next/router"; import { observer } from "mobx-react-lite"; import { Dialog, Transition } from "@headlessui/react"; import { Controller, useForm } from "react-hook-form"; import { RichTextEditorWithRef } from "@plane/rich-text-editor"; // mobx store import { useMobxStore } from "lib/mobx/store-provider"; // services import { FileService } from "services/file.service"; // components import { IssuePrioritySelect } from "components/issues/select"; // ui import { Button, Input, ToggleSwitch } from "@plane/ui"; // types import { IIssue } from "types"; import useEditorSuggestions from "hooks/use-editor-suggestions"; type Props = { isOpen: boolean; onClose: () => void; }; const defaultValues: Partial = { project: "", name: "", description_html: "

", parent: null, priority: "none", }; // services const fileService = new FileService(); export const CreateInboxIssueModal: React.FC = observer((props) => { const { isOpen, onClose } = props; // states const [createMore, setCreateMore] = useState(false); const editorRef = useRef(null); const editorSuggestion = useEditorSuggestions(); const router = useRouter(); const { workspaceSlug, projectId, inboxId } = router.query; const { inboxIssueDetails: inboxIssueDetailsStore } = useMobxStore(); const { control, formState: { errors, isSubmitting }, handleSubmit, reset, } = useForm({ defaultValues }); const handleClose = () => { onClose(); reset(defaultValues); }; const handleFormSubmit = async (formData: Partial) => { if (!workspaceSlug || !projectId || !inboxId) return; await inboxIssueDetailsStore .createIssue(workspaceSlug.toString(), projectId.toString(), inboxId.toString(), formData) .then((res) => { if (!createMore) { router.push(`/${workspaceSlug}/projects/${projectId}/inbox/${inboxId}?inboxIssueId=${res.issue_inbox[0].id}`); handleClose(); } else reset(defaultValues); }); }; return (

Create Inbox Issue

( )} />
(

" : value} customClassName="min-h-[150px]" onChange={(description, description_html: string) => { onChange(description_html); }} mentionSuggestions={editorSuggestion.mentionSuggestions} mentionHighlights={editorSuggestion.mentionHighlights} /> )} />
( )} />
setCreateMore((prevData) => !prevData)} > Create more {}} size="md" />
); });