forked from github/plane
refactor: issue activity component (#1749)
This commit is contained in:
parent
d315a24c1c
commit
a8816ef473
@ -1,5 +1,7 @@
|
|||||||
|
import { useRouter } from "next/router";
|
||||||
|
|
||||||
// icons
|
// icons
|
||||||
import { Icon } from "components/ui";
|
import { Icon, Tooltip } from "components/ui";
|
||||||
import { Squares2X2Icon } from "@heroicons/react/24/outline";
|
import { Squares2X2Icon } from "@heroicons/react/24/outline";
|
||||||
import { BlockedIcon, BlockerIcon } from "components/icons";
|
import { BlockedIcon, BlockerIcon } from "components/icons";
|
||||||
// helpers
|
// helpers
|
||||||
@ -8,26 +10,65 @@ import { capitalizeFirstLetter } from "helpers/string.helper";
|
|||||||
// types
|
// types
|
||||||
import { IIssueActivity } from "types";
|
import { IIssueActivity } from "types";
|
||||||
|
|
||||||
export const activityDetails: {
|
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"}
|
||||||
|
<Icon iconName="launch" className="!text-xs" />
|
||||||
|
</a>
|
||||||
|
</Tooltip>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const activityDetails: {
|
||||||
[key: string]: {
|
[key: string]: {
|
||||||
message: (activity: IIssueActivity) => React.ReactNode;
|
message: (activity: IIssueActivity, showIssue: boolean) => React.ReactNode;
|
||||||
icon: React.ReactNode;
|
icon: React.ReactNode;
|
||||||
};
|
};
|
||||||
} = {
|
} = {
|
||||||
assignees: {
|
assignees: {
|
||||||
message: (activity) => {
|
message: (activity, showIssue) => {
|
||||||
if (activity.old_value === "")
|
if (activity.old_value === "")
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
added a new assignee{" "}
|
added a new assignee{" "}
|
||||||
<span className="font-medium text-custom-text-100">{activity.new_value}</span>.
|
<span className="font-medium text-custom-text-100">{activity.new_value}</span>
|
||||||
|
{showIssue && (
|
||||||
|
<>
|
||||||
|
{" "}
|
||||||
|
to <IssueLink activity={activity} />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
.
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
else
|
else
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
removed the assignee{" "}
|
removed the assignee{" "}
|
||||||
<span className="font-medium text-custom-text-100">{activity.old_value}</span>.
|
<span className="font-medium text-custom-text-100">{activity.old_value}</span>
|
||||||
|
{showIssue && (
|
||||||
|
<>
|
||||||
|
{" "}
|
||||||
|
from <IssueLink activity={activity} />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
.
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -41,7 +82,7 @@ export const activityDetails: {
|
|||||||
icon: <Icon iconName="archive" className="!text-sm" aria-hidden="true" />,
|
icon: <Icon iconName="archive" className="!text-sm" aria-hidden="true" />,
|
||||||
},
|
},
|
||||||
attachment: {
|
attachment: {
|
||||||
message: (activity) => {
|
message: (activity, showIssue) => {
|
||||||
if (activity.verb === "created")
|
if (activity.verb === "created")
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -55,9 +96,27 @@ export const activityDetails: {
|
|||||||
attachment
|
attachment
|
||||||
<Icon iconName="launch" className="!text-xs" />
|
<Icon iconName="launch" className="!text-xs" />
|
||||||
</a>
|
</a>
|
||||||
|
{showIssue && (
|
||||||
|
<>
|
||||||
|
{" "}
|
||||||
|
to <IssueLink activity={activity} />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
else
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
removed an attachment
|
||||||
|
{showIssue && (
|
||||||
|
<>
|
||||||
|
{" "}
|
||||||
|
from <IssueLink activity={activity} />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
.
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
else return "removed an attachment.";
|
|
||||||
},
|
},
|
||||||
icon: <Icon iconName="attach_file" className="!text-sm" aria-hidden="true" />,
|
icon: <Icon iconName="attach_file" className="!text-sm" aria-hidden="true" />,
|
||||||
},
|
},
|
||||||
@ -126,17 +185,47 @@ export const activityDetails: {
|
|||||||
icon: <Icon iconName="contrast" className="!text-sm" aria-hidden="true" />,
|
icon: <Icon iconName="contrast" className="!text-sm" aria-hidden="true" />,
|
||||||
},
|
},
|
||||||
description: {
|
description: {
|
||||||
message: (activity) => "updated the description.",
|
message: (activity, showIssue) => (
|
||||||
|
<>
|
||||||
|
updated the description
|
||||||
|
{showIssue && (
|
||||||
|
<>
|
||||||
|
{" "}
|
||||||
|
of <IssueLink activity={activity} />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
.
|
||||||
|
</>
|
||||||
|
),
|
||||||
icon: <Icon iconName="chat" className="!text-sm" aria-hidden="true" />,
|
icon: <Icon iconName="chat" className="!text-sm" aria-hidden="true" />,
|
||||||
},
|
},
|
||||||
estimate_point: {
|
estimate_point: {
|
||||||
message: (activity) => {
|
message: (activity, showIssue) => {
|
||||||
if (!activity.new_value) return "removed the estimate point.";
|
if (!activity.new_value)
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
removed the estimate point
|
||||||
|
{showIssue && (
|
||||||
|
<>
|
||||||
|
{" "}
|
||||||
|
from <IssueLink activity={activity} />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
.
|
||||||
|
</>
|
||||||
|
);
|
||||||
else
|
else
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
set the estimate point to{" "}
|
set the estimate point to{" "}
|
||||||
<span className="font-medium text-custom-text-100">{activity.new_value}</span>.
|
<span className="font-medium text-custom-text-100">{activity.new_value}</span>
|
||||||
|
{showIssue && (
|
||||||
|
<>
|
||||||
|
{" "}
|
||||||
|
for <IssueLink activity={activity} />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
.
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -150,7 +239,7 @@ export const activityDetails: {
|
|||||||
icon: <Icon iconName="stack" className="!text-sm" aria-hidden="true" />,
|
icon: <Icon iconName="stack" className="!text-sm" aria-hidden="true" />,
|
||||||
},
|
},
|
||||||
labels: {
|
labels: {
|
||||||
message: (activity) => {
|
message: (activity, showIssue) => {
|
||||||
if (activity.old_value === "")
|
if (activity.old_value === "")
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -165,6 +254,12 @@ export const activityDetails: {
|
|||||||
/>
|
/>
|
||||||
<span className="font-medium text-custom-text-100">{activity.new_value}</span>
|
<span className="font-medium text-custom-text-100">{activity.new_value}</span>
|
||||||
</span>
|
</span>
|
||||||
|
{showIssue && (
|
||||||
|
<>
|
||||||
|
{" "}
|
||||||
|
to <IssueLink activity={activity} />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
else
|
else
|
||||||
@ -181,13 +276,19 @@ export const activityDetails: {
|
|||||||
/>
|
/>
|
||||||
<span className="font-medium text-custom-text-100">{activity.old_value}</span>
|
<span className="font-medium text-custom-text-100">{activity.old_value}</span>
|
||||||
</span>
|
</span>
|
||||||
|
{showIssue && (
|
||||||
|
<>
|
||||||
|
{" "}
|
||||||
|
from <IssueLink activity={activity} />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
icon: <Icon iconName="sell" className="!text-sm" aria-hidden="true" />,
|
icon: <Icon iconName="sell" className="!text-sm" aria-hidden="true" />,
|
||||||
},
|
},
|
||||||
link: {
|
link: {
|
||||||
message: (activity) => {
|
message: (activity, showIssue) => {
|
||||||
if (activity.verb === "created")
|
if (activity.verb === "created")
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -200,8 +301,14 @@ export const activityDetails: {
|
|||||||
>
|
>
|
||||||
link
|
link
|
||||||
<Icon iconName="launch" className="!text-xs" />
|
<Icon iconName="launch" className="!text-xs" />
|
||||||
</a>{" "}
|
</a>
|
||||||
to the issue.
|
{showIssue && (
|
||||||
|
<>
|
||||||
|
{" "}
|
||||||
|
to <IssueLink activity={activity} />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
.
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
else
|
else
|
||||||
@ -216,8 +323,14 @@ export const activityDetails: {
|
|||||||
>
|
>
|
||||||
link
|
link
|
||||||
<Icon iconName="launch" className="!text-xs" />
|
<Icon iconName="launch" className="!text-xs" />
|
||||||
</a>{" "}
|
</a>
|
||||||
from the issue.
|
{showIssue && (
|
||||||
|
<>
|
||||||
|
{" "}
|
||||||
|
from <IssueLink activity={activity} />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
.
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -250,52 +363,102 @@ export const activityDetails: {
|
|||||||
icon: <Icon iconName="dataset" className="!text-sm" aria-hidden="true" />,
|
icon: <Icon iconName="dataset" className="!text-sm" aria-hidden="true" />,
|
||||||
},
|
},
|
||||||
name: {
|
name: {
|
||||||
message: (activity) => `set the name to ${activity.new_value}.`,
|
message: (activity, showIssue) => (
|
||||||
|
<>
|
||||||
|
set the name to {activity.new_value}
|
||||||
|
{showIssue && (
|
||||||
|
<>
|
||||||
|
{" "}
|
||||||
|
of <IssueLink activity={activity} />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
.
|
||||||
|
</>
|
||||||
|
),
|
||||||
icon: <Icon iconName="chat" className="!text-sm" aria-hidden="true" />,
|
icon: <Icon iconName="chat" className="!text-sm" aria-hidden="true" />,
|
||||||
},
|
},
|
||||||
parent: {
|
parent: {
|
||||||
message: (activity) => {
|
message: (activity, showIssue) => {
|
||||||
if (!activity.new_value)
|
if (!activity.new_value)
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
removed the parent{" "}
|
removed the parent{" "}
|
||||||
<span className="font-medium text-custom-text-100">{activity.old_value}</span>.
|
<span className="font-medium text-custom-text-100">{activity.old_value}</span>
|
||||||
|
{showIssue && (
|
||||||
|
<>
|
||||||
|
{" "}
|
||||||
|
from <IssueLink activity={activity} />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
.
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
else
|
else
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
set the parent to{" "}
|
set the parent to{" "}
|
||||||
<span className="font-medium text-custom-text-100">{activity.new_value}</span>.
|
<span className="font-medium text-custom-text-100">{activity.new_value}</span>
|
||||||
|
{showIssue && (
|
||||||
|
<>
|
||||||
|
{" "}
|
||||||
|
for <IssueLink activity={activity} />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
.
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
icon: <Icon iconName="supervised_user_circle" className="!text-sm" aria-hidden="true" />,
|
icon: <Icon iconName="supervised_user_circle" className="!text-sm" aria-hidden="true" />,
|
||||||
},
|
},
|
||||||
priority: {
|
priority: {
|
||||||
message: (activity) => (
|
message: (activity, showIssue) => (
|
||||||
<>
|
<>
|
||||||
set the priority to{" "}
|
set the priority to{" "}
|
||||||
<span className="font-medium text-custom-text-100">
|
<span className="font-medium text-custom-text-100">
|
||||||
{activity.new_value ? capitalizeFirstLetter(activity.new_value) : "None"}
|
{activity.new_value ? capitalizeFirstLetter(activity.new_value) : "None"}
|
||||||
</span>
|
</span>
|
||||||
|
{showIssue && (
|
||||||
|
<>
|
||||||
|
{" "}
|
||||||
|
for <IssueLink activity={activity} />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
.
|
.
|
||||||
</>
|
</>
|
||||||
),
|
),
|
||||||
icon: <Icon iconName="signal_cellular_alt" className="!text-sm" aria-hidden="true" />,
|
icon: <Icon iconName="signal_cellular_alt" className="!text-sm" aria-hidden="true" />,
|
||||||
},
|
},
|
||||||
state: {
|
state: {
|
||||||
message: (activity) => (
|
message: (activity, showIssue) => (
|
||||||
<>
|
<>
|
||||||
set the state to{" "}
|
set the state to{" "}
|
||||||
<span className="font-medium text-custom-text-100">{activity.new_value}</span>.
|
<span className="font-medium text-custom-text-100">{activity.new_value}</span>
|
||||||
|
{showIssue && (
|
||||||
|
<>
|
||||||
|
{" "}
|
||||||
|
for <IssueLink activity={activity} />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
.
|
||||||
</>
|
</>
|
||||||
),
|
),
|
||||||
icon: <Squares2X2Icon className="h-3 w-3" aria-hidden="true" />,
|
icon: <Squares2X2Icon className="h-3 w-3" aria-hidden="true" />,
|
||||||
},
|
},
|
||||||
target_date: {
|
target_date: {
|
||||||
message: (activity) => {
|
message: (activity, showIssue) => {
|
||||||
if (!activity.new_value) return "removed the due date.";
|
if (!activity.new_value)
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
removed the due date
|
||||||
|
{showIssue && (
|
||||||
|
<>
|
||||||
|
{" "}
|
||||||
|
from <IssueLink activity={activity} />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
.
|
||||||
|
</>
|
||||||
|
);
|
||||||
else
|
else
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -303,6 +466,12 @@ export const activityDetails: {
|
|||||||
<span className="font-medium text-custom-text-100">
|
<span className="font-medium text-custom-text-100">
|
||||||
{renderShortDateWithYearFormat(activity.new_value)}
|
{renderShortDateWithYearFormat(activity.new_value)}
|
||||||
</span>
|
</span>
|
||||||
|
{showIssue && (
|
||||||
|
<>
|
||||||
|
{" "}
|
||||||
|
for <IssueLink activity={activity} />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
.
|
.
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
@ -310,3 +479,19 @@ export const activityDetails: {
|
|||||||
icon: <Icon iconName="calendar_today" className="!text-sm" aria-hidden="true" />,
|
icon: <Icon iconName="calendar_today" className="!text-sm" aria-hidden="true" />,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const ActivityIcon = ({ activity }: { activity: IIssueActivity }) => (
|
||||||
|
<>{activityDetails[activity.field as keyof typeof activityDetails].icon}</>
|
||||||
|
);
|
||||||
|
|
||||||
|
export const ActivityMessage = ({
|
||||||
|
activity,
|
||||||
|
showIssue = false,
|
||||||
|
}: {
|
||||||
|
activity: IIssueActivity;
|
||||||
|
showIssue?: boolean;
|
||||||
|
}) => (
|
||||||
|
<>
|
||||||
|
{activityDetails[activity.field as keyof typeof activityDetails].message(activity, showIssue)}
|
||||||
|
</>
|
||||||
|
);
|
@ -3,6 +3,7 @@ export * from "./modals";
|
|||||||
export * from "./sidebar";
|
export * from "./sidebar";
|
||||||
export * from "./theme";
|
export * from "./theme";
|
||||||
export * from "./views";
|
export * from "./views";
|
||||||
|
export * from "./activity";
|
||||||
export * from "./feeds";
|
export * from "./feeds";
|
||||||
export * from "./reaction-selector";
|
export * from "./reaction-selector";
|
||||||
export * from "./image-picker-popover";
|
export * from "./image-picker-popover";
|
||||||
|
@ -8,12 +8,12 @@ import useSWR from "swr";
|
|||||||
// services
|
// services
|
||||||
import issuesService from "services/issues.service";
|
import issuesService from "services/issues.service";
|
||||||
// components
|
// components
|
||||||
|
import { ActivityIcon, ActivityMessage } from "components/core";
|
||||||
import { CommentCard } from "components/issues/comment";
|
import { CommentCard } from "components/issues/comment";
|
||||||
// ui
|
// ui
|
||||||
import { Icon, Loader } from "components/ui";
|
import { Icon, Loader } from "components/ui";
|
||||||
// helpers
|
// helpers
|
||||||
import { timeAgo } from "helpers/date-time.helper";
|
import { timeAgo } from "helpers/date-time.helper";
|
||||||
import { activityDetails } from "helpers/activity.helper";
|
|
||||||
// types
|
// types
|
||||||
import { ICurrentUserResponse, IIssueComment } from "types";
|
import { ICurrentUserResponse, IIssueComment } from "types";
|
||||||
// fetch-keys
|
// fetch-keys
|
||||||
@ -91,11 +91,11 @@ export const IssueActivitySection: React.FC<Props> = ({ issueId, user }) => {
|
|||||||
<ul role="list" className="-mb-4">
|
<ul role="list" className="-mb-4">
|
||||||
{issueActivities.map((activityItem, index) => {
|
{issueActivities.map((activityItem, index) => {
|
||||||
// determines what type of action is performed
|
// determines what type of action is performed
|
||||||
const message = activityItem.field
|
const message = activityItem.field ? (
|
||||||
? activityDetails[activityItem.field as keyof typeof activityDetails]?.message(
|
<ActivityMessage activity={activityItem} />
|
||||||
activityItem
|
) : (
|
||||||
)
|
"created the issue."
|
||||||
: "created the issue.";
|
);
|
||||||
|
|
||||||
if ("field" in activityItem && activityItem.field !== "updated_by") {
|
if ("field" in activityItem && activityItem.field !== "updated_by") {
|
||||||
return (
|
return (
|
||||||
@ -116,8 +116,7 @@ export const IssueActivitySection: React.FC<Props> = ({ issueId, user }) => {
|
|||||||
activityItem.new_value === "restore" ? (
|
activityItem.new_value === "restore" ? (
|
||||||
<Icon iconName="history" className="text-sm text-custom-text-200" />
|
<Icon iconName="history" className="text-sm text-custom-text-200" />
|
||||||
) : (
|
) : (
|
||||||
activityDetails[activityItem.field as keyof typeof activityDetails]
|
<ActivityIcon activity={activityItem} />
|
||||||
?.icon
|
|
||||||
)
|
)
|
||||||
) : activityItem.actor_detail.avatar &&
|
) : activityItem.actor_detail.avatar &&
|
||||||
activityItem.actor_detail.avatar !== "" ? (
|
activityItem.actor_detail.avatar !== "" ? (
|
||||||
|
@ -140,11 +140,7 @@ export const CommentCard: React.FC<Props> = ({ comment, onSubmit, handleCommentD
|
|||||||
ref={showEditorRef}
|
ref={showEditorRef}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<CommentReaction
|
<CommentReaction projectId={comment.project} commentId={comment.id} />
|
||||||
workspaceSlug={comment?.workspace_detail?.slug}
|
|
||||||
projectId={comment.project}
|
|
||||||
commentId={comment.id}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
|
import { useRouter } from "next/router";
|
||||||
|
|
||||||
// hooks
|
// hooks
|
||||||
import useUser from "hooks/use-user";
|
import useUser from "hooks/use-user";
|
||||||
import useCommentReaction from "hooks/use-comment-reaction";
|
import useCommentReaction from "hooks/use-comment-reaction";
|
||||||
@ -9,13 +11,15 @@ import { ReactionSelector } from "components/core";
|
|||||||
import { renderEmoji } from "helpers/emoji.helper";
|
import { renderEmoji } from "helpers/emoji.helper";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
workspaceSlug?: string | string[];
|
|
||||||
projectId?: string | string[];
|
projectId?: string | string[];
|
||||||
commentId: string;
|
commentId: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const CommentReaction: React.FC<Props> = (props) => {
|
export const CommentReaction: React.FC<Props> = (props) => {
|
||||||
const { workspaceSlug, projectId, commentId } = props;
|
const { projectId, commentId } = props;
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
const { workspaceSlug } = router.query;
|
||||||
|
|
||||||
const { user } = useUser();
|
const { user } = useUser();
|
||||||
|
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import Link from "next/link";
|
|
||||||
|
|
||||||
import useSWR from "swr";
|
import useSWR from "swr";
|
||||||
|
|
||||||
// services
|
// services
|
||||||
import userService from "services/user.service";
|
import userService from "services/user.service";
|
||||||
|
// components
|
||||||
|
import { ActivityMessage } from "components/core";
|
||||||
// ui
|
// ui
|
||||||
import { Icon, Loader } from "components/ui";
|
import { Icon, Loader } from "components/ui";
|
||||||
// helpers
|
// helpers
|
||||||
import { activityDetails } from "helpers/activity.helper";
|
|
||||||
import { timeAgo } from "helpers/date-time.helper";
|
import { timeAgo } from "helpers/date-time.helper";
|
||||||
// fetch-keys
|
// fetch-keys
|
||||||
import { USER_PROFILE_ACTIVITY } from "constants/fetch-keys";
|
import { USER_PROFILE_ACTIVITY } from "constants/fetch-keys";
|
||||||
@ -55,12 +55,12 @@ export const ProfileActivity = () => {
|
|||||||
{activity.actor_detail.first_name} {activity.actor_detail.last_name}{" "}
|
{activity.actor_detail.first_name} {activity.actor_detail.last_name}{" "}
|
||||||
</span>
|
</span>
|
||||||
{activity.field ? (
|
{activity.field ? (
|
||||||
activityDetails[activity.field]?.message(activity as any)
|
<ActivityMessage activity={activity} showIssue />
|
||||||
) : (
|
) : (
|
||||||
<span>
|
<span>
|
||||||
created this{" "}
|
created this{" "}
|
||||||
<a
|
<a
|
||||||
href={`/${activity.workspace_detail.slug}/projects/${activity.project}/issues/${activity.issue}`}
|
href={`/${workspaceSlug}/projects/${activity.project}/issues/${activity.issue}`}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
className="font-medium text-custom-text-100 inline-flex items-center gap-1 hover:underline"
|
className="font-medium text-custom-text-100 inline-flex items-center gap-1 hover:underline"
|
||||||
|
25
apps/app/types/issues.d.ts
vendored
25
apps/app/types/issues.d.ts
vendored
@ -38,19 +38,6 @@ export interface IIssueModule {
|
|||||||
workspace: string;
|
workspace: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IIssueCycle {
|
|
||||||
created_at: Date;
|
|
||||||
created_by: string;
|
|
||||||
cycle: string;
|
|
||||||
cycle_detail: ICycle;
|
|
||||||
id: string;
|
|
||||||
issue: string;
|
|
||||||
project: string;
|
|
||||||
updated_at: Date;
|
|
||||||
updated_by: string;
|
|
||||||
workspace: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IIssueParent {
|
export interface IIssueParent {
|
||||||
description: any;
|
description: any;
|
||||||
id: string;
|
id: string;
|
||||||
@ -200,18 +187,26 @@ export interface IIssueActivity {
|
|||||||
created_by: string;
|
created_by: string;
|
||||||
field: string | null;
|
field: string | null;
|
||||||
id: string;
|
id: string;
|
||||||
issue: string;
|
issue: string | null;
|
||||||
issue_comment: string | null;
|
issue_comment: string | null;
|
||||||
|
issue_detail: {
|
||||||
|
description: any;
|
||||||
|
description_html: string;
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
priority: string | null;
|
||||||
|
sequence_id: string;
|
||||||
|
} | null;
|
||||||
new_identifier: string | null;
|
new_identifier: string | null;
|
||||||
new_value: string | null;
|
new_value: string | null;
|
||||||
old_identifier: string | null;
|
old_identifier: string | null;
|
||||||
old_value: string | null;
|
old_value: string | null;
|
||||||
project: string;
|
project: string;
|
||||||
|
project_detail: IProjectLite;
|
||||||
updated_at: Date;
|
updated_at: Date;
|
||||||
updated_by: string;
|
updated_by: string;
|
||||||
verb: string;
|
verb: string;
|
||||||
workspace: string;
|
workspace: string;
|
||||||
workspace_detail: IWorkspaceLite;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IIssueComment extends IIssueActivity {
|
export interface IIssueComment extends IIssueActivity {
|
||||||
|
26
apps/app/types/users.d.ts
vendored
26
apps/app/types/users.d.ts
vendored
@ -1,5 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
IIssue,
|
IIssue,
|
||||||
|
IIssueActivity,
|
||||||
IIssueLite,
|
IIssueLite,
|
||||||
IWorkspace,
|
IWorkspace,
|
||||||
IWorkspaceLite,
|
IWorkspaceLite,
|
||||||
@ -99,29 +100,6 @@ export interface IUserWorkspaceDashboard {
|
|||||||
upcoming_issues: IIssueLite[];
|
upcoming_issues: IIssueLite[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IUserDetailedActivity {
|
|
||||||
actor: string;
|
|
||||||
actor_detail: IUserLite;
|
|
||||||
attachments: any[];
|
|
||||||
comment: string;
|
|
||||||
created_at: string;
|
|
||||||
created_by: string | null;
|
|
||||||
field: string;
|
|
||||||
id: string;
|
|
||||||
issue: string;
|
|
||||||
issue_comment: string | null;
|
|
||||||
new_identifier: string | null;
|
|
||||||
new_value: string | null;
|
|
||||||
old_identifier: string | null;
|
|
||||||
old_value: string | null;
|
|
||||||
project: string;
|
|
||||||
updated_at: string;
|
|
||||||
updated_by: string | null;
|
|
||||||
verb: string;
|
|
||||||
workspace: string;
|
|
||||||
workspace_detail: IWorkspaceLite;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IUserActivityResponse {
|
export interface IUserActivityResponse {
|
||||||
count: number;
|
count: number;
|
||||||
extra_stats: null;
|
extra_stats: null;
|
||||||
@ -129,7 +107,7 @@ export interface IUserActivityResponse {
|
|||||||
next_page_results: boolean;
|
next_page_results: boolean;
|
||||||
prev_cursor: string;
|
prev_cursor: string;
|
||||||
prev_page_results: boolean;
|
prev_page_results: boolean;
|
||||||
results: IUserDetailedActivity[];
|
results: IIssueActivity[];
|
||||||
total_pages: number;
|
total_pages: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user