From f9c3f02d1514aff7c3305ebb2962b478e2f5dc8a Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal <65252264+aaryan610@users.noreply.github.com> Date: Sun, 23 Jul 2023 14:38:07 +0530 Subject: [PATCH] refactor: issue activity message logic (#1614) --- apps/app/components/issues/activity.tsx | 575 ++++++++++-------- .../issues/comment/comment-card.tsx | 2 +- apps/app/types/issues.d.ts | 54 +- apps/app/types/users.d.ts | 8 +- 4 files changed, 335 insertions(+), 304 deletions(-) diff --git a/apps/app/components/issues/activity.tsx b/apps/app/components/issues/activity.tsx index 617b35266..58808d8a1 100644 --- a/apps/app/components/issues/activity.tsx +++ b/apps/app/components/issues/activity.tsx @@ -6,8 +6,6 @@ import useSWR from "swr"; // services import issuesService from "services/issues.service"; -// hooks -import useEstimateOption from "hooks/use-estimate-option"; // components import { CommentCard } from "components/issues/comment"; // ui @@ -17,88 +15,288 @@ import { Squares2X2Icon } from "@heroicons/react/24/outline"; import { BlockedIcon, BlockerIcon } from "components/icons"; // helpers import { renderShortDateWithYearFormat, timeAgo } from "helpers/date-time.helper"; -import { addSpaceIfCamelCase } from "helpers/string.helper"; +import { capitalizeFirstLetter } from "helpers/string.helper"; // types -import { ICurrentUserResponse, IIssueComment, IIssueLabels } from "types"; +import { ICurrentUserResponse, IIssueActivity, IIssueComment } from "types"; // fetch-keys -import { PROJECT_ISSUES_ACTIVITY, PROJECT_ISSUE_LABELS } from "constants/fetch-keys"; +import { PROJECT_ISSUES_ACTIVITY } from "constants/fetch-keys"; const activityDetails: { [key: string]: { - message?: string; - icon: JSX.Element; + message: (activity: IIssueActivity) => React.ReactNode; + icon: React.ReactNode; }; } = { assignee: { - message: "removed the assignee", + message: (activity) => ( + <> + removed the assignee{" "} + {activity.old_value}. + + ), icon: