diff --git a/components/top-list.tsx b/components/top-list.tsx index d0740d9..f569cdf 100644 --- a/components/top-list.tsx +++ b/components/top-list.tsx @@ -27,6 +27,7 @@ type Props = { export function TopList({ userResults }: Props) { const cardDetails = (data: { title: string; + titleUrl?: string; subtitle?: string; score?: number; badges: { tooltip?: string; label?: any; icon: any }[]; @@ -37,7 +38,20 @@ export function TopList({ userResults }: Props) { key={data.key} >
-
{data.title}
+
+ {data.titleUrl ? ( + + {data.title} + + ) : ( + data.title + )} +
{data.subtitle}
@@ -125,6 +139,7 @@ export function TopList({ userResults }: Props) { cardDetails({ key: `pr-${i}`, title: pr.title || "Untitled Pull Request", + titleUrl: pr.url, subtitle: `in ${pr.repo}`, score: pr.score, badges: [ diff --git a/lib/github.ts b/lib/github.ts index 4023aac..a01fb9b 100644 --- a/lib/github.ts +++ b/lib/github.ts @@ -39,6 +39,8 @@ const QUERY = /* GraphQL */ ` merged additions deletions + title + url repository { nameWithOwner stargazerCount diff --git a/lib/score.ts b/lib/score.ts index d62908d..237005d 100644 --- a/lib/score.ts +++ b/lib/score.ts @@ -114,7 +114,8 @@ export function calculateUserScore( })), topPullRequests: prScore.details.slice(0, 3).map((item) => ({ repo: item.pr.repository.nameWithOwner, - title: item.pr.repository.nameWithOwner, + title: item.pr.title, + url: item.pr.url, stars: item.pr.repository.stargazerCount, score: item.score, additions: item.pr.additions, diff --git a/types/github.ts b/types/github.ts index 0a7ff56..5bd8306 100644 --- a/types/github.ts +++ b/types/github.ts @@ -10,6 +10,8 @@ export type PullRequestNode = { merged: boolean; additions: number; deletions: number; + title: string; + url: string; repository: { nameWithOwner: string; stargazerCount: number; diff --git a/types/user-result.ts b/types/user-result.ts index d972cf2..0f79652 100644 --- a/types/user-result.ts +++ b/types/user-result.ts @@ -16,6 +16,7 @@ export type UserResult = { stars?: number; score?: number; title?: string; + url?: string; deletions?: number; additions?: number; }[];