plane/apps/space/components/issues/peek-overview/issue-activity.tsx

41 lines
1.2 KiB
TypeScript
Raw Normal View History

import React, { useEffect } from "react";
2023-08-30 18:42:45 +00:00
import { useRouter } from "next/router";
import { observer } from "mobx-react-lite";
2023-08-30 18:42:45 +00:00
// lib
import { useMobxStore } from "lib/mobx/store-provider";
2023-08-30 18:42:45 +00:00
// components
import { CommentCard, AddComment } from "components/issues/peek-overview";
2023-08-30 18:42:45 +00:00
// types
import { IIssue } from "types";
type Props = {
2023-08-30 18:42:45 +00:00
issueDetails: IIssue;
};
export const PeekOverviewIssueActivity: React.FC<Props> = observer((props) => {
2023-08-30 18:42:45 +00:00
const router = useRouter();
2023-08-31 11:05:26 +00:00
const { workspace_slug } = router.query;
2023-08-30 18:42:45 +00:00
const { issueDetails: issueDetailStore, user: userStore } = useMobxStore();
2023-08-31 11:05:26 +00:00
const comments = issueDetailStore.details[issueDetailStore.peekId || ""]?.comments || [];
return (
<div>
<h4 className="font-medium">Activity</h4>
2023-08-31 11:05:26 +00:00
{workspace_slug && (
<div className="mt-4">
2023-08-30 18:42:45 +00:00
<div className="space-y-4">
{comments.map((comment: any) => (
2023-08-31 11:07:25 +00:00
<CommentCard key={comment.id} comment={comment} workspaceSlug={workspace_slug?.toString()} />
2023-08-30 18:42:45 +00:00
))}
</div>
<div className="mt-4">
2023-08-31 11:05:26 +00:00
<AddComment disabled={!userStore.currentUser} />
2023-08-30 18:42:45 +00:00
</div>
</div>
2023-08-30 18:42:45 +00:00
)}
</div>
);
});