11import { GitPullRequestIcon , GitCommitIcon , GitBranchIcon } from "lucide-react" ;
22import { type GitMetaLinks } from "~/presenters/v3/BranchesPresenter.server" ;
33import { LinkButton } from "./primitives/Buttons" ;
4+ import { SimpleTooltip } from "./primitives/Tooltip" ;
45
56export function GitMetadata ( { git } : { git ?: GitMetaLinks | null } ) {
67 if ( ! git ) return null ;
78 return (
89 < >
9- { git . branchUrl && < GitMetadataBranch git = { git } /> }
10- { git . shortSha && < GitMetadataCommit git = { git } /> }
1110 { git . pullRequestUrl && git . pullRequestNumber && < GitMetadataPullRequest git = { git } /> }
11+ { git . shortSha && < GitMetadataCommit git = { git } /> }
12+ { git . branchUrl && < GitMetadataBranch git = { git } /> }
1213 </ >
1314 ) ;
1415}
@@ -19,15 +20,20 @@ export function GitMetadataBranch({
1920 git : Pick < GitMetaLinks , "branchUrl" | "branchName" > ;
2021} ) {
2122 return (
22- < LinkButton
23- variant = "minimal/small"
24- LeadingIcon = { < GitBranchIcon className = "size-4" /> }
25- iconSpacing = "gap-x-1"
26- to = { git . branchUrl }
27- className = "pl-1"
28- >
29- { git . branchName }
30- </ LinkButton >
23+ < SimpleTooltip
24+ button = {
25+ < LinkButton
26+ variant = "minimal/small"
27+ LeadingIcon = { < GitBranchIcon className = "size-4" /> }
28+ iconSpacing = "gap-x-1"
29+ to = { git . branchUrl }
30+ className = "pl-1"
31+ >
32+ { git . branchName }
33+ </ LinkButton >
34+ }
35+ content = "Jump to GitHub branch"
36+ />
3137 ) ;
3238}
3339
@@ -37,34 +43,44 @@ export function GitMetadataCommit({
3743 git : Pick < GitMetaLinks , "commitUrl" | "shortSha" | "commitMessage" > ;
3844} ) {
3945 return (
40- < LinkButton
41- variant = "minimal/small"
42- to = { git . commitUrl }
43- LeadingIcon = { < GitCommitIcon className = "size-4" /> }
44- iconSpacing = "gap-x-1"
45- className = "pl-1"
46- >
47- { `${ git . shortSha } / ${ git . commitMessage } ` }
48- </ LinkButton >
46+ < SimpleTooltip
47+ button = {
48+ < LinkButton
49+ variant = "minimal/small"
50+ to = { git . commitUrl }
51+ LeadingIcon = { < GitCommitIcon className = "size-4" /> }
52+ iconSpacing = "gap-x-1"
53+ className = "pl-1"
54+ >
55+ { `${ git . shortSha } / ${ git . commitMessage } ` }
56+ </ LinkButton >
57+ }
58+ content = "Jump to GitHub commit"
59+ />
4960 ) ;
5061}
5162
5263export function GitMetadataPullRequest ( {
5364 git,
5465} : {
55- git : Pick < GitMetaLinks , "pullRequestUrl" | "pullRequestNumber" > ;
66+ git : Pick < GitMetaLinks , "pullRequestUrl" | "pullRequestNumber" | "pullRequestTitle" > ;
5667} ) {
5768 if ( ! git . pullRequestUrl || ! git . pullRequestNumber ) return null ;
5869
5970 return (
60- < LinkButton
61- variant = "minimal/small"
62- to = { git . pullRequestUrl }
63- LeadingIcon = { < GitPullRequestIcon className = "size-4" /> }
64- iconSpacing = "gap-x-1"
65- className = "pl-1"
66- >
67- #{ git . pullRequestNumber }
68- </ LinkButton >
71+ < SimpleTooltip
72+ button = {
73+ < LinkButton
74+ variant = "minimal/small"
75+ to = { git . pullRequestUrl }
76+ LeadingIcon = { < GitPullRequestIcon className = "size-4" /> }
77+ iconSpacing = "gap-x-1"
78+ className = "pl-1"
79+ >
80+ #{ git . pullRequestNumber } { git . pullRequestTitle }
81+ </ LinkButton >
82+ }
83+ content = "Jump to GitHub pull request"
84+ />
6985 ) ;
7086}
0 commit comments