mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
40 lines
1013 B
TypeScript
40 lines
1013 B
TypeScript
|
import { FC } from "react";
|
||
|
import { observer } from "mobx-react-lite";
|
||
|
// hooks
|
||
|
import { useIssueDetail } from "hooks/store";
|
||
|
// components
|
||
|
import { IssueCommentCard } from "./comment-card";
|
||
|
|
||
|
type TIssueCommentRoot = {
|
||
|
workspaceSlug: string;
|
||
|
projectId: string;
|
||
|
issueId: string;
|
||
|
disabled: boolean;
|
||
|
};
|
||
|
|
||
|
export const IssueCommentRoot: FC<TIssueCommentRoot> = observer((props) => {
|
||
|
const { workspaceSlug, projectId, issueId, disabled } = props;
|
||
|
// hooks
|
||
|
const {
|
||
|
comment: { getCommentsByIssueId },
|
||
|
} = useIssueDetail();
|
||
|
|
||
|
const commentIds = getCommentsByIssueId(issueId);
|
||
|
|
||
|
if (!commentIds) return <></>;
|
||
|
return (
|
||
|
<div>
|
||
|
{commentIds.map((commentId, index) => (
|
||
|
<IssueCommentCard
|
||
|
workspaceSlug={workspaceSlug}
|
||
|
projectId={projectId}
|
||
|
issueId={issueId}
|
||
|
commentId={commentId}
|
||
|
disabled={disabled}
|
||
|
ends={index === 0 ? "top" : index === commentIds.length - 1 ? "bottom" : undefined}
|
||
|
/>
|
||
|
))}
|
||
|
</div>
|
||
|
);
|
||
|
});
|