// icons
import { Icon } from "components/ui";
import { Squares2X2Icon } from "@heroicons/react/24/outline";
import { BlockedIcon, BlockerIcon } from "components/icons";
// helpers
import { renderShortDateWithYearFormat } from "helpers/date-time.helper";
import { capitalizeFirstLetter } from "helpers/string.helper";
// types
import { IIssueActivity } from "types";
export const activityDetails: {
[key: string]: {
message: (activity: IIssueActivity) => React.ReactNode;
icon: React.ReactNode;
};
} = {
assignees: {
message: (activity) => {
if (activity.old_value === "")
return (
<>
added a new assignee{" "}
{activity.new_value}.
>
);
else
return (
<>
removed the assignee{" "}
{activity.old_value}.
>
);
},
icon: ,
},
archived_at: {
message: (activity) => {
if (activity.new_value === "restore") return "restored the issue.";
else return "archived the issue.";
},
icon: ,
},
attachment: {
message: (activity) => {
if (activity.verb === "created")
return (
<>
uploaded a new{" "}
attachment
>
);
else return "removed an attachment.";
},
icon: ,
},
blocking: {
message: (activity) => {
if (activity.old_value === "")
return (
<>
marked this issue is blocking issue{" "}
{activity.new_value}.
>
);
else
return (
<>
removed the blocking issue{" "}
{activity.old_value}.
>
);
},
icon: ,
},
blocks: {
message: (activity) => {
if (activity.old_value === "")
return (
<>
marked this issue is being blocked by{" "}
{activity.new_value}.
>
);
else
return (
<>
removed this issue being blocked by issue{" "}
{activity.old_value}.
>
);
},
icon: ,
},
cycles: {
message: (activity) => {
if (activity.verb === "created")
return (
<>
added this issue to the cycle{" "}
{activity.new_value}.
>
);
else if (activity.verb === "updated")
return (
<>
set the cycle to{" "}
{activity.new_value}.
>
);
else
return (
<>
removed the issue from the cycle{" "}
{activity.old_value}.
>
);
},
icon: ,
},
description: {
message: (activity) => "updated the description.",
icon: ,
},
estimate_point: {
message: (activity) => {
if (!activity.new_value) return "removed the estimate point.";
else
return (
<>
set the estimate point to{" "}
{activity.new_value}.
>
);
},
icon: ,
},
issue: {
message: (activity) => {
if (activity.verb === "created") return "created the issue.";
else return "deleted an issue.";
},
icon: ,
},
labels: {
message: (activity) => {
if (activity.old_value === "")
return (
<>
added a new label{" "}
{activity.new_value}
>
);
else
return (
<>
removed the label{" "}
{activity.old_value}
>
);
},
icon: ,
},
link: {
message: (activity) => {
if (activity.verb === "created")
return (
<>
added this{" "}
link
{" "}
to the issue.
>
);
else
return (
<>
removed this{" "}
link
{" "}
from the issue.
>
);
},
icon: ,
},
modules: {
message: (activity) => {
if (activity.verb === "created")
return (
<>
added this issue to the module{" "}
{activity.new_value}.
>
);
else if (activity.verb === "updated")
return (
<>
set the module to{" "}
{activity.new_value}.
>
);
else
return (
<>
removed the issue from the module{" "}
{activity.old_value}.
>
);
},
icon: ,
},
name: {
message: (activity) => `set the name to ${activity.new_value}.`,
icon: ,
},
parent: {
message: (activity) => {
if (!activity.new_value)
return (
<>
removed the parent{" "}
{activity.old_value}.
>
);
else
return (
<>
set the parent to{" "}
{activity.new_value}.
>
);
},
icon: ,
},
priority: {
message: (activity) => (
<>
set the priority to{" "}
{activity.new_value ? capitalizeFirstLetter(activity.new_value) : "None"}
.
>
),
icon: ,
},
state: {
message: (activity) => (
<>
set the state to{" "}
{activity.new_value}.
>
),
icon: ,
},
target_date: {
message: (activity) => {
if (!activity.new_value) return "removed the due date.";
else
return (
<>
set the due date to{" "}
{renderShortDateWithYearFormat(activity.new_value)}
.
>
);
},
icon: ,
},
};