Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions apps/web/src/components/GitActionsControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,15 @@ import type {
} from "@t3tools/contracts";
import { useNavigate } from "@tanstack/react-router";
import * as Option from "effect/Option";
import { useCallback, useEffect, useEffectEvent, useMemo, useRef, useState } from "react";
import {
type MouseEvent,
useCallback,
useEffect,
useEffectEvent,
useMemo,
useRef,
useState,
} from "react";
import { flushSync } from "react-dom";
import {
CheckIcon,
Expand Down Expand Up @@ -91,7 +99,11 @@ import { resolvePathLinkTarget } from "~/terminal-links";
import { type DraftId, useComposerDraftStore } from "~/composerDraftStore";
import { readLocalApi } from "~/localApi";
import { getSourceControlPresentation } from "~/sourceControlPresentation";
import { openPullRequestLink } from "~/lib/openPullRequestLink";
import {
openPullRequestLink,
parseChangeRequestUrl,
shouldOpenPullRequestExternally,
} from "~/lib/openPullRequestLink";

interface GitActionsControlProps {
gitCwd: string | null;
Expand Down Expand Up @@ -1442,7 +1454,7 @@ export default function GitActionsControl({
const toastCta = actionResult.toast.cta;
let toastActionProps: {
children: string;
onClick: () => void;
onClick: (event: MouseEvent<HTMLButtonElement>) => void;
} | null = null;
if (toastCta.kind === "run_action") {
toastActionProps = {
Expand All @@ -1455,9 +1467,19 @@ export default function GitActionsControl({
},
};
} else if (toastCta.kind === "open_pr") {
const pullRequestNumber = parseChangeRequestUrl(toastCta.url)?.number;
Comment thread
eimexdev marked this conversation as resolved.
Outdated
toastActionProps = {
children: toastCta.label,
onClick: () => {
onClick: (event) => {
if (
pullRequestNumber !== undefined &&
onOpenPullRequest &&
!shouldOpenPullRequestExternally(event)
) {
closeResultToast();
onOpenPullRequest(pullRequestNumber);
Comment thread
cursor[bot] marked this conversation as resolved.
Outdated
return;
}
const api = readLocalApi();
if (!api) return;
closeResultToast();
Expand Down
Loading