2024-01-23 07:58:58 +00:00
|
|
|
import { FC } from "react";
|
2024-05-08 17:31:20 +00:00
|
|
|
import { observer } from "mobx-react";
|
2024-01-23 07:58:58 +00:00
|
|
|
// hooks
|
2024-03-19 14:38:35 +00:00
|
|
|
import { useIssueDetail } from "@/hooks/store";
|
2024-01-23 07:58:58 +00:00
|
|
|
// components
|
|
|
|
import {
|
|
|
|
IssueDefaultActivity,
|
|
|
|
IssueNameActivity,
|
|
|
|
IssueDescriptionActivity,
|
|
|
|
IssueStateActivity,
|
|
|
|
IssueAssigneeActivity,
|
|
|
|
IssuePriorityActivity,
|
|
|
|
IssueEstimateActivity,
|
|
|
|
IssueParentActivity,
|
|
|
|
IssueRelationActivity,
|
|
|
|
IssueStartDateActivity,
|
|
|
|
IssueTargetDateActivity,
|
|
|
|
IssueCycleActivity,
|
|
|
|
IssueModuleActivity,
|
|
|
|
IssueLabelActivity,
|
|
|
|
IssueLinkActivity,
|
|
|
|
IssueAttachmentActivity,
|
|
|
|
IssueArchivedAtActivity,
|
2024-04-17 14:13:22 +00:00
|
|
|
IssueInboxActivity,
|
2024-01-23 07:58:58 +00:00
|
|
|
} from "./actions";
|
|
|
|
|
|
|
|
type TIssueActivityList = {
|
|
|
|
activityId: string;
|
|
|
|
ends: "top" | "bottom" | undefined;
|
|
|
|
};
|
|
|
|
|
|
|
|
export const IssueActivityList: FC<TIssueActivityList> = observer((props) => {
|
|
|
|
const { activityId, ends } = props;
|
|
|
|
// hooks
|
|
|
|
const {
|
|
|
|
activity: { getActivityById },
|
|
|
|
comment: {},
|
|
|
|
} = useIssueDetail();
|
|
|
|
|
|
|
|
const componentDefaultProps = { activityId, ends };
|
|
|
|
|
|
|
|
const activityField = getActivityById(activityId)?.field;
|
|
|
|
switch (activityField) {
|
|
|
|
case null: // default issue creation
|
|
|
|
return <IssueDefaultActivity {...componentDefaultProps} />;
|
|
|
|
case "state":
|
|
|
|
return <IssueStateActivity {...componentDefaultProps} showIssue={false} />;
|
|
|
|
case "name":
|
|
|
|
return <IssueNameActivity {...componentDefaultProps} />;
|
|
|
|
case "description":
|
|
|
|
return <IssueDescriptionActivity {...componentDefaultProps} showIssue={false} />;
|
|
|
|
case "assignees":
|
|
|
|
return <IssueAssigneeActivity {...componentDefaultProps} showIssue={false} />;
|
|
|
|
case "priority":
|
|
|
|
return <IssuePriorityActivity {...componentDefaultProps} showIssue={false} />;
|
|
|
|
case "estimate_point":
|
|
|
|
return <IssueEstimateActivity {...componentDefaultProps} showIssue={false} />;
|
|
|
|
case "parent":
|
|
|
|
return <IssueParentActivity {...componentDefaultProps} showIssue={false} />;
|
|
|
|
case ["blocking", "blocked_by", "duplicate", "relates_to"].find((field) => field === activityField):
|
|
|
|
return <IssueRelationActivity {...componentDefaultProps} />;
|
|
|
|
case "start_date":
|
|
|
|
return <IssueStartDateActivity {...componentDefaultProps} showIssue={false} />;
|
|
|
|
case "target_date":
|
|
|
|
return <IssueTargetDateActivity {...componentDefaultProps} showIssue={false} />;
|
|
|
|
case "cycles":
|
|
|
|
return <IssueCycleActivity {...componentDefaultProps} />;
|
|
|
|
case "modules":
|
|
|
|
return <IssueModuleActivity {...componentDefaultProps} />;
|
|
|
|
case "labels":
|
|
|
|
return <IssueLabelActivity {...componentDefaultProps} showIssue={false} />;
|
|
|
|
case "link":
|
|
|
|
return <IssueLinkActivity {...componentDefaultProps} showIssue={false} />;
|
|
|
|
case "attachment":
|
|
|
|
return <IssueAttachmentActivity {...componentDefaultProps} showIssue={false} />;
|
|
|
|
case "archived_at":
|
|
|
|
return <IssueArchivedAtActivity {...componentDefaultProps} />;
|
2024-04-17 14:13:22 +00:00
|
|
|
case "inbox":
|
|
|
|
return <IssueInboxActivity {...componentDefaultProps} />;
|
2024-01-23 07:58:58 +00:00
|
|
|
default:
|
|
|
|
return <></>;
|
|
|
|
}
|
|
|
|
});
|