2023-08-01 11:37:11 +00:00
|
|
|
import { useRouter } from "next/router";
|
|
|
|
|
2023-09-21 10:34:05 +00:00
|
|
|
import useSWR from "swr";
|
|
|
|
|
2023-09-28 07:48:35 +00:00
|
|
|
// hook
|
|
|
|
import useEstimateOption from "hooks/use-estimate-option";
|
2023-09-21 10:34:05 +00:00
|
|
|
// services
|
|
|
|
import issuesService from "services/issues.service";
|
2023-07-28 08:09:42 +00:00
|
|
|
// icons
|
2023-08-01 11:37:11 +00:00
|
|
|
import { Icon, Tooltip } from "components/ui";
|
2023-09-28 08:32:03 +00:00
|
|
|
import {
|
|
|
|
TagIcon,
|
|
|
|
CopyPlus,
|
|
|
|
Calendar,
|
|
|
|
Link2Icon,
|
|
|
|
RocketIcon,
|
|
|
|
Users2Icon,
|
|
|
|
ArchiveIcon,
|
|
|
|
PaperclipIcon,
|
|
|
|
ContrastIcon,
|
|
|
|
TriangleIcon,
|
|
|
|
LayoutGridIcon,
|
|
|
|
SignalMediumIcon,
|
|
|
|
MessageSquareIcon,
|
|
|
|
} from "lucide-react";
|
|
|
|
import {
|
|
|
|
BlockedIcon,
|
|
|
|
BlockerIcon,
|
|
|
|
RelatedIcon,
|
|
|
|
StackedLayersHorizontalIcon,
|
|
|
|
} from "components/icons";
|
2023-07-28 08:09:42 +00:00
|
|
|
// helpers
|
|
|
|
import { renderShortDateWithYearFormat } from "helpers/date-time.helper";
|
|
|
|
import { capitalizeFirstLetter } from "helpers/string.helper";
|
|
|
|
// types
|
|
|
|
import { IIssueActivity } from "types";
|
2023-09-21 10:34:05 +00:00
|
|
|
// fetch-keys
|
|
|
|
import { WORKSPACE_LABELS } from "constants/fetch-keys";
|
2023-07-28 08:09:42 +00:00
|
|
|
|
2023-08-01 11:37:11 +00:00
|
|
|
const IssueLink = ({ activity }: { activity: IIssueActivity }) => {
|
|
|
|
const router = useRouter();
|
|
|
|
const { workspaceSlug } = router.query;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Tooltip
|
|
|
|
tooltipContent={
|
|
|
|
activity.issue_detail ? activity.issue_detail.name : "This issue has been deleted"
|
|
|
|
}
|
|
|
|
>
|
|
|
|
<a
|
|
|
|
href={`/${workspaceSlug}/projects/${activity.project}/issues/${activity.issue}`}
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
className="font-medium text-custom-text-100 inline-flex items-center gap-1 hover:underline"
|
|
|
|
>
|
|
|
|
{activity.issue_detail
|
|
|
|
? `${activity.project_detail.identifier}-${activity.issue_detail.sequence_id}`
|
|
|
|
: "Issue"}
|
2023-09-28 08:32:03 +00:00
|
|
|
<RocketIcon size={12} color="#6b7280" />
|
2023-08-01 11:37:11 +00:00
|
|
|
</a>
|
|
|
|
</Tooltip>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2023-08-11 10:18:52 +00:00
|
|
|
const UserLink = ({ activity }: { activity: IIssueActivity }) => {
|
|
|
|
const router = useRouter();
|
|
|
|
const { workspaceSlug } = router.query;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<a
|
|
|
|
href={`/${workspaceSlug}/profile/${activity.new_identifier ?? activity.old_identifier}`}
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
className="font-medium text-custom-text-100 inline-flex items-center hover:underline"
|
|
|
|
>
|
|
|
|
{activity.new_value && activity.new_value !== "" ? activity.new_value : activity.old_value}
|
|
|
|
</a>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2023-09-21 10:34:05 +00:00
|
|
|
const LabelPill = ({ labelId }: { labelId: string }) => {
|
|
|
|
const router = useRouter();
|
|
|
|
const { workspaceSlug } = router.query;
|
|
|
|
|
|
|
|
const { data: labels } = useSWR(
|
|
|
|
workspaceSlug ? WORKSPACE_LABELS(workspaceSlug.toString()) : null,
|
|
|
|
workspaceSlug ? () => issuesService.getWorkspaceLabels(workspaceSlug.toString()) : null
|
|
|
|
);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<span
|
|
|
|
className="h-1.5 w-1.5 rounded-full"
|
|
|
|
style={{
|
|
|
|
backgroundColor: labels?.find((l) => l.id === labelId)?.color ?? "#000000",
|
|
|
|
}}
|
|
|
|
aria-hidden="true"
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
2023-09-28 07:48:35 +00:00
|
|
|
const EstimatePoint = ({ point }: { point: string }) => {
|
|
|
|
const { estimateValue, isEstimateActive } = useEstimateOption(Number(point));
|
|
|
|
const currentPoint = Number(point) + 1;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<span className="font-medium text-custom-text-100">
|
|
|
|
{isEstimateActive
|
|
|
|
? estimateValue
|
|
|
|
: `${currentPoint} ${currentPoint > 1 ? "points" : "point"}`}
|
|
|
|
</span>
|
|
|
|
);
|
|
|
|
};
|
2023-09-21 10:34:05 +00:00
|
|
|
|
2023-08-01 11:37:11 +00:00
|
|
|
const activityDetails: {
|
2023-07-28 08:09:42 +00:00
|
|
|
[key: string]: {
|
2023-08-25 06:51:11 +00:00
|
|
|
message: (
|
|
|
|
activity: IIssueActivity,
|
|
|
|
showIssue: boolean,
|
|
|
|
workspaceSlug: string
|
|
|
|
) => React.ReactNode;
|
2023-07-28 08:09:42 +00:00
|
|
|
icon: React.ReactNode;
|
|
|
|
};
|
|
|
|
} = {
|
|
|
|
assignees: {
|
2023-08-01 11:37:11 +00:00
|
|
|
message: (activity, showIssue) => {
|
2023-07-28 08:09:42 +00:00
|
|
|
if (activity.old_value === "")
|
|
|
|
return (
|
|
|
|
<>
|
2023-08-11 10:18:52 +00:00
|
|
|
added a new assignee <UserLink activity={activity} />
|
2023-08-01 11:37:11 +00:00
|
|
|
{showIssue && (
|
|
|
|
<>
|
|
|
|
{" "}
|
|
|
|
to <IssueLink activity={activity} />
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
.
|
2023-07-28 08:09:42 +00:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
else
|
|
|
|
return (
|
|
|
|
<>
|
2023-08-11 10:18:52 +00:00
|
|
|
removed the assignee <UserLink activity={activity} />
|
2023-08-01 11:37:11 +00:00
|
|
|
{showIssue && (
|
|
|
|
<>
|
|
|
|
{" "}
|
|
|
|
from <IssueLink activity={activity} />
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
.
|
2023-07-28 08:09:42 +00:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
},
|
2023-09-28 08:32:03 +00:00
|
|
|
icon: <Users2Icon size={12} color="#6b7280" aria-hidden="true" />,
|
2023-07-28 08:09:42 +00:00
|
|
|
},
|
|
|
|
archived_at: {
|
|
|
|
message: (activity) => {
|
|
|
|
if (activity.new_value === "restore") return "restored the issue.";
|
|
|
|
else return "archived the issue.";
|
|
|
|
},
|
2023-09-28 08:32:03 +00:00
|
|
|
icon: <ArchiveIcon size={12} color="#6b7280" aria-hidden="true" />,
|
2023-07-28 08:09:42 +00:00
|
|
|
},
|
|
|
|
attachment: {
|
2023-08-01 11:37:11 +00:00
|
|
|
message: (activity, showIssue) => {
|
2023-07-28 08:09:42 +00:00
|
|
|
if (activity.verb === "created")
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
uploaded a new{" "}
|
|
|
|
<a
|
|
|
|
href={`${activity.new_value}`}
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
className="font-medium text-custom-text-100 inline-flex items-center gap-1 hover:underline"
|
|
|
|
>
|
|
|
|
attachment
|
2023-09-28 08:32:03 +00:00
|
|
|
<RocketIcon size={12} color="#6b7280" />
|
2023-07-28 08:09:42 +00:00
|
|
|
</a>
|
2023-08-01 11:37:11 +00:00
|
|
|
{showIssue && (
|
|
|
|
<>
|
|
|
|
{" "}
|
|
|
|
to <IssueLink activity={activity} />
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
else
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
removed an attachment
|
|
|
|
{showIssue && (
|
|
|
|
<>
|
|
|
|
{" "}
|
|
|
|
from <IssueLink activity={activity} />
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
.
|
2023-07-28 08:09:42 +00:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
},
|
2023-09-28 08:32:03 +00:00
|
|
|
icon: <PaperclipIcon size={12} color="#6b7280" aria-hidden="true" />,
|
2023-07-28 08:09:42 +00:00
|
|
|
},
|
|
|
|
blocking: {
|
|
|
|
message: (activity) => {
|
|
|
|
if (activity.old_value === "")
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
marked this issue is blocking issue{" "}
|
|
|
|
<span className="font-medium text-custom-text-100">{activity.new_value}</span>.
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
else
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
removed the blocking issue{" "}
|
|
|
|
<span className="font-medium text-custom-text-100">{activity.old_value}</span>.
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
},
|
|
|
|
icon: <BlockerIcon height="12" width="12" color="#6b7280" />,
|
|
|
|
},
|
2023-09-19 07:28:00 +00:00
|
|
|
blocked_by: {
|
2023-07-28 08:09:42 +00:00
|
|
|
message: (activity) => {
|
|
|
|
if (activity.old_value === "")
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
marked this issue is being blocked by{" "}
|
|
|
|
<span className="font-medium text-custom-text-100">{activity.new_value}</span>.
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
else
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
removed this issue being blocked by issue{" "}
|
|
|
|
<span className="font-medium text-custom-text-100">{activity.old_value}</span>.
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
},
|
|
|
|
icon: <BlockedIcon height="12" width="12" color="#6b7280" />,
|
|
|
|
},
|
2023-09-19 07:28:00 +00:00
|
|
|
duplicate: {
|
|
|
|
message: (activity) => {
|
|
|
|
if (activity.old_value === "")
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
marked this issue as duplicate of{" "}
|
|
|
|
<span className="font-medium text-custom-text-100">{activity.new_value}</span>.
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
else
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
removed this issue as a duplicate of{" "}
|
|
|
|
<span className="font-medium text-custom-text-100">{activity.old_value}</span>.
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
},
|
|
|
|
icon: <CopyPlus size={12} color="#6b7280" />,
|
|
|
|
},
|
|
|
|
relates_to: {
|
|
|
|
message: (activity) => {
|
|
|
|
if (activity.old_value === "")
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
marked that this issue relates to{" "}
|
|
|
|
<span className="font-medium text-custom-text-100">{activity.new_value}</span>.
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
else
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
removed the relation from{" "}
|
|
|
|
<span className="font-medium text-custom-text-100">{activity.old_value}</span>.
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
},
|
|
|
|
icon: <RelatedIcon height="12" width="12" color="#6b7280" />,
|
|
|
|
},
|
2023-07-28 08:09:42 +00:00
|
|
|
cycles: {
|
2023-08-25 06:51:11 +00:00
|
|
|
message: (activity, showIssue, workspaceSlug) => {
|
2023-07-28 08:09:42 +00:00
|
|
|
if (activity.verb === "created")
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
added this issue to the cycle{" "}
|
2023-08-25 06:51:11 +00:00
|
|
|
<a
|
|
|
|
href={`/${workspaceSlug}/projects/${activity.project}/cycles/${activity.new_identifier}`}
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
className="font-medium text-custom-text-100 inline-flex items-center gap-1 hover:underline"
|
|
|
|
>
|
|
|
|
{activity.new_value}
|
2023-09-28 08:32:03 +00:00
|
|
|
<RocketIcon size={12} color="#6b7280" />
|
2023-08-25 06:51:11 +00:00
|
|
|
</a>
|
2023-07-28 08:09:42 +00:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
else if (activity.verb === "updated")
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
set the cycle to{" "}
|
2023-08-25 06:51:11 +00:00
|
|
|
<a
|
|
|
|
href={`/${workspaceSlug}/projects/${activity.project}/cycles/${activity.new_identifier}`}
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
className="font-medium text-custom-text-100 inline-flex items-center gap-1 hover:underline"
|
|
|
|
>
|
|
|
|
{activity.new_value}
|
2023-09-28 08:32:03 +00:00
|
|
|
<RocketIcon size={12} color="#6b7280" />
|
2023-08-25 06:51:11 +00:00
|
|
|
</a>
|
2023-07-28 08:09:42 +00:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
else
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
removed the issue from the cycle{" "}
|
2023-08-25 06:51:11 +00:00
|
|
|
<a
|
|
|
|
href={`/${workspaceSlug}/projects/${activity.project}/cycles/${activity.old_identifier}`}
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
className="font-medium text-custom-text-100 inline-flex items-center gap-1 hover:underline"
|
|
|
|
>
|
|
|
|
{activity.old_value}
|
2023-09-28 08:32:03 +00:00
|
|
|
<RocketIcon size={12} color="#6b7280" />
|
2023-08-25 06:51:11 +00:00
|
|
|
</a>
|
2023-07-28 08:09:42 +00:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
},
|
2023-09-28 08:32:03 +00:00
|
|
|
icon: <ContrastIcon size={12} color="#6b7280" aria-hidden="true" />,
|
2023-07-28 08:09:42 +00:00
|
|
|
},
|
|
|
|
description: {
|
2023-08-01 11:37:11 +00:00
|
|
|
message: (activity, showIssue) => (
|
|
|
|
<>
|
|
|
|
updated the description
|
|
|
|
{showIssue && (
|
|
|
|
<>
|
|
|
|
{" "}
|
|
|
|
of <IssueLink activity={activity} />
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
.
|
|
|
|
</>
|
|
|
|
),
|
2023-09-28 08:32:03 +00:00
|
|
|
icon: <MessageSquareIcon size={12} color="#6b7280" aria-hidden="true" />,
|
2023-07-28 08:09:42 +00:00
|
|
|
},
|
|
|
|
estimate_point: {
|
2023-08-01 11:37:11 +00:00
|
|
|
message: (activity, showIssue) => {
|
|
|
|
if (!activity.new_value)
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
removed the estimate point
|
|
|
|
{showIssue && (
|
|
|
|
<>
|
|
|
|
{" "}
|
|
|
|
from <IssueLink activity={activity} />
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
.
|
|
|
|
</>
|
|
|
|
);
|
2023-07-28 08:09:42 +00:00
|
|
|
else
|
|
|
|
return (
|
|
|
|
<>
|
2023-09-28 07:48:35 +00:00
|
|
|
set the estimate point to <EstimatePoint point={activity.new_value} />
|
2023-08-01 11:37:11 +00:00
|
|
|
{showIssue && (
|
|
|
|
<>
|
|
|
|
{" "}
|
|
|
|
for <IssueLink activity={activity} />
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
.
|
2023-07-28 08:09:42 +00:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
},
|
2023-09-28 08:32:03 +00:00
|
|
|
icon: <TriangleIcon size={12} color="#6b7280" aria-hidden="true" />,
|
2023-07-28 08:09:42 +00:00
|
|
|
},
|
|
|
|
issue: {
|
|
|
|
message: (activity) => {
|
|
|
|
if (activity.verb === "created") return "created the issue.";
|
|
|
|
else return "deleted an issue.";
|
|
|
|
},
|
2023-09-28 08:32:03 +00:00
|
|
|
icon: <StackedLayersHorizontalIcon width={12} height={12} color="#6b7280" aria-hidden="true" />,
|
2023-07-28 08:09:42 +00:00
|
|
|
},
|
|
|
|
labels: {
|
2023-08-01 11:37:11 +00:00
|
|
|
message: (activity, showIssue) => {
|
2023-07-28 08:09:42 +00:00
|
|
|
if (activity.old_value === "")
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
added a new label{" "}
|
2023-09-21 10:34:05 +00:00
|
|
|
<span className="inline-flex items-center gap-2 rounded-full border border-custom-border-300 px-2 py-0.5 text-xs">
|
|
|
|
<LabelPill labelId={activity.new_identifier ?? ""} />
|
2023-07-28 08:09:42 +00:00
|
|
|
<span className="font-medium text-custom-text-100">{activity.new_value}</span>
|
|
|
|
</span>
|
2023-08-01 11:37:11 +00:00
|
|
|
{showIssue && (
|
|
|
|
<>
|
|
|
|
{" "}
|
|
|
|
to <IssueLink activity={activity} />
|
|
|
|
</>
|
|
|
|
)}
|
2023-07-28 08:09:42 +00:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
else
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
removed the label{" "}
|
|
|
|
<span className="inline-flex items-center gap-3 rounded-full border border-custom-border-300 px-2 py-0.5 text-xs">
|
2023-09-21 10:34:05 +00:00
|
|
|
<LabelPill labelId={activity.old_identifier ?? ""} />
|
2023-07-28 08:09:42 +00:00
|
|
|
<span className="font-medium text-custom-text-100">{activity.old_value}</span>
|
|
|
|
</span>
|
2023-08-01 11:37:11 +00:00
|
|
|
{showIssue && (
|
|
|
|
<>
|
|
|
|
{" "}
|
|
|
|
from <IssueLink activity={activity} />
|
|
|
|
</>
|
|
|
|
)}
|
2023-07-28 08:09:42 +00:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
},
|
2023-09-28 08:32:03 +00:00
|
|
|
icon: <TagIcon size={12} color="#6b7280" aria-hidden="true" />,
|
2023-07-28 08:09:42 +00:00
|
|
|
},
|
|
|
|
link: {
|
2023-08-01 11:37:11 +00:00
|
|
|
message: (activity, showIssue) => {
|
2023-07-28 08:09:42 +00:00
|
|
|
if (activity.verb === "created")
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
added this{" "}
|
|
|
|
<a
|
|
|
|
href={`${activity.new_value}`}
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
className="font-medium text-custom-text-100 inline-flex items-center gap-1 hover:underline"
|
|
|
|
>
|
|
|
|
link
|
2023-09-28 08:32:03 +00:00
|
|
|
<RocketIcon size={12} color="#6b7280" />
|
2023-08-01 11:37:11 +00:00
|
|
|
</a>
|
|
|
|
{showIssue && (
|
|
|
|
<>
|
|
|
|
{" "}
|
|
|
|
to <IssueLink activity={activity} />
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
.
|
2023-07-28 08:09:42 +00:00
|
|
|
</>
|
|
|
|
);
|
2023-09-01 11:22:44 +00:00
|
|
|
else if (activity.verb === "updated")
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
updated the{" "}
|
|
|
|
<a
|
|
|
|
href={`${activity.old_value}`}
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
className="font-medium text-custom-text-100 inline-flex items-center gap-1 hover:underline"
|
|
|
|
>
|
|
|
|
link
|
2023-09-28 08:32:03 +00:00
|
|
|
<RocketIcon size={12} color="#6b7280" />
|
2023-09-01 11:22:44 +00:00
|
|
|
</a>
|
|
|
|
{showIssue && (
|
|
|
|
<>
|
|
|
|
{" "}
|
|
|
|
from <IssueLink activity={activity} />
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
.
|
|
|
|
</>
|
|
|
|
);
|
2023-07-28 08:09:42 +00:00
|
|
|
else
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
removed this{" "}
|
|
|
|
<a
|
|
|
|
href={`${activity.old_value}`}
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
className="font-medium text-custom-text-100 inline-flex items-center gap-1 hover:underline"
|
|
|
|
>
|
|
|
|
link
|
2023-09-28 08:32:03 +00:00
|
|
|
<RocketIcon size={12} color="#6b7280" />
|
2023-08-01 11:37:11 +00:00
|
|
|
</a>
|
|
|
|
{showIssue && (
|
|
|
|
<>
|
|
|
|
{" "}
|
|
|
|
from <IssueLink activity={activity} />
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
.
|
2023-07-28 08:09:42 +00:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
},
|
2023-09-28 08:32:03 +00:00
|
|
|
icon: <Link2Icon size={12} color="#6b7280" aria-hidden="true" />,
|
2023-07-28 08:09:42 +00:00
|
|
|
},
|
|
|
|
modules: {
|
2023-08-25 06:51:11 +00:00
|
|
|
message: (activity, showIssue, workspaceSlug) => {
|
2023-07-28 08:09:42 +00:00
|
|
|
if (activity.verb === "created")
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
added this issue to the module{" "}
|
2023-08-25 06:51:11 +00:00
|
|
|
<a
|
|
|
|
href={`/${workspaceSlug}/projects/${activity.project}/modules/${activity.new_identifier}`}
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
className="font-medium text-custom-text-100 inline-flex items-center gap-1 hover:underline"
|
|
|
|
>
|
|
|
|
{activity.new_value}
|
2023-09-28 08:32:03 +00:00
|
|
|
<RocketIcon size={12} color="#6b7280" />
|
2023-08-25 06:51:11 +00:00
|
|
|
</a>
|
2023-07-28 08:09:42 +00:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
else if (activity.verb === "updated")
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
set the module to{" "}
|
2023-08-25 06:51:11 +00:00
|
|
|
<a
|
|
|
|
href={`/${workspaceSlug}/projects/${activity.project}/modules/${activity.new_identifier}`}
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
className="font-medium text-custom-text-100 inline-flex items-center gap-1 hover:underline"
|
|
|
|
>
|
|
|
|
{activity.new_value}
|
2023-09-28 08:32:03 +00:00
|
|
|
<RocketIcon size={12} color="#6b7280" />
|
2023-08-25 06:51:11 +00:00
|
|
|
</a>
|
2023-07-28 08:09:42 +00:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
else
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
removed the issue from the module{" "}
|
2023-08-25 06:51:11 +00:00
|
|
|
<a
|
|
|
|
href={`/${workspaceSlug}/projects/${activity.project}/modules/${activity.old_identifier}`}
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
className="font-medium text-custom-text-100 inline-flex items-center gap-1 hover:underline"
|
|
|
|
>
|
|
|
|
{activity.old_value}
|
2023-09-28 08:32:03 +00:00
|
|
|
<RocketIcon size={12} color="#6b7280" />
|
2023-08-25 06:51:11 +00:00
|
|
|
</a>
|
2023-07-28 08:09:42 +00:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
},
|
2023-09-28 08:32:03 +00:00
|
|
|
icon: <Icon iconName="dataset" className="!text-xs !text-[#6b7280]" aria-hidden="true" />,
|
2023-07-28 08:09:42 +00:00
|
|
|
},
|
|
|
|
name: {
|
2023-08-01 11:37:11 +00:00
|
|
|
message: (activity, showIssue) => (
|
|
|
|
<>
|
|
|
|
set the name to {activity.new_value}
|
|
|
|
{showIssue && (
|
|
|
|
<>
|
|
|
|
{" "}
|
|
|
|
of <IssueLink activity={activity} />
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
.
|
|
|
|
</>
|
|
|
|
),
|
2023-09-28 08:32:03 +00:00
|
|
|
icon: <MessageSquareIcon size={12} color="#6b7280" aria-hidden="true" />,
|
2023-07-28 08:09:42 +00:00
|
|
|
},
|
|
|
|
parent: {
|
2023-08-01 11:37:11 +00:00
|
|
|
message: (activity, showIssue) => {
|
2023-07-28 08:09:42 +00:00
|
|
|
if (!activity.new_value)
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
removed the parent{" "}
|
2023-08-01 11:37:11 +00:00
|
|
|
<span className="font-medium text-custom-text-100">{activity.old_value}</span>
|
|
|
|
{showIssue && (
|
|
|
|
<>
|
|
|
|
{" "}
|
|
|
|
from <IssueLink activity={activity} />
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
.
|
2023-07-28 08:09:42 +00:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
else
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
set the parent to{" "}
|
2023-08-01 11:37:11 +00:00
|
|
|
<span className="font-medium text-custom-text-100">{activity.new_value}</span>
|
|
|
|
{showIssue && (
|
|
|
|
<>
|
|
|
|
{" "}
|
|
|
|
for <IssueLink activity={activity} />
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
.
|
2023-07-28 08:09:42 +00:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
},
|
2023-09-28 08:32:03 +00:00
|
|
|
icon: (
|
|
|
|
<Icon
|
|
|
|
iconName="supervised_user_circle"
|
|
|
|
className="!text-xs !text-[#6b7280]"
|
|
|
|
aria-hidden="true"
|
|
|
|
/>
|
|
|
|
),
|
2023-07-28 08:09:42 +00:00
|
|
|
},
|
|
|
|
priority: {
|
2023-08-01 11:37:11 +00:00
|
|
|
message: (activity, showIssue) => (
|
2023-07-28 08:09:42 +00:00
|
|
|
<>
|
|
|
|
set the priority to{" "}
|
|
|
|
<span className="font-medium text-custom-text-100">
|
|
|
|
{activity.new_value ? capitalizeFirstLetter(activity.new_value) : "None"}
|
|
|
|
</span>
|
2023-08-01 11:37:11 +00:00
|
|
|
{showIssue && (
|
|
|
|
<>
|
|
|
|
{" "}
|
|
|
|
for <IssueLink activity={activity} />
|
|
|
|
</>
|
|
|
|
)}
|
2023-07-28 08:09:42 +00:00
|
|
|
.
|
|
|
|
</>
|
|
|
|
),
|
2023-09-28 08:32:03 +00:00
|
|
|
icon: <SignalMediumIcon size={12} color="#6b7280" aria-hidden="true" />,
|
2023-07-28 08:09:42 +00:00
|
|
|
},
|
2023-08-09 09:47:32 +00:00
|
|
|
start_date: {
|
|
|
|
message: (activity, showIssue) => {
|
|
|
|
if (!activity.new_value)
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
removed the start date
|
|
|
|
{showIssue && (
|
|
|
|
<>
|
|
|
|
{" "}
|
|
|
|
from <IssueLink activity={activity} />
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
.
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
else
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
set the start date to{" "}
|
|
|
|
<span className="font-medium text-custom-text-100">
|
|
|
|
{renderShortDateWithYearFormat(activity.new_value)}
|
|
|
|
</span>
|
|
|
|
{showIssue && (
|
|
|
|
<>
|
|
|
|
{" "}
|
|
|
|
for <IssueLink activity={activity} />
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
.
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
},
|
2023-09-28 08:32:03 +00:00
|
|
|
icon: <Calendar size={12} color="#6b7280" aria-hidden="true" />,
|
2023-08-09 09:47:32 +00:00
|
|
|
},
|
2023-07-28 08:09:42 +00:00
|
|
|
state: {
|
2023-08-01 11:37:11 +00:00
|
|
|
message: (activity, showIssue) => (
|
2023-07-28 08:09:42 +00:00
|
|
|
<>
|
|
|
|
set the state to{" "}
|
2023-08-01 11:37:11 +00:00
|
|
|
<span className="font-medium text-custom-text-100">{activity.new_value}</span>
|
|
|
|
{showIssue && (
|
|
|
|
<>
|
|
|
|
{" "}
|
|
|
|
for <IssueLink activity={activity} />
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
.
|
2023-07-28 08:09:42 +00:00
|
|
|
</>
|
|
|
|
),
|
2023-09-28 08:32:03 +00:00
|
|
|
icon: <LayoutGridIcon size={12} color="#6b7280" aria-hidden="true" />,
|
2023-07-28 08:09:42 +00:00
|
|
|
},
|
|
|
|
target_date: {
|
2023-08-01 11:37:11 +00:00
|
|
|
message: (activity, showIssue) => {
|
|
|
|
if (!activity.new_value)
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
removed the due date
|
|
|
|
{showIssue && (
|
|
|
|
<>
|
|
|
|
{" "}
|
|
|
|
from <IssueLink activity={activity} />
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
.
|
|
|
|
</>
|
|
|
|
);
|
2023-07-28 08:09:42 +00:00
|
|
|
else
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
set the due date to{" "}
|
|
|
|
<span className="font-medium text-custom-text-100">
|
|
|
|
{renderShortDateWithYearFormat(activity.new_value)}
|
|
|
|
</span>
|
2023-08-01 11:37:11 +00:00
|
|
|
{showIssue && (
|
|
|
|
<>
|
|
|
|
{" "}
|
|
|
|
for <IssueLink activity={activity} />
|
|
|
|
</>
|
|
|
|
)}
|
2023-07-28 08:09:42 +00:00
|
|
|
.
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
},
|
2023-09-28 08:32:03 +00:00
|
|
|
icon: <Calendar size={12} color="#6b7280" aria-hidden="true" />,
|
2023-07-28 08:09:42 +00:00
|
|
|
},
|
|
|
|
};
|
2023-08-01 11:37:11 +00:00
|
|
|
|
|
|
|
export const ActivityIcon = ({ activity }: { activity: IIssueActivity }) => (
|
2023-08-01 13:10:04 +00:00
|
|
|
<>{activityDetails[activity.field as keyof typeof activityDetails]?.icon}</>
|
2023-08-01 11:37:11 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
export const ActivityMessage = ({
|
|
|
|
activity,
|
|
|
|
showIssue = false,
|
|
|
|
}: {
|
|
|
|
activity: IIssueActivity;
|
|
|
|
showIssue?: boolean;
|
2023-08-25 06:51:11 +00:00
|
|
|
}) => {
|
|
|
|
const router = useRouter();
|
|
|
|
const { workspaceSlug } = router.query;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
{activityDetails[activity.field as keyof typeof activityDetails]?.message(
|
|
|
|
activity,
|
|
|
|
showIssue,
|
|
|
|
workspaceSlug?.toString() ?? ""
|
|
|
|
)}
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|