[WEB-987] fix: inbox issue activity (#4208)

* chore: inbox issue activity

* chore: dummy data script

* chore: inbox issue activity implementation

---------

Co-authored-by: Anmol Singh Bhatia <anmolsinghbhatia@plane.so>
This commit is contained in:
Bavisetti Narayan 2024-04-17 19:43:22 +05:30 committed by GitHub
parent f0cb48006f
commit bf9049a7a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 127 additions and 2 deletions

View file

@ -0,0 +1,42 @@
import { FC } from "react";
import { observer } from "mobx-react";
// hooks
import { Inbox } from "lucide-react";
import { useIssueDetail } from "@/hooks/store";
// components
import { IssueActivityBlockComponent } from "./";
// icons
type TIssueInboxActivity = { activityId: string; ends: "top" | "bottom" | undefined };
export const IssueInboxActivity: FC<TIssueInboxActivity> = observer((props) => {
const { activityId, ends } = props;
// hooks
const {
activity: { getActivityById },
} = useIssueDetail();
const activity = getActivityById(activityId);
const getInboxActivityMessage = () => {
switch (activity?.verb) {
case "-1":
return "declined this issue from inbox.";
case "0":
return "snoozed this issue.";
case "1":
return "accepted this issue from inbox.";
case "2":
return "declined this issue from inbox by marking a duplicate issue.";
default:
return "updated inbox issue status.";
}
};
if (!activity) return <></>;
return (
<IssueActivityBlockComponent icon={<Inbox className="h-4 w-4 flex-shrink-0" />} activityId={activityId} ends={ends}>
<>{getInboxActivityMessage()}</>
</IssueActivityBlockComponent>
);
});

View file

@ -15,6 +15,7 @@ export * from "./label";
export * from "./link";
export * from "./attachment";
export * from "./archived-at";
export * from "./inbox";
// helpers
export * from "./helpers/activity-block";

View file

@ -21,6 +21,7 @@ import {
IssueLinkActivity,
IssueAttachmentActivity,
IssueArchivedAtActivity,
IssueInboxActivity,
} from "./actions";
type TIssueActivityList = {
@ -74,6 +75,8 @@ export const IssueActivityList: FC<TIssueActivityList> = observer((props) => {
return <IssueAttachmentActivity {...componentDefaultProps} showIssue={false} />;
case "archived_at":
return <IssueArchivedAtActivity {...componentDefaultProps} />;
case "inbox":
return <IssueInboxActivity {...componentDefaultProps} />;
default:
return <></>;
}