2023-10-20 12:25:20 +00:00
|
|
|
import { FC } from "react";
|
|
|
|
// components
|
|
|
|
import { IssueActivityCard } from "./card";
|
|
|
|
import { IssueCommentEditor } from "./comment-editor";
|
|
|
|
|
|
|
|
interface IIssueComment {
|
|
|
|
workspaceSlug: string;
|
|
|
|
projectId: string;
|
2023-10-25 13:54:14 +00:00
|
|
|
issueId: string;
|
2023-10-20 12:25:20 +00:00
|
|
|
user: any;
|
|
|
|
issueComments: any;
|
|
|
|
issueCommentCreate: (comment: any) => void;
|
|
|
|
issueCommentUpdate: (comment: any) => void;
|
|
|
|
issueCommentRemove: (commentId: string) => void;
|
|
|
|
issueCommentReactionCreate: (commentId: string, reaction: string) => void;
|
|
|
|
issueCommentReactionRemove: (commentId: string, reaction: string) => void;
|
|
|
|
}
|
|
|
|
|
|
|
|
export const IssueComment: FC<IIssueComment> = (props) => {
|
|
|
|
const {
|
|
|
|
workspaceSlug,
|
|
|
|
projectId,
|
2023-10-25 13:54:14 +00:00
|
|
|
issueId,
|
2023-10-20 12:25:20 +00:00
|
|
|
user,
|
|
|
|
issueComments,
|
|
|
|
issueCommentCreate,
|
|
|
|
issueCommentUpdate,
|
|
|
|
issueCommentRemove,
|
|
|
|
issueCommentReactionCreate,
|
|
|
|
issueCommentReactionRemove,
|
|
|
|
} = props;
|
|
|
|
|
|
|
|
const handleAddComment = async (formData: any) => {
|
|
|
|
if (!formData.comment_html) return;
|
|
|
|
await issueCommentCreate(formData);
|
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="space-y-4">
|
|
|
|
<div className="font-medium text-xl">Activity</div>
|
|
|
|
|
|
|
|
<div className="space-y-2">
|
|
|
|
<IssueCommentEditor
|
|
|
|
onSubmit={handleAddComment}
|
|
|
|
// showAccessSpecifier={projectDetails && projectDetails.is_deployed}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<IssueActivityCard
|
|
|
|
workspaceSlug={workspaceSlug}
|
|
|
|
projectId={projectId}
|
2023-10-25 13:54:14 +00:00
|
|
|
issueId={issueId}
|
2023-10-20 12:25:20 +00:00
|
|
|
user={user}
|
|
|
|
issueComments={issueComments}
|
|
|
|
issueCommentUpdate={issueCommentUpdate}
|
|
|
|
issueCommentRemove={issueCommentRemove}
|
|
|
|
issueCommentReactionCreate={issueCommentReactionCreate}
|
|
|
|
issueCommentReactionRemove={issueCommentReactionRemove}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|