From 1477f4ef989776f9afab336a0906150ca4606947 Mon Sep 17 00:00:00 2001 From: Ananta Date: Fri, 24 Apr 2026 19:45:10 +0530 Subject: [PATCH] refactor: use display names in insights section --- components/result-dashboard.tsx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/components/result-dashboard.tsx b/components/result-dashboard.tsx index 0a967d3..5682250 100644 --- a/components/result-dashboard.tsx +++ b/components/result-dashboard.tsx @@ -44,10 +44,13 @@ export function ResultDashboard({ user1, user2 }: Props) { const getInsights = () => { const insights: string[] = []; + const user1DisplayName = user1.name || user1.username; + const user2DisplayName = user2.name || user1.username; + if (user1.repoScore > user2.repoScore) { insights.push( t("insights.repo.leader", { - username: user1.username, + username: user1DisplayName, score: user1.repoScore, other: user2.repoScore, }) @@ -55,7 +58,7 @@ export function ResultDashboard({ user1, user2 }: Props) { } else if (user2.repoScore > user1.repoScore) { insights.push( t("insights.repo.leader", { - username: user2.username, + username: user2DisplayName, score: user2.repoScore, other: user1.repoScore, }) @@ -67,7 +70,7 @@ export function ResultDashboard({ user1, user2 }: Props) { if (user1.prScore > user2.prScore) { insights.push( t("insights.pr.leader", { - username: user1.username, + username: user1DisplayName, score: user1.prScore, other: user2.prScore, }) @@ -75,7 +78,7 @@ export function ResultDashboard({ user1, user2 }: Props) { } else if (user2.prScore > user1.prScore) { insights.push( t("insights.pr.leader", { - username: user2.username, + username: user2DisplayName, score: user2.prScore, other: user1.prScore, }) @@ -85,9 +88,9 @@ export function ResultDashboard({ user1, user2 }: Props) { } if (user1.contributionScore > user2.contributionScore) { - insights.push(t("insights.contribution.leader", { username: user1.username })); + insights.push(t("insights.contribution.leader", { username: user1DisplayName })); } else if (user2.contributionScore > user1.contributionScore) { - insights.push(t("insights.contribution.leader", { username: user2.username })); + insights.push(t("insights.contribution.leader", { username: user2DisplayName })); } else { insights.push(t("insights.equal.contribution")); }