| ... | ... | @@ -17,7 +17,15 @@ import type { |
| 17 | 17 | } from "@t3tools/contracts"; |
| 18 | 18 | import { useNavigate } from "@tanstack/react-router"; |
| 19 | 19 | import * as Option from "effect/Option"; |
| 20 | | import { useCallback, useEffect, useEffectEvent, useMemo, useRef, useState } from "react"; |
| 20 | import { |
| 21 | type MouseEvent, |
| 22 | useCallback, |
| 23 | useEffect, |
| 24 | useEffectEvent, |
| 25 | useMemo, |
| 26 | useRef, |
| 27 | useState, |
| 28 | } from "react"; |
| 21 | 29 | import { flushSync } from "react-dom"; |
| 22 | 30 | import { |
| 23 | 31 | CheckIcon, |
| ... | ... | @@ -91,7 +99,7 @@ import { resolvePathLinkTarget } from "~/terminal-links"; |
| 91 | 99 | import { type DraftId, useComposerDraftStore } from "~/composerDraftStore"; |
| 92 | 100 | import { readLocalApi } from "~/localApi"; |
| 93 | 101 | import { getSourceControlPresentation } from "~/sourceControlPresentation"; |
| 94 | | import { openPullRequestLink } from "~/lib/openPullRequestLink"; |
| 102 | import { openPullRequestLink, useOpenPrLink } from "~/lib/openPullRequestLink"; |
| 95 | 103 | |
| 96 | 104 | interface GitActionsControlProps { |
| 97 | 105 | gitCwd: string | null; |
| ... | ... | @@ -995,6 +1003,7 @@ export default function GitActionsControl({ |
| 995 | 1003 | () => (activeThreadRef ? { threadRef: activeThreadRef } : undefined), |
| 996 | 1004 | [activeThreadRef], |
| 997 | 1005 | ); |
| 1006 | const openPrLink = useOpenPrLink(activeThreadRef ?? undefined); |
| 998 | 1007 | const activeDraftThread = useComposerDraftStore((store) => |
| 999 | 1008 | draftId |
| 1000 | 1009 | ? store.getDraftSession(draftId) |
| ... | ... | @@ -1442,7 +1451,7 @@ export default function GitActionsControl({ |
| 1442 | 1451 | const toastCta = actionResult.toast.cta; |
| 1443 | 1452 | let toastActionProps: { |
| 1444 | 1453 | children: string; |
| 1445 | | onClick: () => void; |
| 1454 | onClick: (event: MouseEvent<HTMLButtonElement>) => void; |
| 1446 | 1455 | } | null = null; |
| 1447 | 1456 | if (toastCta.kind === "run_action") { |
| 1448 | 1457 | toastActionProps = { |
| ... | ... | @@ -1457,11 +1466,9 @@ export default function GitActionsControl({ |
| 1457 | 1466 | } else if (toastCta.kind === "open_pr") { |
| 1458 | 1467 | toastActionProps = { |
| 1459 | 1468 | children: toastCta.label, |
| 1460 | | onClick: () => { |
| 1461 | | const api = readLocalApi(); |
| 1462 | | if (!api) return; |
| 1469 | onClick: (event) => { |
| 1463 | 1470 | closeResultToast(); |
| 1464 | | void api.shell.openExternal(toastCta.url); |
| 1471 | openPrLink(event, toastCta.url); |
| 1465 | 1472 | }, |
| 1466 | 1473 | }; |
| 1467 | 1474 | } |