2024-01-23 07:58:58 +00:00
|
|
|
import { FC } from "react";
|
|
|
|
import { observer } from "mobx-react-lite";
|
|
|
|
// hooks
|
2024-03-19 14:38:35 +00:00
|
|
|
import { useIssueDetail } from "@/hooks/store";
|
2024-01-23 07:58:58 +00:00
|
|
|
// components
|
2024-03-06 13:09:14 +00:00
|
|
|
import { TActivityOperations } from "../root";
|
2024-01-23 07:58:58 +00:00
|
|
|
import { IssueCommentCard } from "./comment-card";
|
|
|
|
// types
|
|
|
|
|
|
|
|
type TIssueCommentRoot = {
|
|
|
|
workspaceSlug: string;
|
|
|
|
issueId: string;
|
|
|
|
activityOperations: TActivityOperations;
|
|
|
|
showAccessSpecifier?: boolean;
|
|
|
|
};
|
|
|
|
|
|
|
|
export const IssueCommentRoot: FC<TIssueCommentRoot> = observer((props) => {
|
|
|
|
const { workspaceSlug, issueId, activityOperations, showAccessSpecifier } = props;
|
|
|
|
// hooks
|
|
|
|
const {
|
|
|
|
comment: { getCommentsByIssueId },
|
|
|
|
} = useIssueDetail();
|
|
|
|
|
|
|
|
const commentIds = getCommentsByIssueId(issueId);
|
|
|
|
if (!commentIds) return <></>;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
{commentIds.map((commentId, index) => (
|
|
|
|
<IssueCommentCard
|
2024-03-06 13:09:14 +00:00
|
|
|
key={commentId}
|
2024-01-23 07:58:58 +00:00
|
|
|
workspaceSlug={workspaceSlug}
|
|
|
|
commentId={commentId}
|
|
|
|
ends={index === 0 ? "top" : index === commentIds.length - 1 ? "bottom" : undefined}
|
|
|
|
activityOperations={activityOperations}
|
|
|
|
showAccessSpecifier={showAccessSpecifier}
|
|
|
|
/>
|
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
});
|