Skip to content

Commit 2805b2d

Browse files
committed
Merge upstream/main into feat/question-answer-toggle
2 parents 30fca7e + 6a6ebb2 commit 2805b2d

629 files changed

Lines changed: 34396 additions & 33737 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/ci.yml‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,31 @@ jobs:
268268
- name: Setup Vite+
269269
uses: ./.github/actions/setup-ci-deps
270270

271+
# The browser project runs React tests in headless Chromium. Same cache key as
272+
# test_server, so both jobs share one downloaded browser.
273+
- name: Resolve Playwright version
274+
id: playwright_version
275+
run: echo "version=$(node -p "require('./apps/web/node_modules/playwright/package.json').version")" >> "$GITHUB_OUTPUT"
276+
277+
- name: Cache Chromium
278+
id: chromium_cache
279+
uses: actions/cache@v6
280+
with:
281+
path: ~/.cache/ms-playwright
282+
key: playwright-chromium-shell-${{ runner.os }}-${{ runner.arch }}-${{ steps.playwright_version.outputs.version }}
283+
284+
- name: Install Chromium for web browser tests
285+
if: steps.chromium_cache.outputs.cache-hit != 'true'
286+
run: node apps/web/node_modules/playwright/cli.js install --only-shell chromium
287+
288+
- name: Install missing Chromium system dependencies
289+
run: |
290+
browser=$(find "$HOME/.cache/ms-playwright" -name chrome-headless-shell -type f -print -quit)
291+
test -n "$browser"
292+
if ldd "$browser" | grep '=> not found'; then
293+
node apps/web/node_modules/playwright/cli.js install-deps chromium
294+
fi
295+
271296
- name: Test
272297
run: vp run --filter @t3tools/web test
273298

‎.github/workflows/release.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,10 @@ jobs:
297297
sudo sed -i 's|http://|https://|g' /etc/apt/blacksmith-ubuntu-mirrors.txt /etc/apt/sources.list.d/ubuntu.sources
298298
sudo apt-get update && sudo apt-get install -y libsecret-1-dev pkg-config build-essential
299299
300+
# The web package's browser project runs React tests in headless Chromium.
301+
- name: Install Chromium for web browser tests
302+
run: node apps/web/node_modules/playwright/cli.js install --with-deps --only-shell chromium
303+
300304
- name: Test
301305
run: vp run --parallel --concurrency-limit 4 --filter '!t3' --filter '!@t3tools/monorepo' test
302306

‎apps/mobile/app.config.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,10 @@ const config: ExpoConfig = {
489489
},
490490
},
491491
owner: "pingdotgg",
492+
experiments: {
493+
// Metro only runs babel-plugin-react-compiler when this is set; see src/reactCompilerCoverage.test.ts.
494+
reactCompiler: true,
495+
},
492496
};
493497

494498
export default config;

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

