Skip to content

Commit 6431e14

Browse files
TonybynMp4claude
andcommitted
feat(web): label chips show the label's description on hover
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 1d626d0 commit 6431e14

9 files changed

Lines changed: 48 additions & 25 deletions

File tree

‎apps/web/src/components/pullRequest/pullRequestPresentation.tsx‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ export function PullRequestLabelChip({
4242
className,
4343
children,
4444
}: {
45-
label: Pick<PullRequestLabel, "name" | "color">;
45+
label: Pick<PullRequestLabel, "name" | "color" | "description">;
4646
size?: "sm" | "default";
4747
className?: string;
4848
children?: ReactNode;
4949
}) {
5050
const color = pullRequestLabelColor(label.color);
51-
return (
51+
const badge = (
5252
<Badge
5353
size={size}
5454
variant={color ? "label" : "secondary"}
@@ -59,6 +59,13 @@ export function PullRequestLabelChip({
5959
{children}
6060
</Badge>
6161
);
62+
if (!label.description) return badge;
63+
return (
64+
<Tooltip>
65+
<TooltipTrigger render={badge} />
66+
<TooltipPopup>{label.description}</TooltipPopup>
67+
</Tooltip>
68+
);
6269
}
6370

6471
function reviewDecisionPresentation(decision: PullRequestReviewDecision) {

‎packages/contracts/src/pullRequest.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ export type PullRequestActor = typeof PullRequestActor.Type;
8989
export const PullRequestLabel = Schema.Struct({
9090
name: TrimmedNonEmptyString,
9191
color: Schema.NullOr(Schema.String),
92+
description: Schema.optional(Schema.NullOr(Schema.String)),
9293
});
9394
export type PullRequestLabel = typeof PullRequestLabel.Type;
9495

‎packages/source-control-forgejo/src/server/forgejoPullRequestJson.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,11 @@ export function forgejoChangeRequest(pr: typeof ForgejoPullRequest.Type) {
143143
closedAt: pr.closed_at === null ? null : toIsoUtc(pr.closed_at),
144144
mergedAt: pr.merged_at === null ? null : toIsoUtc(pr.merged_at),
145145
reviewRequestLogins: (pr.requested_reviewers ?? []).map((user) => user.login),
146-
labels: (pr.labels ?? []).map((label) => ({ name: label.name, color: label.color ?? null })),
146+
labels: (pr.labels ?? []).map((label) => ({
147+
name: label.name,
148+
color: label.color ?? null,
149+
description: label.description || null,
150+
})),
147151
} satisfies ProviderChangeRequest;
148152
}
149153

‎packages/source-control-github/src/server/GitHubPullRequestApi.test.ts‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ function searchItem(number: number, repository: string, updatedAt: string) {
472472
updatedAt,
473473
repository: { nameWithOwner: repository },
474474
reviewRequests: { nodes: [{ requestedReviewer: { __typename: "User", login: "hubot" } }] },
475-
labels: { nodes: [{ name: "bug", color: "ff0000" }] },
475+
labels: { nodes: [{ name: "bug", color: "ff0000", description: null }] },
476476
};
477477
}
478478

@@ -3354,7 +3354,9 @@ layer("GitHubPullRequestApi.layer", (it) => {
33543354
},
33553355
],
33563356
},
3357-
labels: { nodes: [{ name: "bug", color: "ff0000" }] },
3357+
labels: {
3358+
nodes: [{ name: "bug", color: "ff0000", description: "Something is broken" }],
3359+
},
33583360
commits: {
33593361
nodes: [
33603362
{
@@ -3405,7 +3407,9 @@ layer("GitHubPullRequestApi.layer", (it) => {
34053407
avatarUrl: "https://avatars.githubusercontent.com/t/1",
34063408
},
34073409
]);
3408-
expect(detail.labels).toEqual([{ name: "bug", color: "ff0000" }]);
3410+
expect(detail.labels).toEqual([
3411+
{ name: "bug", color: "ff0000", description: "Something is broken" },
3412+
]);
34093413
expect(detail.checks).toHaveLength(2);
34103414
expect(detail.checksState).toBe("failing");
34113415
}),

‎packages/source-control-github/src/server/gitHubPullRequestJson.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ interface ListItemFields {
106106
interface LabelFields {
107107
readonly name: string;
108108
readonly color?: string | null | undefined;
109+
readonly description?: string | null | undefined;
109110
}
110111

111112
interface ReviewRequestFields {
@@ -508,7 +509,9 @@ function toReviewDecision(value: string | null | undefined): PullRequestReviewDe
508509
function toLabels(raw: ReadonlyArray<LabelFields> | undefined): ReadonlyArray<PullRequestLabel> {
509510
return (raw ?? []).flatMap((label) => {
510511
const name = trimmed(label.name);
511-
return name === null ? [] : [{ name, color: trimmed(label.color) }];
512+
return name === null
513+
? []
514+
: [{ name, color: trimmed(label.color), description: trimmed(label.description) }];
512515
});
513516
}
514517

‎packages/source-control-github/src/server/pullRequestListings.graphql‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ fragment PullRequestRow on PullRequest {
6666
nodes {
6767
name
6868
color
69+
description
6970
}
7071
}
7172
# GitHub's rollup for the head commit, one enum, rather than the whole check list: measured at a

‎packages/source-control-github/src/server/pullRequestListings.graphql.ts‎

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎packages/source-control-github/src/server/pullRequestReads.graphql‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ query PullRequestCore(
144144
nodes {
145145
name
146146
color
147+
description
147148
}
148149
}
149150
commits(last: 1) {

‎packages/source-control-github/src/server/pullRequestReads.graphql.ts‎

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)