plane/web/components/issues/issue-detail/issue-activity/comments/root.tsx

40 lines
1013 B
TypeScript
Raw Normal View History

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>
);
});