forked from github/plane
chore: issue activity user redirection added (#1805)
* feat: issue activity user redirection added * feat: analytics page user redirection
This commit is contained in:
parent
def10af1e2
commit
289e81d6eb
@ -5,18 +5,23 @@ type Props = {
|
|||||||
firstName: string;
|
firstName: string;
|
||||||
lastName: string;
|
lastName: string;
|
||||||
count: number;
|
count: number;
|
||||||
|
id: string;
|
||||||
}[];
|
}[];
|
||||||
title: string;
|
title: string;
|
||||||
|
workspaceSlug: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const AnalyticsLeaderboard: React.FC<Props> = ({ users, title }) => (
|
export const AnalyticsLeaderboard: React.FC<Props> = ({ users, title, workspaceSlug }) => (
|
||||||
<div className="p-3 border border-custom-border-200 rounded-[10px]">
|
<div className="p-3 border border-custom-border-200 rounded-[10px]">
|
||||||
<h6 className="text-base font-medium">{title}</h6>
|
<h6 className="text-base font-medium">{title}</h6>
|
||||||
{users.length > 0 ? (
|
{users.length > 0 ? (
|
||||||
<div className="mt-3 space-y-3">
|
<div className="mt-3 space-y-3">
|
||||||
{users.map((user) => (
|
{users.map((user) => (
|
||||||
<div
|
<a
|
||||||
key={user.display_name ?? "None"}
|
key={user.display_name ?? "None"}
|
||||||
|
href={`/${workspaceSlug}/profile/${user.id}`}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
className="flex items-start justify-between gap-4 text-xs"
|
className="flex items-start justify-between gap-4 text-xs"
|
||||||
>
|
>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
@ -38,7 +43,7 @@ export const AnalyticsLeaderboard: React.FC<Props> = ({ users, title }) => (
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<span className="flex-shrink-0">{user.count}</span>
|
<span className="flex-shrink-0">{user.count}</span>
|
||||||
</div>
|
</a>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
|
@ -60,8 +60,10 @@ export const ScopeAndDemand: React.FC<Props> = ({ fullScreen = true }) => {
|
|||||||
lastName: user?.created_by__last_name,
|
lastName: user?.created_by__last_name,
|
||||||
display_name: user?.created_by__display_name,
|
display_name: user?.created_by__display_name,
|
||||||
count: user?.count,
|
count: user?.count,
|
||||||
|
id: user?.created_by__id,
|
||||||
}))}
|
}))}
|
||||||
title="Most issues created"
|
title="Most issues created"
|
||||||
|
workspaceSlug={workspaceSlug?.toString() ?? ""}
|
||||||
/>
|
/>
|
||||||
<AnalyticsLeaderboard
|
<AnalyticsLeaderboard
|
||||||
users={defaultAnalytics.most_issue_closed_user?.map((user) => ({
|
users={defaultAnalytics.most_issue_closed_user?.map((user) => ({
|
||||||
@ -70,8 +72,10 @@ export const ScopeAndDemand: React.FC<Props> = ({ fullScreen = true }) => {
|
|||||||
lastName: user?.assignees__last_name,
|
lastName: user?.assignees__last_name,
|
||||||
display_name: user?.assignees__display_name,
|
display_name: user?.assignees__display_name,
|
||||||
count: user?.count,
|
count: user?.count,
|
||||||
|
id: user?.assignees__id,
|
||||||
}))}
|
}))}
|
||||||
title="Most issues closed"
|
title="Most issues closed"
|
||||||
|
workspaceSlug={workspaceSlug?.toString() ?? ""}
|
||||||
/>
|
/>
|
||||||
<div className={fullScreen ? "md:col-span-2" : ""}>
|
<div className={fullScreen ? "md:col-span-2" : ""}>
|
||||||
<AnalyticsYearWiseIssues defaultAnalytics={defaultAnalytics} />
|
<AnalyticsYearWiseIssues defaultAnalytics={defaultAnalytics} />
|
||||||
|
@ -35,6 +35,22 @@ const IssueLink = ({ activity }: { activity: IIssueActivity }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
const activityDetails: {
|
const activityDetails: {
|
||||||
[key: string]: {
|
[key: string]: {
|
||||||
message: (activity: IIssueActivity, showIssue: boolean) => React.ReactNode;
|
message: (activity: IIssueActivity, showIssue: boolean) => React.ReactNode;
|
||||||
@ -46,8 +62,7 @@ const activityDetails: {
|
|||||||
if (activity.old_value === "")
|
if (activity.old_value === "")
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
added a new assignee{" "}
|
added a new assignee <UserLink activity={activity} />
|
||||||
<span className="font-medium text-custom-text-100">{activity.new_value}</span>
|
|
||||||
{showIssue && (
|
{showIssue && (
|
||||||
<>
|
<>
|
||||||
{" "}
|
{" "}
|
||||||
@ -60,8 +75,7 @@ const activityDetails: {
|
|||||||
else
|
else
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
removed the assignee{" "}
|
removed the assignee <UserLink activity={activity} />
|
||||||
<span className="font-medium text-custom-text-100">{activity.old_value}</span>
|
|
||||||
{showIssue && (
|
{showIssue && (
|
||||||
<>
|
<>
|
||||||
{" "}
|
{" "}
|
||||||
|
2
apps/app/types/analytics.d.ts
vendored
2
apps/app/types/analytics.d.ts
vendored
@ -69,6 +69,7 @@ export interface IDefaultAnalyticsUser {
|
|||||||
assignees__first_name: string;
|
assignees__first_name: string;
|
||||||
assignees__last_name: string;
|
assignees__last_name: string;
|
||||||
assignees__display_name: string;
|
assignees__display_name: string;
|
||||||
|
assignees__id: string;
|
||||||
count: number;
|
count: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,6 +81,7 @@ export interface IDefaultAnalyticsResponse {
|
|||||||
created_by__first_name: string;
|
created_by__first_name: string;
|
||||||
created_by__last_name: string;
|
created_by__last_name: string;
|
||||||
created_by__display_name: string;
|
created_by__display_name: string;
|
||||||
|
created_by__id: string;
|
||||||
count: number;
|
count: number;
|
||||||
}[];
|
}[];
|
||||||
open_estimate_sum: number;
|
open_estimate_sum: number;
|
||||||
|
Loading…
Reference in New Issue
Block a user