Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion components/top-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 }[];
Expand All @@ -37,7 +38,20 @@ export function TopList({ userResults }: Props) {
key={data.key}
>
<div>
<div className="font-medium text-slate-900">{data.title}</div>
<div className="font-medium text-slate-900">
{data.titleUrl ? (
<a
href={data.titleUrl}
target="_blank"
rel="noopener noreferrer"
className="hover:underline text-primary"
>
{data.title}
</a>
) : (
data.title
)}
</div>
<div className="text-xs text-muted-foreground mt-1">
{data.subtitle}
</div>
Expand Down Expand Up @@ -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: [
Expand Down
2 changes: 2 additions & 0 deletions lib/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ const QUERY = /* GraphQL */ `
merged
additions
deletions
title
url
repository {
nameWithOwner
stargazerCount
Expand Down
3 changes: 2 additions & 1 deletion lib/score.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions types/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export type PullRequestNode = {
merged: boolean;
additions: number;
deletions: number;
title: string;
url: string;
repository: {
nameWithOwner: string;
stargazerCount: number;
Expand Down
1 change: 1 addition & 0 deletions types/user-result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export type UserResult = {
stars?: number;
score?: number;
title?: string;
url?: string;
deletions?: number;
additions?: number;
}[];
Expand Down
Loading