Skip to content

Commit 19265c5

Browse files
Merge remote-tracking branch 'origin/main' into fix/issue-25962
2 parents 1887066 + f120c51 commit 19265c5

19 files changed

Lines changed: 372 additions & 99 deletions

‎apps/mobile/app.config.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ const config: ExpoConfig = {
425425
["expo-sensors", { motionPermission: false }],
426426
// Mods run in reverse order; expo-widgets must create and wipe the target before assets are added.
427427
...(!isIosPersonalTeamBuild ? ["./plugins/withWidgetLogoAsset.cjs", widgetsPlugin] : []),
428-
"./plugins/withAndroidCleartextTraffic.cjs",
428+
"./plugins/withAndroidNetworkSecurityConfig.cjs",
429429
"./plugins/withAndroidGradleHeap.cjs",
430430
"./plugins/withAndroidInputBackground.cjs",
431431
"./plugins/withAndroidModernPopupMenu.cjs",

‎apps/mobile/modules/t3-native-controls/android/src/main/java/expo/modules/t3nativecontrols/T3WorkspaceNavigationModule.kt‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,11 +320,14 @@ class T3WorkspaceNavigationView(
320320
)
321321
}
322322
}
323+
// Other tabs keep the button's slot so the destinations below never move between tabs.
323324
if (selectedTab == "threads") {
324325
newThreadButton(fraction) {
325326
expanded = false
326327
onNewThread(emptyMap<String, Any>())
327328
}
329+
} else {
330+
Spacer(Modifier.padding(top = 12.dp).height(FAB_SIZE))
328331
}
329332
Spacer(Modifier.weight(1f))
330333
tabs.forEach { tab ->

‎apps/mobile/plugins/withAndroidCleartextTraffic.cjs‎

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
const fs = require("node:fs");
2+
const path = require("node:path");
3+
const { withAndroidManifest, withDangerousMod } = require("expo/config-plugins");
4+
5+
// Environments behind a private CA installed in the user store must work like they do in Chrome.
6+
// Android ignores usesCleartextTraffic once a network security config exists, so permit it here.
7+
const NETWORK_SECURITY_CONFIG = `<?xml version="1.0" encoding="utf-8"?>
8+
<network-security-config>
9+
<base-config cleartextTrafficPermitted="true">
10+
<trust-anchors>
11+
<certificates src="system" />
12+
<certificates src="user" />
13+
</trust-anchors>
14+
</base-config>
15+
</network-security-config>
16+
`;
17+
18+
function withNetworkSecurityConfigManifest(config) {
19+
return withAndroidManifest(config, (nextConfig) => {
20+
const application = nextConfig.modResults.manifest.application?.[0];
21+
22+
if (application == null) {
23+
throw new Error(
24+
"AndroidManifest.xml is missing the application element required for network security configuration.",
25+
);
26+
}
27+
28+
application.$ ??= {};
29+
application.$["android:networkSecurityConfig"] = "@xml/network_security_config";
30+
31+
return nextConfig;
32+
});
33+
}
34+
35+
function withNetworkSecurityConfigResource(config) {
36+
return withDangerousMod(config, [
37+
"android",
38+
async (config) => {
39+
const xmlDir = path.join(
40+
config.modRequest.platformProjectRoot,
41+
"app",
42+
"src",
43+
"main",
44+
"res",
45+
"xml",
46+
);
47+
fs.mkdirSync(xmlDir, { recursive: true });
48+
fs.writeFileSync(path.join(xmlDir, "network_security_config.xml"), NETWORK_SECURITY_CONFIG);
49+
return config;
50+
},
51+
]);
52+
}
53+
54+
module.exports = function withAndroidNetworkSecurityConfig(config) {
55+
return withNetworkSecurityConfigResource(withNetworkSecurityConfigManifest(config));
56+
};

‎apps/mobile/src/components/CompactBrandTitle.tsx‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import { IPAD_HOME_TITLE_OFFSET } from "../lib/layoutMetrics";
1010
import { resolveMobileStageLabel } from "../lib/mobileBranding";
1111
import { useAndroidControlSizing } from "./ui/useAndroidControlSizing";
1212

13+
const BRAND_MAX_FONT_SCALE = 1.4;
14+
1315
export function brandTitleOffset(): number {
1416
if (Platform.OS !== "ios") return 0;
1517
return Platform.isPad && !NATIVE_WORKSPACE_COLUMNS_SUPPORTED ? IPAD_HOME_TITLE_OFFSET : 0;
@@ -49,8 +51,10 @@ export function CompactBrandTitle(
4951
]}
5052
>
5153
<T3Wordmark colorClassName="accent-icon" height={Math.round(15 * scale)} />
54+
{/* A logo beside a fixed-size wordmark: it may grow with Dynamic Type, not crowd the bar. */}
5255
<Text
5356
allowFontScaling={props.allowFontScaling}
57+
maxFontSizeMultiplier={BRAND_MAX_FONT_SCALE}
5458
className="font-t3-medium text-foreground-muted"
5559
style={{ fontSize: 21 * scale, letterSpacing: -0.5 * scale }}
5660
>
@@ -67,6 +71,7 @@ export function CompactBrandTitle(
6771
>
6872
<Text
6973
allowFontScaling={props.allowFontScaling}
74+
maxFontSizeMultiplier={BRAND_MAX_FONT_SCALE}
7075
className="font-t3-bold text-foreground-muted uppercase"
7176
style={{ fontSize: 9 * scale, letterSpacing: 0.9 * scale }}
7277
>

‎apps/mobile/src/features/layout/createWorkspaceStackNavigator.ios.tsx‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,14 @@ function WorkspaceStackView(props: ViewProps & { readonly nativeColumns: boolean
490490
const presentation = props.descriptors[route.key]?.options.presentation;
491491
return presentation !== undefined && presentation !== "card";
492492
});
493+
// The root's willDisappear reaches JS frames into the push, so hide the dock in the commit that
494+
// pushes; the native events still own every later change, including back gestures.
495+
const topDetailKey = projection.detail.at(-1)?.key;
496+
const [pushedDetailKey, setPushedDetailKey] = useState(topDetailKey);
497+
if (pushedDetailKey !== topDetailKey) {
498+
setPushedDetailKey(topDetailKey);
499+
if (topDetailKey !== undefined && primaryVisible) setPrimaryVisible(false);
500+
}
493501
// Detail-only histories must stay single-stack: placeholder descriptors cannot own sidebar actions or setOptions.
494502
const primaryRoute = projection.primary;
495503
if (!primaryRoute) return <V5StackView {...props} />;

‎apps/mobile/src/features/sharing/IncomingShareProvider.tsx‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,11 @@ function getIncomingShareSnapshot() {
229229
}
230230

231231
function reportRefreshFailure(cause: unknown) {
232+
console.warn(
233+
"[incoming-share] refresh failed",
234+
cause,
235+
cause instanceof Error ? cause.cause : null,
236+
);
232237
const error = cause instanceof Error ? cause : new Error("Could not import shared content.");
233238
Dialog.alert("Could not import shared content", error.message, [
234239
{ text: "Dismiss", style: "cancel" },

‎apps/mobile/src/features/workspace/WorkspaceRootScreen.tsx‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function WorkspaceRootTitle(props: {
6262
return (
6363
<View style={{ width: props.maxWidth, minHeight: 32, justifyContent: "center" }}>
6464
<WorkspaceConnectionTitle
65-
brand={<CompactBrandTitle accessibilityLabel={`T3 Code, ${tabTitle}`} />}
65+
brand={<CompactBrandTitle accessibilityLabel={`T3 Code, ${tabTitle}`} fit />}
6666
maxWidth={props.maxWidth}
6767
onPress={props.onOpenEnvironments}
6868
/>
@@ -95,14 +95,15 @@ function WorkspaceRootContent() {
9595
const keyboardHeight = useKeyboardState((keyboard) => keyboard.height);
9696
const workspace = useWorkspaceTabs()!;
9797
const { state } = workspace;
98+
// Settings is a workspace tab too; its list takes the place of the selected tab's.
99+
const settingsOpen = workspace.settingsOpen;
98100
const renderHeaderTitle = () => (
99101
<WorkspaceRootTitle
100-
maxWidth={Math.max(0, width - 160)}
102+
// Settings adds its scope filter beside search.
103+
maxWidth={Math.max(0, width - 160 - (settingsOpen ? 44 : 0))}
101104
onOpenEnvironments={() => openSettings(navigation, "SettingsEnvironments")}
102105
/>
103106
);
104-
// Settings is a workspace tab too; its list takes the place of the selected tab's.
105-
const settingsOpen = workspace.settingsOpen;
106107
const tab = state.tabs[settingsOpen ? "settings" : state.selectedTab];
107108
const bottomClearance =
108109
layout.primarySidebarOverlaysContent && state.selectedTab === "usage"

‎apps/mobile/src/native/EnrichedMarkdownText.tsx‎

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
markdownWithTableBreaks,
1313
} from "../lib/markdownDocument";
1414
import { isValidElement, useMemo, useState, type ReactNode } from "react";
15-
import { Platform, Share, StyleSheet, View } from "react-native";
15+
import { Platform, Share, StyleSheet, useWindowDimensions, View } from "react-native";
1616
import {
1717
EnrichedMarkdownText,
1818
type MarkdownImageBlock,
@@ -35,6 +35,7 @@ import {
3535
function enrichedStyle(
3636
style: SelectableMarkdownTextProps["textStyle"],
3737
dark: boolean,
38+
fontScale: number,
3839
): MarkdownStyle {
3940
const monospace = Platform.OS === "ios" ? "Menlo" : "monospace";
4041
// Keep the radius modest: iOS clips square table-cell borders without stroking the corner arcs.
@@ -132,7 +133,13 @@ function enrichedStyle(
132133
borderWidth: 2,
133134
gapWidth: 12,
134135
},
135-
list: { ...body, bulletColor: style.mutedColor, markerColor: style.mutedColor, gapWidth: 6 },
136+
list: {
137+
...body,
138+
bulletColor: style.mutedColor,
139+
markerColor: style.mutedColor,
140+
// The bullet is centred on the gap's edge and scales with the system text size; the gap must too.
141+
gapWidth: 12 * fontScale,
142+
},
136143
thematicBreak: { color: style.dividerColor, height: 1, marginTop: 8, marginBottom: 8 },
137144
table: {
138145
...body,
@@ -256,9 +263,13 @@ export function MobileEnrichedMarkdownText(props: SelectableMarkdownTextProps) {
256263
mimeTypes: { "app.t3.context-fragment": props.contextClipboardFragment! },
257264
};
258265
}, [props.contextClipboardFragment, props.markdown]);
266+
const { fontScale } = useWindowDimensions();
259267
const markdownStyle = useMemo(
260-
() => ({ ...enrichedStyle(props.textStyle, themeAppearance === "dark"), linkVariants }),
261-
[props.textStyle, themeAppearance, linkVariants],
268+
() => ({
269+
...enrichedStyle(props.textStyle, themeAppearance === "dark", fontScale),
270+
linkVariants,
271+
}),
272+
[props.textStyle, themeAppearance, fontScale, linkVariants],
262273
);
263274
const renderers = renderImage
264275
? {

‎apps/web/src/components/chat/ThreadServersPanel.tsx‎

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ import {
1111
squashAtomCommandFailure,
1212
} from "@t3tools/client-runtime/state/runtime";
1313
import { GlobeIcon, LoaderCircleIcon, SquareIcon } from "lucide-react";
14-
import { useState } from "react";
14+
import { type MouseEvent, useState } from "react";
1515

16-
import { cn } from "../../lib/utils";
16+
import { resolveDiscoveredServerUrl } from "../../browser/browserTargetResolver";
17+
import { readLocalApi } from "../../localApi";
18+
import { cn, isMacPlatform } from "../../lib/utils";
1719
import { useThreadDiscoveredPorts } from "../../portDiscoveryState";
1820
import { useEnvironment } from "../../state/environments";
1921
import { previewEnvironment } from "../../state/preview";
@@ -48,6 +50,7 @@ export function ThreadServersPanel(props: {
4850
const [stoppingKey, setStoppingKey] = useState<string | null>(null);
4951

5052
if (servers.length === 0) return null;
53+
const externalClickLabel = isMacPlatform(navigator.platform) ? "⌘-click" : "Ctrl-click";
5154
const threadRef = scopeThreadRef(props.environmentId, props.threadId);
5255

5356
const reportFailure = (title: string, error: unknown) => {
@@ -60,7 +63,17 @@ export function ThreadServersPanel(props: {
6063
);
6164
};
6265

63-
const open = async (server: DiscoveredLocalServer) => {
66+
const open = async (server: DiscoveredLocalServer, event: MouseEvent<HTMLElement>) => {
67+
if (event.button > 1) return;
68+
// Like links: modified and middle clicks go to the system browser.
69+
if (event.metaKey || event.ctrlKey || event.button === 1) {
70+
event.preventDefault();
71+
const url = resolveDiscoveredServerUrl(props.environmentId, server.url);
72+
await readLocalApi()
73+
?.shell.openExternal(url)
74+
.catch((error: unknown) => reportFailure("Unable to open in browser", error));
75+
return;
76+
}
6477
const result = await openDiscoveredPort({ threadRef, port: server, openPreview });
6578
if (result._tag === "Failure" && !isAtomCommandInterrupted(result)) {
6679
reportFailure("Unable to open preview", squashAtomCommandFailure(result));
@@ -87,7 +100,7 @@ export function ThreadServersPanel(props: {
87100
const key = serverKey(server);
88101
const stoppable = canStop && supportsStop && server.pid !== null;
89102
return (
90-
<li key={key} className="group relative flex h-8 items-center rounded-lg">
103+
<li key={key} className="group relative flex items-center rounded-lg">
91104
<Tooltip>
92105
<TooltipTrigger
93106
delay={200}
@@ -96,29 +109,29 @@ export function ThreadServersPanel(props: {
96109
size="sm"
97110
variant="ghost"
98111
part="row"
112+
multiline
99113
disabled={!canOpen}
100-
onClick={() => void open(server)}
114+
onClick={(event) => void open(server, event)}
115+
onAuxClick={(event) => void open(server, event)}
101116
/>
102117
}
103118
>
104119
<GlobeIcon aria-hidden className={THREAD_DETAILS_PANEL_ICON_CLASS} />
105-
<span className="shrink-0 text-sm font-medium leading-4 text-foreground/85">
106-
localhost:{server.port}
107-
</span>
108-
{/* The stop button covers this while it shows. */}
109-
<span
110-
className={cn(
111-
"ms-auto min-w-0 truncate text-2xs font-normal text-muted-foreground",
112-
stoppable &&
113-
"group-hover:opacity-0 group-focus-within:opacity-0 pointer-coarse:opacity-0 [@media(hover:none)]:opacity-0",
114-
)}
115-
>
116-
{[server.terminal === null ? "Agent" : "Terminal", server.processName]
117-
.filter(Boolean)
118-
.join(" · ")}
120+
{/* The end padding keeps text clear of the stop button. */}
121+
<span className={cn("flex min-w-0 flex-1 flex-col gap-0.5", stoppable && "pe-6")}>
122+
<span className="truncate text-sm font-medium leading-4 text-foreground/85">
123+
localhost:{server.port}
124+
</span>
125+
<span className="truncate text-2xs font-normal leading-4 text-muted-foreground">
126+
{[server.terminal === null ? "Agent" : "Terminal", server.processName]
127+
.filter(Boolean)
128+
.join(" · ")}
129+
</span>
119130
</span>
120131
</TooltipTrigger>
121-
<TooltipPopup side="left">Open in the browser panel</TooltipPopup>
132+
<TooltipPopup side="left">
133+
Open in the browser panel. {externalClickLabel} for your browser.
134+
</TooltipPopup>
122135
</Tooltip>
123136
{stoppable ? (
124137
<div className="pointer-events-none absolute right-1 top-1/2 -translate-y-1/2 opacity-0 group-hover:pointer-events-auto group-hover:opacity-100 group-focus-within:pointer-events-auto group-focus-within:opacity-100 pointer-coarse:pointer-events-auto pointer-coarse:opacity-100 [@media(hover:none)]:pointer-events-auto [@media(hover:none)]:opacity-100">

0 commit comments

Comments
 (0)