From 466060b7a5ec722a3845511fb2cb42d22d90888c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ai-chan-0411=20=28=E8=97=8D=29?= Date: Mon, 13 Apr 2026 01:20:30 +0900 Subject: [PATCH] feat: make pull request titles clickable links to GitHub PR closes #61 Add clickable links to PR titles in the Top Work section: - Add title and url fields to GraphQL query for pull requests - Map actual PR title (was incorrectly using repo nameWithOwner) - Render PR titles as anchor tags linking to the PR on GitHub - Opens in new tab with rel=noopener for security --- components/top-list.tsx | 17 ++++++++++++++++- lib/github.ts | 2 ++ lib/score.ts | 3 ++- types/github.ts | 2 ++ types/user-result.ts | 1 + 5 files changed, 23 insertions(+), 2 deletions(-) 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; }[];