@devries-cameron20 / t3code Mirror · read-only / commits / cd34df59a1
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 23, 13:00 UTC

feat(web): setting to open pull request links on GitHub (#19719)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Theo Browne committed Oct 15, 2026 at 03:19 UTC cd34df59a1ba7eb48318549d628b5ec7c9b759c5
7 files changed +57 -2
apps/web/src/components/settings/IntegrationsSettings.tsx
+30
@@ -622,6 +622,35 @@ function BrowserLinkTargetSetting({ disabled }: { readonly disabled: boolean })
622 );
623 }
624
625 +function PullRequestLinksOpenInAppSetting() {
626 + const openInApp = useClientSettings((settings) => settings.pullRequestLinksOpenInApp);
627 + const updateSettings = useUpdatePrimarySettings();
628 +
629 + return (
630 + <SettingsRow
631 + {...searchableSetting("pull-request-links-open-in-app")}
632 + description="Clicking a pull request link opens it in T3 Code. Turn off to open pull request links like any other link, on GitHub or your git host."
633 + resetAction={
634 + openInApp ? null : (
635 + <SettingResetButton
636 + label="open pull requests in T3 Code"
637 + onClick={() => updateSettings({ pullRequestLinksOpenInApp: true })}
638 + />
639 + )
640 + }
641 + control={
642 + <Switch
643 + checked={openInApp}
644 + onCheckedChange={(checked) =>
645 + updateSettings({ pullRequestLinksOpenInApp: Boolean(checked) })
646 + }
647 + aria-label="Open pull requests in T3 Code"
648 + />
649 + }
650 + />
651 + );
652 +}
653 +
654 function DeviceIntegrationSettings() {
655 const { search, environment: selected } = useSettingsScope();
656 const settings = useScopedSettings();
@@ -1545,6 +1574,7 @@ export function IntegrationsSettingsPanel() {
1574 ) : (
1575 previewDefaults
1576 )}
1577 + <PullRequestLinksOpenInAppSetting />
1578 </SettingsSection>
1579 <DeviceIntegrationSettings />
1580 </SettingsPageContainer>
apps/web/src/components/settings/SettingsPanels.logic.test.ts
+2
@@ -242,6 +242,7 @@ describe("getChangedBrowserSettingLabels", () => {
242 browserRecordingShowMousePresses: true,
243 browserLinkTarget: "app",
244 browserAutoShowFloatingPreview: !DEFAULT_UNIFIED_SETTINGS.browserAutoShowFloatingPreview,
245 + pullRequestLinksOpenInApp: false,
246 }),
247 ).toEqual([
248 "Browser viewport",
@@ -252,6 +253,7 @@ describe("getChangedBrowserSettingLabels", () => {
253 "Recording mouse presses",
254 "Open links in",
255 "Floating preview",
256 + "Open pull requests in T3 Code",
257 ]);
258 });
259 });
apps/web/src/components/settings/SettingsPanels.logic.ts
+4
@@ -118,6 +118,7 @@ export type BrowserDefaultSettings = Pick<
118 | "browserRecordingShowMousePresses"
119 | "browserLinkTarget"
120 | "browserAutoShowFloatingPreview"
121 + | "pullRequestLinksOpenInApp"
122 >;
123
124 /**
@@ -166,6 +167,9 @@ export function getChangedBrowserSettingLabels(settings: BrowserDefaultSettings)
167 DEFAULT_UNIFIED_SETTINGS.browserAutoShowFloatingPreview
168 ? ["Floating preview"]
169 : []),
170 + ...(settings.pullRequestLinksOpenInApp !== DEFAULT_UNIFIED_SETTINGS.pullRequestLinksOpenInApp
171 + ? ["Open pull requests in T3 Code"]
172 + : []),
173 ];
174 }
175
apps/web/src/components/settings/SettingsPanels.tsx
+2
@@ -676,6 +676,7 @@ export function useSettingsRestore(onRestored?: () => void) {
676 settings.browserRecordingShowMousePresses,
677 settings.browserLinkTarget,
678 settings.browserAutoShowFloatingPreview,
679 + settings.pullRequestLinksOpenInApp,
680 settings.appearanceContrast,
681 settings.diffColorScheme,
682 settings.chatWidth,
@@ -855,6 +856,7 @@ export function useSettingsRestore(onRestored?: () => void) {
856 browserRecordingShowMousePresses: DEFAULT_UNIFIED_SETTINGS.browserRecordingShowMousePresses,
857 browserLinkTarget: DEFAULT_UNIFIED_SETTINGS.browserLinkTarget,
858 browserAutoShowFloatingPreview: DEFAULT_UNIFIED_SETTINGS.browserAutoShowFloatingPreview,
859 + pullRequestLinksOpenInApp: DEFAULT_UNIFIED_SETTINGS.pullRequestLinksOpenInApp,
860 // Re-granted like any other default. The confirmation dialog lists it by
861 // name, so a user restoring defaults is told the agent regains access
862 // rather than discovering it later.
apps/web/src/components/settings/settingsSearch.ts
+6
@@ -778,6 +778,12 @@ export const SETTINGS_SEARCH_ITEMS = [
778 to: "/settings/integrations",
779 searchTerms: ["links default browser in-app browser external open"],
780 },
781 + {
782 + id: "pull-request-links-open-in-app",
783 + title: "Open pull requests in T3 Code",
784 + to: "/settings/integrations",
785 + searchTerms: ["pr links github browser external click default pull request view panel"],
786 + },
787 {
788 id: "browser-auto-show-floating-preview",
789 title: "Auto-show floating preview",
apps/web/src/lib/openPullRequestLink.ts
+6 -2
@@ -8,6 +8,7 @@ import { parseChangeRequestUrl, type ChangeRequestLink } from "@t3tools/shared/c
8 import { sourceControlRepositorySelector } from "@t3tools/shared/sourceControl";
9
10 import { useOpenLink } from "../browser/useOpenLink";
11 +import { useClientSettings } from "../hooks/useSettings";
12 import { stackedThreadToast, toastManager } from "../components/ui/toast";
13 import { useRightPanelStore } from "../rightPanelStore";
14 import type { EnvironmentProject } from "@t3tools/client-runtime/state/shell";
@@ -122,6 +123,8 @@ export function findProjectOnChangeRequestHost(
123 * the pull requests page: a reader following a link the agent wrote is reading the thread, and
124 * should still be reading it afterwards. Any change request opens there, not only the thread's
125 * own, since the panel is told which one to show.
126 + *
127 + * With "Open pull requests in T3 Code" turned off, every link is left alone.
128 */
129 export function shouldOpenPullRequestExternally(
130 event: Pick<MouseEvent<HTMLElement>, "metaKey" | "ctrlKey">,
@@ -145,9 +148,10 @@ export function useOpenChangeRequestLink(
148 const allProjects = useProjects();
149 const serverConfigs = useServerConfigs();
150 const primaryEnvironmentId = usePrimaryEnvironmentId();
151 + const openInApp = useClientSettings((settings) => settings.pullRequestLinksOpenInApp);
152 return useCallback(
153 (event, targetUrl, targetThreadRef, targetEnvironmentId) => {
150 - if (shouldOpenPullRequestExternally(event)) return false;
154 + if (!openInApp || shouldOpenPullRequestExternally(event)) return false;
155 const resolvedThreadRef = targetThreadRef ?? threadRef;
156 const resolvedPanelRef = panelRef ?? resolvedThreadRef;
157 const parsed = parseChangeRequestUrl(targetUrl);
@@ -243,7 +247,7 @@ export function useOpenChangeRequestLink(
247 });
248 return true;
249 },
246 - [allProjects, navigate, panelRef, primaryEnvironmentId, serverConfigs, threadRef],
250 + [allProjects, navigate, openInApp, panelRef, primaryEnvironmentId, serverConfigs, threadRef],
251 );
252 }
253
packages/contracts/src/settings.ts
+7
@@ -441,6 +441,12 @@ export const ClientSettingsSchema = Schema.Struct({
441 TrimmedNonEmptyString,
442 PullRequestMergeMethod,
443 ).pipe(Schema.withDecodingDefault(Effect.succeed({}))),
444 + /**
445 + * Whether clicking a pull request link opens T3 Code's pull request view.
446 + * When false, pull request links open like any other link, so they reach
447 + * GitHub or the repository's other host.
448 + */
449 + pullRequestLinksOpenInApp: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
450 // Legacy plan mode. The composer's Build/Plan toggle was removed from the
451 // default UI; this beta flag restores it (plus the /plan and /default slash
452 // commands) for users who still rely on the old workflow.
@@ -1742,6 +1748,7 @@ export const ClientSettingsPatch = Schema.Struct({
1748 pullRequestMergeMethodOverrides: Schema.optionalKey(
1749 Schema.Record(TrimmedNonEmptyString, PullRequestMergeMethod),
1750 ),
1751 + pullRequestLinksOpenInApp: Schema.optionalKey(Schema.Boolean),
1752 planModeEnabled: Schema.optionalKey(Schema.Boolean),
1753 contextWindowMeterEnabled: Schema.optionalKey(Schema.Boolean),
1754 composerCollapseOnScroll: Schema.optionalKey(Schema.Boolean),