@@ -16,7 +16,7 @@ import {
1616} from "@t3tools/shared/threadPullRequests" ;
1717import { FolderGit2Icon , TerminalIcon } from "lucide-react" ;
1818import { useMemo , type MouseEvent } from "react" ;
19- import { buttonVariants , InlineButton } from "./ui/button" ;
19+ import { Button , InlineButton } from "./ui/button" ;
2020import { cn } from "../lib/utils" ;
2121import { useEnvironment , usePrimaryEnvironmentId } from "../state/environments" ;
2222import { EnvironmentMachineIcon } from "./EnvironmentMachineIcon" ;
@@ -207,50 +207,52 @@ export function ThreadPullRequestBadgeControl({
207207 url ?: string | undefined ;
208208 status : PrStatusIndicator | null ;
209209 onOpenStack : ( ) => void ;
210- onOpenPullRequest : ( event : MouseEvent < HTMLAnchorElement > ) => void ;
210+ onOpenPullRequest : ( event : MouseEvent < HTMLElement > ) => void ;
211211} ) {
212212 const presentation = resolveThreadPullRequestBadgePresentation ( { badge, number, url, status } ) ;
213213 if ( presentation === null ) return null ;
214214 const isStack = badge ?. kind === "stack" ;
215- const className = cn (
216- variant === "ghost"
217- ? buttonVariants ( { variant : "ghost" , size : "xs" } )
218- : "inline-flex shrink-0 cursor-pointer items-center gap-0.5 whitespace-nowrap border-b border-transparent hover:border-current focus-visible:outline-2 focus-visible:outline-ring" ,
219- "text-xs tabular-nums" ,
220- variant === "ghost" &&
221- "font-normal text-xs! active:scale-100 [--control-icon-color:currentColor]" ,
222- presentation . toneClassName ,
223- ) ;
224215 const content = (
225216 < >
226217 < presentation . Icon aria-hidden className = "size-3 shrink-0" />
227218 { presentation . text }
228219 </ >
229220 ) ;
221+ const linkProps = isStack
222+ ? {
223+ onClick : ( event : MouseEvent < HTMLElement > ) => {
224+ event . preventDefault ( ) ;
225+ event . stopPropagation ( ) ;
226+ onOpenStack ( ) ;
227+ } ,
228+ }
229+ : { onClick : onOpenPullRequest } ;
230+ const element = isStack ? (
231+ < button type = "button" />
232+ ) : (
233+ < a href = { url } target = "_blank" rel = "noopener noreferrer" />
234+ ) ;
230235 return (
231236 < Tooltip >
232237 < TooltipTrigger
233238 render = {
234- isStack ? (
235- < InlineButton
236- className = { className }
239+ variant === "ghost" ? (
240+ < Button
241+ render = { element }
242+ variant = "ghost"
243+ size = "xs"
244+ className = { presentation . toneClassName }
237245 aria-label = { presentation . label }
238246 onPointerDown = { ( event ) => event . stopPropagation ( ) }
239- onClick = { ( event ) => {
240- event . preventDefault ( ) ;
241- event . stopPropagation ( ) ;
242- onOpenStack ( ) ;
243- } }
247+ { ...linkProps }
244248 />
245249 ) : (
246- < a
247- href = { url }
248- target = "_blank"
249- rel = "noopener noreferrer"
250- className = { className }
250+ < InlineButton
251+ render = { element }
252+ className = { presentation . toneClassName }
251253 aria-label = { presentation . label }
252254 onPointerDown = { ( event ) => event . stopPropagation ( ) }
253- onClick = { onOpenPullRequest }
255+ { ... linkProps }
254256 />
255257 )
256258 }
0 commit comments