Lines changed: 24 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,12 @@ package expo.modules.t3nativecontrols
33
import android.content.Context
44
import android.view.ViewGroup
55
import androidx.compose.foundation.layout.WindowInsets
6-
import androidx.compose.foundation.layout.Spacer
76
import androidx.compose.foundation.layout.fillMaxSize
87
import androidx.compose.material3.Icon
98
import androidx.compose.material3.MaterialTheme
109
import androidx.compose.material3.NavigationBar
1110
import androidx.compose.material3.NavigationBarItem
1211
import androidx.compose.material3.NavigationBarItemDefaults
13-
import androidx.compose.material3.NavigationRail
14-
import androidx.compose.material3.NavigationRailItem
15-
import androidx.compose.material3.NavigationRailItemDefaults
1612
import androidx.compose.material3.Text
1713
import androidx.compose.material3.darkColorScheme
1814
import androidx.compose.material3.lightColorScheme
@@ -39,7 +35,6 @@ class T3WorkspaceNavigationModule : Module() {
3935
Prop("selectedTab") { view: T3WorkspaceNavigationView, value: String ->
4036
view.selectedTab = value
4137
}
42-
Prop("rail") { view: T3WorkspaceNavigationView, value: Boolean -> view.rail = value }
4338
Prop("dark") { view: T3WorkspaceNavigationView, value: Boolean -> view.dark = value }
4439
Prop("textScale") { view: T3WorkspaceNavigationView, value: Float -> view.textScale = value }
4540
Prop("containerColor") { view: T3WorkspaceNavigationView, value: Int ->
@@ -59,7 +54,7 @@ class T3WorkspaceNavigationModule : Module() {
5954
}
6055
}
6156

62-
/** One Material3 selection surface moves from below the list to its leading edge. */
57+
/** Material3 bottom navigation for the compact workspace. */
6358
class T3WorkspaceNavigationView(
6459
context: Context,
6560
appContext: AppContext
@@ -69,7 +64,6 @@ class T3WorkspaceNavigationView(
6964

7065
private val onTabSelected by EventDispatcher()
7166
var selectedTab by mutableStateOf("threads")
72-
var rail by mutableStateOf(false)
7367
var dark by mutableStateOf(false)
7468
var textScale by mutableStateOf(1f)
7569
var containerColor by mutableStateOf(0)
@@ -108,58 +102,29 @@ class T3WorkspaceNavigationView(
108102
setContent {
109103
MaterialTheme(colorScheme = if (dark) darkColorScheme() else lightColorScheme()) {
110104
val tabs = listOf("threads", "pullRequests")
111-
if (rail) {
112-
NavigationRail(
113-
modifier = Modifier.fillMaxSize(),
114-
containerColor = Color(containerColor),
115-
windowInsets = WindowInsets(0),
116-
) {
117-
Spacer(Modifier.weight(1f))
118-
tabs.forEach { tab ->
119-
NavigationRailItem(
120-
selected = selectedTab == tab,
121-
onClick = { onTabSelected(mapOf("tab" to tab)) },
122-
icon = { tabIcon(tab) },
123-
label = {
124-
val title = if (tab == "threads") "Chats" else "PRs"
125-
Text(title, fontSize = (12 * textScale).sp)
126-
},
127-
colors = NavigationRailItemDefaults.colors(
128-
selectedIconColor = Color(selectedColor),
129-
selectedTextColor = Color(selectedColor),
130-
indicatorColor = Color(indicatorColor),
131-
unselectedIconColor = Color(unselectedColor),
132-
unselectedTextColor = Color(unselectedColor),
133-
),
134-
)
135-
}
136-
Spacer(Modifier.weight(1f))
137-
}
138-
} else {
139-
NavigationBar(
140-
modifier = Modifier.fillMaxSize(),
141-
containerColor = Color(containerColor),
142-
tonalElevation = androidx.compose.ui.unit.Dp(0f),
143-
windowInsets = WindowInsets(0),
144-
) {
145-
tabs.forEach { tab ->
146-
NavigationBarItem(
147-
selected = selectedTab == tab,
148-
onClick = { onTabSelected(mapOf("tab" to tab)) },
149-
icon = { tabIcon(tab) },
150-
label = {
151-
val title = if (tab == "threads") "Chats" else "Pull requests"
152-
Text(title, fontSize = (12 * textScale).sp)
153-
},
154-
colors = NavigationBarItemDefaults.colors(
155-
selectedIconColor = Color(selectedColor),
156-
selectedTextColor = Color(selectedColor),
157-
indicatorColor = Color(indicatorColor),
158-
unselectedIconColor = Color(unselectedColor),
159-
unselectedTextColor = Color(unselectedColor),
160-
),
161-
)
162-
}
105+
NavigationBar(
106+
modifier = Modifier.fillMaxSize(),
107+
containerColor = Color(containerColor),
108+
tonalElevation = androidx.compose.ui.unit.Dp(0f),
109+
windowInsets = WindowInsets(0),
110+
) {
111+
tabs.forEach { tab ->
112+
NavigationBarItem(
113+
selected = selectedTab == tab,
114+
onClick = { onTabSelected(mapOf("tab" to tab)) },
115+
icon = { tabIcon(tab) },
116+
label = {
117+
val title = if (tab == "threads") "Chats" else "Pull requests"
118+
Text(title, fontSize = (12 * textScale).sp)
119+
},
120+
colors = NavigationBarItemDefaults.colors(
121+
selectedIconColor = Color(selectedColor),
122+
selectedTextColor = Color(selectedColor),
123+
indicatorColor = Color(indicatorColor),
124+
unselectedIconColor = Color(unselectedColor),
125+
unselectedTextColor = Color(unselectedColor),
126+
),
127+
)
163128
}
164129
}
165130
}

‎apps/mobile/modules/t3-native-controls/ios/T3SegmentedControlView.swift‎

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@ final class T3SegmentedControlView: ExpoView {
1515
}
1616
}
1717
var selectedIndex = -1 { didSet { updateSelection() } }
18-
var trackColor: UIColor = .secondarySystemBackground { didSet { control.backgroundColor = trackColor } }
19-
var selectedColor: UIColor = .secondarySystemFill { didSet { control.selectedSegmentTintColor = selectedColor } }
20-
var textColor: UIColor = .label { didSet { updateColors() } }
21-
var mutedColor: UIColor = .secondaryLabel { didSet { updateColors() } }
18+
var trackColor: UIColor = .secondarySystemBackground { didSet { if trackColor != oldValue { control.backgroundColor = trackColor } } }
19+
var selectedColor: UIColor = .secondarySystemFill { didSet { if selectedColor != oldValue { control.selectedSegmentTintColor = selectedColor } } }
20+
var textColor: UIColor = .label { didSet { if textColor != oldValue { updateColors() } } }
21+
var mutedColor: UIColor = .secondaryLabel { didSet { if mutedColor != oldValue { updateColors() } } }
2222
var appearance = "light" {
23-
didSet { overrideUserInterfaceStyle = appearance == "dark" ? .dark : .light }
23+
didSet {
24+
guard appearance != oldValue else { return }
25+
overrideUserInterfaceStyle = appearance == "dark" ? .dark : .light
26+
}
2427
}
2528

2629
required init(appContext: AppContext? = nil) {
@@ -31,11 +34,20 @@ final class T3SegmentedControlView: ExpoView {
3134

3235
override func layoutSubviews() {
3336
super.layoutSubviews()
34-
control.frame = bounds
37+
guard control.frame != bounds else { return }
38+
UIView.performWithoutAnimation {
39+
control.frame = bounds
40+
}
3541
}
3642

3743
private func updateSelection() {
38-
control.selectedSegmentIndex = labels.indices.contains(selectedIndex) ? selectedIndex : UISegmentedControl.noSegment
44+
let index = labels.indices.contains(selectedIndex) ? selectedIndex : UISegmentedControl.noSegment
45+
// React echoes native selections while UIKit is still settling the glass lens.
46+
guard control.selectedSegmentIndex != index else { return }
47+
UIView.performWithoutAnimation {
48+
control.selectedSegmentIndex = index
49+
control.layoutIfNeeded()
50+
}
3951
}
4052

4153
private func updateColors() {

‎apps/mobile/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@
140140
"uniwind": "1.12.1"
141141
},
142142
"devDependencies": {
143+
"@babel/core": "^7.29.7",
143144
"@effect/vitest": "catalog:",
144145
"@pierre/trees": "1.0.0-beta.6",
145146
"@types/mdast": "^4.0.4",

‎apps/mobile/src/Stack.tsx‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import {
3030
import { useResolveClassNames } from "uniwind";
3131

3232
import { AppText as Text } from "./components/ui/AppText";
33+
import { androidWorkspaceDestinationAnimation } from "./lib/android-workspace-navigation";
3334
import { getCompactBrandHeaderOptions } from "./components/CompactBrandTitle";
3435
import { WorkspaceRootScreen } from "./features/workspace/WorkspaceRootScreen";
3536
import { AndroidWorkspaceTabsProvider } from "./features/workspace/AndroidWorkspaceTabsProvider";
@@ -669,7 +670,9 @@ function NotFoundScreen() {
669670

670671
const RootStackConfig = createWorkspaceStackNavigator({
671672
initialRouteName: "Home",
672-
layout: RootStackLayout,
673+
// React Navigation calls layouts as plain functions inside its own render. Passing a
674+
// compiled component directly would put its memo cache among the navigator's hooks.
675+
layout: (props) => <RootStackLayout {...props} />,
673676
screenOptions: {
674677
headerShown: false,
675678
},
@@ -1007,15 +1010,17 @@ function ScreenRenderFallback(props: RenderFailureProps & { readonly routeName:
10071010
export const RootStack = RootStackConfig.with(function AdaptiveRootStack({ Navigator }) {
10081011
const { width, height } = useWindowDimensions();
10091012
const nativeMetrics = useNativeLayoutMetrics();
1010-
const usesWorkspaceFlowScreens =
1011-
Platform.OS === "android" || deriveLayout({ width, height, nativeMetrics }).usesSplitView;
1013+
const usesSplitView = deriveLayout({ width, height, nativeMetrics }).usesSplitView;
1014+
const usesWorkspaceFlowScreens = Platform.OS === "android" || usesSplitView;
10121015

10131016
return (
10141017
<Navigator
1015-
screenLayout={GuardedScreenLayout}
1018+
screenLayout={(props) => <GuardedScreenLayout {...props} />}
10161019
screenOptions={({ route }) => {
10171020
if (route.name !== "SettingsSheet" && route.name !== "NewTaskSheet") {
1018-
return {};
1021+
return Platform.OS === "android"
1022+
? { animation: androidWorkspaceDestinationAnimation(route.name, usesSplitView) }
1023+
: {};
10191024
}
10201025

10211026
return usesWorkspaceFlowScreens

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

Lines changed: 48 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { NATIVE_WORKSPACE_COLUMNS_SUPPORTED } from "../native/NativeWorkspaceColumns";
22
import Constants from "expo-constants";
33
import type { NativeStackNavigationOptions } from "@react-navigation/native-stack";
4+
import { useState } from "react";
45
import { Platform, View } from "react-native";
56

67
import { AppText as Text } from "./ui/AppText";
@@ -18,20 +19,37 @@ export function CompactBrandTitle(
1819
props: {
1920
readonly allowFontScaling?: boolean;
2021
readonly accessibilityLabel?: string;
22+
/**
23+
* Fills the parent row and drops the stage badge when the full title does not fit.
24+
* Narrow Android sidebar headers otherwise draw their actions over the badge.
25+
*/
26+
readonly fit?: boolean;
2127
} = {},
2228
) {
2329
const stageLabel = resolveMobileStageLabel(Constants.expoConfig?.extra?.appVariant);
2430
const titleOffset = brandTitleOffset();
2531
const { scale } = useAndroidControlSizing();
32+
const [availableWidth, setAvailableWidth] = useState<number | null>(null);
33+
// Measured only while the badge shows, so hiding it does not make it look like it fits.
34+
const [fullWidth, setFullWidth] = useState<number | null>(null);
35+
const showStage =
36+
!props.fit || availableWidth === null || fullWidth === null || fullWidth <= availableWidth;
2637

27-
return (
38+
const title = (
2839
<View
40+
onLayout={
41+
props.fit && showStage ? (event) => setFullWidth(event.nativeEvent.layout.width) : undefined
42+
}
2943
aria-level={1}
3044
accessibilityLabel={props.accessibilityLabel ?? "T3 Code, Threads"}
3145
accessible
3246
role="heading"
3347
className="flex-row items-center gap-1.5"
34-
style={[{ marginLeft: titleOffset }, Platform.OS === "android" && { gap: 5.25 * scale }]}
48+
style={[
49+
{ marginLeft: titleOffset },
50+
Platform.OS === "android" && { gap: 5.25 * scale },
51+
props.fit && { flexShrink: 0 },
52+
]}
3553
>
3654
<T3Wordmark colorClassName="accent-icon" height={Math.round(15 * scale)} />
3755
<Text
@@ -41,23 +59,36 @@ export function CompactBrandTitle(
4159
>
4260
Code
4361
</Text>
44-
<View
45-
className="rounded-full bg-subtle px-1.5 py-0.5"
46-
style={
47-
Platform.OS === "android"
48-
? { paddingHorizontal: 5.25 * scale, paddingVertical: 1.75 * scale }
49-
: undefined
50-
}
51-
>
52-
<Text
53-
allowFontScaling={props.allowFontScaling}
54-
className="font-t3-bold text-foreground-muted uppercase"
55-
style={{ fontSize: 9 * scale, letterSpacing: 0.9 * scale }}
62+
{showStage ? (
63+
<View
64+
className="rounded-full bg-subtle px-1.5 py-0.5"
65+
style={
66+
Platform.OS === "android"
67+
? { paddingHorizontal: 5.25 * scale, paddingVertical: 1.75 * scale }
68+
: undefined
69+
}
5670
>
57-
{stageLabel}
58-
</Text>
59-
</View>
71+
<Text
72+
allowFontScaling={props.allowFontScaling}
73+
className="font-t3-bold text-foreground-muted uppercase"
74+
style={{ fontSize: 9 * scale, letterSpacing: 0.9 * scale }}
75+
>
76+
{stageLabel}
77+
</Text>
78+
</View>
79+
) : null}
80+
</View>
81+
);
82+
83+
return props.fit ? (
84+
<View
85+
className="min-w-0 flex-1 flex-row items-center"
86+
onLayout={(event) => setAvailableWidth(event.nativeEvent.layout.width)}
87+
>
88+
{title}
6089
</View>
90+
) : (
91+
title
6192
);
6293
}
6394

0 commit comments

Comments
 (0)