2023-10-18 14:28:05 +00:00
|
|
|
import { FC } from "react";
|
|
|
|
// packages
|
|
|
|
import { RichTextEditor } from "@plane/rich-text-editor";
|
2023-10-20 07:03:39 +00:00
|
|
|
// components
|
|
|
|
import { IssueReaction } from "./reactions";
|
2023-10-18 14:28:05 +00:00
|
|
|
// hooks
|
|
|
|
import { useDebouncedCallback } from "use-debounce";
|
|
|
|
// types
|
|
|
|
import { IIssue } from "types";
|
|
|
|
// services
|
|
|
|
import { FileService } from "services/file.service";
|
|
|
|
|
|
|
|
const fileService = new FileService();
|
|
|
|
|
|
|
|
interface IPeekOverviewIssueDetails {
|
|
|
|
workspaceSlug: string;
|
|
|
|
issue: IIssue;
|
2023-10-20 07:03:39 +00:00
|
|
|
issueReactions: any;
|
|
|
|
user: any;
|
2023-10-18 14:28:05 +00:00
|
|
|
issueUpdate: (issue: Partial<IIssue>) => void;
|
2023-10-20 07:03:39 +00:00
|
|
|
issueReactionCreate: (reaction: string) => void;
|
|
|
|
issueReactionRemove: (reaction: string) => void;
|
2023-10-18 14:28:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export const PeekOverviewIssueDetails: FC<IPeekOverviewIssueDetails> = (props) => {
|
2023-10-20 07:03:39 +00:00
|
|
|
const { workspaceSlug, issue, issueReactions, user, issueUpdate, issueReactionCreate, issueReactionRemove } = props;
|
2023-10-18 14:28:05 +00:00
|
|
|
|
|
|
|
const debouncedIssueDescription = useDebouncedCallback(async (_data: any) => {
|
|
|
|
issueUpdate({ ...issue, description_html: _data });
|
|
|
|
}, 1500);
|
|
|
|
|
|
|
|
return (
|
2023-10-20 07:03:39 +00:00
|
|
|
<div className="space-y-3">
|
2023-10-18 14:28:05 +00:00
|
|
|
<div className="font-medium text-sm text-custom-text-200">
|
|
|
|
{issue?.project_detail?.identifier}-{issue?.sequence_id}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div className="font-medium text-xl">{issue?.name}</div>
|
|
|
|
|
2023-10-20 07:03:39 +00:00
|
|
|
<div className="space-y-2">
|
|
|
|
<RichTextEditor
|
|
|
|
uploadFile={fileService.getUploadFileFunction(workspaceSlug)}
|
|
|
|
deleteFile={fileService.deleteImage}
|
|
|
|
value={issue?.description_html}
|
|
|
|
debouncedUpdatesEnabled={false}
|
|
|
|
onChange={(description: Object, description_html: string) => {
|
|
|
|
debouncedIssueDescription(description_html);
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<IssueReaction
|
|
|
|
issueReactions={issueReactions}
|
|
|
|
user={user}
|
|
|
|
issueReactionCreate={issueReactionCreate}
|
|
|
|
issueReactionRemove={issueReactionRemove}
|
|
|
|
/>
|
|
|
|
</div>
|
2023-10-18 14:28:05 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|