11import type { ProjectId , ScopedThreadRef , ThreadPullRequestLink } from "@t3tools/contracts" ;
2- import { detectSourceControlProviderFromRemoteUrl } from "@t3tools/shared/sourceControl" ;
3- import { sourceControlClients } from "@t3tools/client-runtime/source-control-clients" ;
2+ import {
3+ sourceControlClients ,
4+ UNKNOWN_SOURCE_CONTROL_CLIENT ,
5+ } from "@t3tools/client-runtime/source-control-clients" ;
46import {
57 resolveThreadPullRequestChains ,
68 visibleThreadPullRequests ,
@@ -45,6 +47,7 @@ import {
4547 pullRequestChecksStatePresentation ,
4648} from "./pullRequestPresentation" ;
4749import { PullRequestGlyph } from "./pullRequestIcons" ;
50+ import { pullRequestQuickActions } from "./pullRequestList.logic" ;
4851import { PullRequestSpeedActions } from "./PullRequestSpeedActions" ;
4952
5053const SOURCE_LABELS : Record < ThreadPullRequestLink [ "source" ] , string > = {
@@ -105,11 +108,12 @@ function LinkRow({
105108 const snapshot = link . snapshot ;
106109 const open = snapshot === null || snapshot . state === "open" ;
107110 const watching = link . watch !== undefined ;
111+ // A link carries no host summary, so the host's own definition says what it can do.
112+ const linkHostActions = (
113+ sourceControlClients . findByChangeRequestUrl ( link . url ) ?? UNKNOWN_SOURCE_CONTROL_CLIENT
114+ ) . changeRequestActions ;
108115 const actionEntry =
109- projectId !== null &&
110- snapshot !== null &&
111- snapshot . state !== "merged" &&
112- detectSourceControlProviderFromRemoteUrl ( link . url ) ?. kind === "github"
116+ projectId !== null && snapshot !== null && snapshot . state !== "merged"
113117 ? {
114118 environmentId : threadRef . environmentId ,
115119 projectId,
@@ -121,6 +125,9 @@ function LinkRow({
121125 ...( link . stack === null ? { } : { stack : link . stack } ) ,
122126 }
123127 : null ;
128+ // Speed mode swaps the menu for quick actions only where a row has some to offer.
129+ const hasQuickActions =
130+ actionEntry !== null && pullRequestQuickActions ( actionEntry , linkHostActions ) . length > 0 ;
124131 return (
125132 < div
126133 className = { cn ( PULL_REQUEST_ROW_CLASS , "relative hover:bg-accent/60" ) }
@@ -246,7 +253,11 @@ function LinkRow({
246253 />
247254 </ a >
248255 { actionEntry !== null ? (
249- < PullRequestSpeedActions entry = { actionEntry } visible = { speedMode } />
256+ < PullRequestSpeedActions
257+ entry = { actionEntry }
258+ hostActions = { linkHostActions }
259+ visible = { speedMode }
260+ />
250261 ) : null }
251262 { /* Out of the row's flow, so no row reserves a column for a button only the hovered one
252263 shows. It sits over the right end of the second line on the row's own hover color,
@@ -261,7 +272,7 @@ function LinkRow({
261272 "has-[[data-popup-open]]:pointer-events-auto has-[[data-popup-open]]:opacity-100" ,
262273 "has-[:focus-visible]:pointer-events-auto has-[:focus-visible]:opacity-100" ,
263274 "group-has-[[data-pull-request-action-pending=true]]/pr-row:hidden" ,
264- speedMode && actionEntry !== null && "hidden" ,
275+ speedMode && hasQuickActions && "hidden" ,
265276 ) }
266277 >
267278 < span aria-hidden className = "absolute inset-0 bg-accent/60" />
0 commit comments