/** * Copyright (c) 2023-present Plane Software, Inc. and contributors * SPDX-License-Identifier: AGPL-3.0-only * See the LICENSE file for details. */ import { useState } from "react"; import { observer } from "mobx-react"; import { useTranslation } from "@plane/i18n"; import { Button } from "@plane/propel/button"; import { TOAST_TYPE, setToast } from "@plane/propel/toast"; import { TextArea } from "@plane/ui"; import { useProjectExternalContours } from "@/hooks/store/use-project-external-contours"; type Props = { workspaceSlug: string; sourceProjectId: string; requestId: string; }; export const ExternalContoursSourceReplyBox = observer(function ExternalContoursSourceReplyBox(props: Props) { const { workspaceSlug, sourceProjectId, requestId } = props; const { t } = useTranslation(); const { loader, replyToRequest } = useProjectExternalContours(); const [comment, setComment] = useState(""); const isSubmitting = loader === "mutation-loading"; const handleSubmit = async () => { if (!comment.trim() || isSubmitting) return; try { await replyToRequest(workspaceSlug, sourceProjectId, requestId, comment.trim()); setComment(""); setToast({ type: TOAST_TYPE.SUCCESS, title: t("success"), message: t("external_contours_page.reply.success"), }); } catch (error: any) { setToast({ type: TOAST_TYPE.ERROR, title: t("error"), message: error?.error || t("external_contours_page.reply.error"), }); } }; return (
{t("external_contours_page.reply.title")}