From 289e81d6eb3d8d8ba1e33225971380c1fb3c219a Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Fri, 11 Aug 2023 15:48:52 +0530 Subject: [PATCH] chore: issue activity user redirection added (#1805) * feat: issue activity user redirection added * feat: analytics page user redirection --- .../scope-and-demand/leaderboard.tsx | 11 +++++++--- .../scope-and-demand/scope-and-demand.tsx | 4 ++++ apps/app/components/core/activity.tsx | 22 +++++++++++++++---- apps/app/types/analytics.d.ts | 2 ++ 4 files changed, 32 insertions(+), 7 deletions(-) diff --git a/apps/app/components/analytics/scope-and-demand/leaderboard.tsx b/apps/app/components/analytics/scope-and-demand/leaderboard.tsx index c22f60aa9..156c09d4c 100644 --- a/apps/app/components/analytics/scope-and-demand/leaderboard.tsx +++ b/apps/app/components/analytics/scope-and-demand/leaderboard.tsx @@ -5,18 +5,23 @@ type Props = { firstName: string; lastName: string; count: number; + id: string; }[]; title: string; + workspaceSlug: string; }; -export const AnalyticsLeaderboard: React.FC = ({ users, title }) => ( +export const AnalyticsLeaderboard: React.FC = ({ users, title, workspaceSlug }) => (
{title}
{users.length > 0 ? (
{users.map((user) => ( -
@@ -38,7 +43,7 @@ export const AnalyticsLeaderboard: React.FC = ({ users, title }) => (
{user.count} -
+ ))}
) : ( diff --git a/apps/app/components/analytics/scope-and-demand/scope-and-demand.tsx b/apps/app/components/analytics/scope-and-demand/scope-and-demand.tsx index c4acf8f45..7f40ee79a 100644 --- a/apps/app/components/analytics/scope-and-demand/scope-and-demand.tsx +++ b/apps/app/components/analytics/scope-and-demand/scope-and-demand.tsx @@ -60,8 +60,10 @@ export const ScopeAndDemand: React.FC = ({ fullScreen = true }) => { lastName: user?.created_by__last_name, display_name: user?.created_by__display_name, count: user?.count, + id: user?.created_by__id, }))} title="Most issues created" + workspaceSlug={workspaceSlug?.toString() ?? ""} /> ({ @@ -70,8 +72,10 @@ export const ScopeAndDemand: React.FC = ({ fullScreen = true }) => { lastName: user?.assignees__last_name, display_name: user?.assignees__display_name, count: user?.count, + id: user?.assignees__id, }))} title="Most issues closed" + workspaceSlug={workspaceSlug?.toString() ?? ""} />
diff --git a/apps/app/components/core/activity.tsx b/apps/app/components/core/activity.tsx index 833f4fd16..7ddf9c33c 100644 --- a/apps/app/components/core/activity.tsx +++ b/apps/app/components/core/activity.tsx @@ -35,6 +35,22 @@ const IssueLink = ({ activity }: { activity: IIssueActivity }) => { ); }; +const UserLink = ({ activity }: { activity: IIssueActivity }) => { + const router = useRouter(); + const { workspaceSlug } = router.query; + + return ( + + {activity.new_value && activity.new_value !== "" ? activity.new_value : activity.old_value} + + ); +}; + const activityDetails: { [key: string]: { message: (activity: IIssueActivity, showIssue: boolean) => React.ReactNode; @@ -46,8 +62,7 @@ const activityDetails: { if (activity.old_value === "") return ( <> - added a new assignee{" "} - {activity.new_value} + added a new assignee {showIssue && ( <> {" "} @@ -60,8 +75,7 @@ const activityDetails: { else return ( <> - removed the assignee{" "} - {activity.old_value} + removed the assignee {showIssue && ( <> {" "} diff --git a/apps/app/types/analytics.d.ts b/apps/app/types/analytics.d.ts index 94afb2c02..651596f19 100644 --- a/apps/app/types/analytics.d.ts +++ b/apps/app/types/analytics.d.ts @@ -69,6 +69,7 @@ export interface IDefaultAnalyticsUser { assignees__first_name: string; assignees__last_name: string; assignees__display_name: string; + assignees__id: string; count: number; } @@ -80,6 +81,7 @@ export interface IDefaultAnalyticsResponse { created_by__first_name: string; created_by__last_name: string; created_by__display_name: string; + created_by__id: string; count: number; }[]; open_estimate_sum: number;