2024-04-15 07:19:14 +00:00
|
|
|
import { FC, RefObject } from "react";
|
|
|
|
import { observer } from "mobx-react";
|
|
|
|
import { EditorRefApi } from "@plane/rich-text-editor";
|
|
|
|
import { TIssue } from "@plane/types";
|
|
|
|
import { Loader } from "@plane/ui";
|
|
|
|
// components
|
|
|
|
import { RichTextEditor } from "@/components/editor/rich-text-editor/rich-text-editor";
|
2024-04-30 11:51:52 +00:00
|
|
|
// helpers
|
|
|
|
import { getDescriptionPlaceholder } from "@/helpers/issue.helper";
|
2024-04-15 07:19:14 +00:00
|
|
|
// hooks
|
|
|
|
import { useProjectInbox } from "@/hooks/store";
|
|
|
|
|
|
|
|
type TInboxIssueDescription = {
|
2024-05-01 12:31:30 +00:00
|
|
|
containerClassName?: string;
|
2024-04-15 07:19:14 +00:00
|
|
|
workspaceSlug: string;
|
|
|
|
projectId: string;
|
|
|
|
workspaceId: string;
|
|
|
|
data: Partial<TIssue>;
|
|
|
|
handleData: (issueKey: keyof Partial<TIssue>, issueValue: Partial<TIssue>[keyof Partial<TIssue>]) => void;
|
|
|
|
editorRef: RefObject<EditorRefApi>;
|
|
|
|
};
|
|
|
|
|
|
|
|
// TODO: have to implement GPT Assistance
|
|
|
|
export const InboxIssueDescription: FC<TInboxIssueDescription> = observer((props) => {
|
2024-05-03 13:50:13 +00:00
|
|
|
const { containerClassName, workspaceSlug, projectId, workspaceId, data, handleData, editorRef } = props;
|
2024-04-15 07:19:14 +00:00
|
|
|
// hooks
|
|
|
|
const { loader } = useProjectInbox();
|
|
|
|
|
|
|
|
if (loader === "issue-loading")
|
|
|
|
return (
|
|
|
|
<Loader className="min-h-[6rem] rounded-md border border-custom-border-200">
|
|
|
|
<Loader.Item width="100%" height="140px" />
|
|
|
|
</Loader>
|
|
|
|
);
|
2024-05-07 07:14:36 +00:00
|
|
|
|
2024-04-15 07:19:14 +00:00
|
|
|
return (
|
2024-05-07 07:14:36 +00:00
|
|
|
<RichTextEditor
|
|
|
|
initialValue={!data?.description_html || data?.description_html === "" ? "<p></p>" : data?.description_html}
|
|
|
|
ref={editorRef}
|
|
|
|
workspaceSlug={workspaceSlug}
|
|
|
|
workspaceId={workspaceId}
|
|
|
|
projectId={projectId}
|
|
|
|
dragDropEnabled={false}
|
|
|
|
onChange={(_description: object, description_html: string) => handleData("description_html", description_html)}
|
|
|
|
placeholder={getDescriptionPlaceholder}
|
|
|
|
containerClassName={containerClassName}
|
|
|
|
/>
|
2024-04-15 07:19:14 +00:00
|
|
|
);
|
|
|
|
});
|