2023-10-20 12:25:20 +00:00
|
|
|
import { FC } from "react";
|
|
|
|
// components
|
2023-12-07 12:43:27 +00:00
|
|
|
import { IssueActivityCard, IssueCommentEditor } from "components/issues";
|
|
|
|
// types
|
|
|
|
import { IIssueActivity, IUser } from "types";
|
2023-10-20 12:25:20 +00:00
|
|
|
|
2023-12-07 12:43:27 +00:00
|
|
|
type Props = {
|
2023-10-20 12:25:20 +00:00
|
|
|
workspaceSlug: string;
|
|
|
|
projectId: string;
|
2023-10-25 13:54:14 +00:00
|
|
|
issueId: string;
|
2023-12-07 12:43:27 +00:00
|
|
|
user: IUser | null;
|
|
|
|
issueActivity: IIssueActivity[] | null;
|
2023-10-20 12:25:20 +00:00
|
|
|
issueCommentCreate: (comment: any) => void;
|
|
|
|
issueCommentUpdate: (comment: any) => void;
|
|
|
|
issueCommentRemove: (commentId: string) => void;
|
|
|
|
issueCommentReactionCreate: (commentId: string, reaction: string) => void;
|
|
|
|
issueCommentReactionRemove: (commentId: string, reaction: string) => void;
|
2023-11-03 13:43:10 +00:00
|
|
|
showCommentAccessSpecifier: boolean;
|
2023-12-07 12:43:27 +00:00
|
|
|
};
|
2023-10-20 12:25:20 +00:00
|
|
|
|
2023-12-07 12:43:27 +00:00
|
|
|
export const IssueActivity: FC<Props> = (props) => {
|
2023-10-20 12:25:20 +00:00
|
|
|
const {
|
|
|
|
workspaceSlug,
|
|
|
|
projectId,
|
2023-10-25 13:54:14 +00:00
|
|
|
issueId,
|
2023-10-20 12:25:20 +00:00
|
|
|
user,
|
2023-12-07 12:43:27 +00:00
|
|
|
issueActivity,
|
2023-10-20 12:25:20 +00:00
|
|
|
issueCommentCreate,
|
|
|
|
issueCommentUpdate,
|
|
|
|
issueCommentRemove,
|
|
|
|
issueCommentReactionCreate,
|
|
|
|
issueCommentReactionRemove,
|
2023-11-03 13:43:10 +00:00
|
|
|
showCommentAccessSpecifier,
|
2023-10-20 12:25:20 +00:00
|
|
|
} = props;
|
|
|
|
|
|
|
|
const handleAddComment = async (formData: any) => {
|
|
|
|
if (!formData.comment_html) return;
|
|
|
|
await issueCommentCreate(formData);
|
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
2023-11-01 08:52:29 +00:00
|
|
|
<div className="flex flex-col gap-3 border-t py-6 border-custom-border-200">
|
|
|
|
<div className="font-medium text-lg">Activity</div>
|
2023-10-20 12:25:20 +00:00
|
|
|
|
|
|
|
<div className="space-y-2">
|
|
|
|
<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}
|
2023-12-07 12:43:27 +00:00
|
|
|
issueActivity={issueActivity}
|
2023-10-20 12:25:20 +00:00
|
|
|
issueCommentUpdate={issueCommentUpdate}
|
|
|
|
issueCommentRemove={issueCommentRemove}
|
|
|
|
issueCommentReactionCreate={issueCommentReactionCreate}
|
|
|
|
issueCommentReactionRemove={issueCommentReactionRemove}
|
|
|
|
/>
|
2023-11-10 13:15:41 +00:00
|
|
|
<IssueCommentEditor onSubmit={handleAddComment} showAccessSpecifier={showCommentAccessSpecifier} />
|
2023-10-20 12:25:20 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|