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