Skip to content

Commit 633a668

Browse files
committed
merge: sync working window fix with main
2 parents 70c6017 + 8b44f42 commit 633a668

75 files changed

Lines changed: 2801 additions & 785 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: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,12 +272,18 @@ jobs:
272272
env:
273273
TEST_PACKAGES: ${{ needs.changes.outputs.test_packages }}
274274
run: |
275+
set -o pipefail
275276
filters=(--filter '!t3' --filter '!@t3tools/monorepo' --filter '!@t3tools/web')
276277
if [[ -n "$TEST_PACKAGES" ]]; then
277278
filters=()
278279
for package in $TEST_PACKAGES; do filters+=(--filter "$package"); done
279280
fi
280-
vp run --parallel --concurrency-limit 4 "${filters[@]}" test
281+
# The runner's trace writer can crash on surrogate pairs in test output.
282+
vp run --parallel --concurrency-limit 4 "${filters[@]}" test 2>&1 | python3 -u -c '
283+
import sys
284+
for line in sys.stdin:
285+
sys.stdout.write(line.encode("ascii", "backslashreplace").decode("ascii"))
286+
'
281287
282288
# The web suite is the largest outside the server. In the shared Test job it
283289
# started last and ran alone for about 40s after everything else finished.

‎apps/desktop/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@t3tools/desktop",
3-
"version": "0.1.6",
3+
"version": "0.1.7",
44
"private": true,
55
"type": "module",
66
"main": "dist-electron/boot.cjs",

‎apps/mobile/src/Stack.tsx‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,9 +1042,15 @@ export const RootStack = RootStackConfig.with(function AdaptiveRootStack({ Navig
10421042
return (
10431043
<Navigator
10441044
screenLayout={(props) => <GuardedScreenLayout {...props} />}
1045-
screenOptions={({ route }) =>
1045+
screenOptions={({ route, navigation }) =>
10461046
Platform.OS === "android"
1047-
? { animation: androidWorkspaceDestinationAnimation(route.name, usesSplitView) }
1047+
? {
1048+
animation: androidWorkspaceDestinationAnimation(
1049+
route,
1050+
navigation.getState().routes,
1051+
usesSplitView,
1052+
),
1053+
}
10481054
: {}
10491055
}
10501056
/>

‎apps/mobile/src/components/ui/ScreenContent.tsx‎

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,46 @@
11
import type { ReactNode } from "react";
2-
import { Platform, View } from "react-native";
2+
import { Platform, View, type LayoutChangeEvent } from "react-native";
33

4+
const SURFACE_CLASS_NAMES = {
5+
sheet: "bg-sheet-solid",
6+
screen: "bg-screen",
7+
canvas: "bg-thread-canvas",
8+
drawer: "bg-drawer",
9+
} as const;
10+
11+
/**
12+
* The body below a screen's AppBar. On Android it is the rounded card every pane and sheet
13+
* draws under its bar; a screen picks only the card's surface.
14+
*/
415
export function ScreenContent({
516
children,
17+
surface = "sheet",
618
insetHorizontal = false,
719
fitToContents = false,
20+
onLayout,
821
}: {
922
readonly children: ReactNode;
23+
readonly surface?: keyof typeof SURFACE_CLASS_NAMES;
1024
readonly insetHorizontal?: boolean;
1125
readonly fitToContents?: boolean;
26+
readonly onLayout?: (event: LayoutChangeEvent) => void;
1227
}) {
13-
if (Platform.OS !== "android") return children;
28+
if (Platform.OS !== "android") {
29+
return onLayout ? (
30+
<View className="flex-1" onLayout={onLayout}>
31+
{children}
32+
</View>
33+
) : (
34+
children
35+
);
36+
}
1437

1538
return (
1639
<View className={fitToContents ? "shrink bg-header" : "flex-1 bg-header"}>
1740
<View
18-
className="overflow-hidden rounded-t-[28px] bg-sheet-solid"
41+
className={`overflow-hidden rounded-t-[28px] ${SURFACE_CLASS_NAMES[surface]}`}
42+
collapsable={false}
43+
onLayout={onLayout}
1944
style={{
2045
flexShrink: 1,
2146
flexGrow: fitToContents ? 0 : 1,

‎apps/mobile/src/components/ui/SegmentedControl.shared.tsx‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import { useState } from "react";
22
import { I18nManager, Platform, Pressable, View } from "react-native";
3-
import Animated, { useAnimatedStyle, useReducedMotion, withTiming } from "react-native-reanimated";
3+
import Animated, {
4+
useAnimatedStyle,
5+
useDerivedValue,
6+
useReducedMotion,
7+
withTiming,
8+
} from "react-native-reanimated";
49

510
import { segmentedControlColors } from "./segmentedControlColors";
611
import { AppText } from "./AppText";
@@ -18,10 +23,14 @@ export function SegmentedControl<Value extends string | number>(
1823
const reduceMotion = useReducedMotion();
1924
const selectedIndex = props.options.findIndex((option) => option.value === props.selected);
2025
const segmentWidth = props.options.length ? Math.max(0, width - 6) / props.options.length : 0;
21-
const selectionOffset = selectedIndex * segmentWidth * (I18nManager.isRTL ? -1 : 1);
26+
const direction = I18nManager.isRTL ? -1 : 1;
27+
// The index animates, not the offset, so a resize moves the selection without sliding it.
28+
const selectedPosition = useDerivedValue(() =>
29+
withTiming(selectedIndex, { duration: reduceMotion ? 0 : 160 }),
30+
);
2231
const selectionStyle = useAnimatedStyle(() => ({
2332
width: segmentWidth,
24-
transform: [{ translateX: withTiming(selectionOffset, { duration: reduceMotion ? 0 : 160 }) }],
33+
transform: [{ translateX: selectedPosition.value * segmentWidth * direction }],
2534
}));
2635
const { trackColor, selectedColor, selectedTextColor, mutedColor } = segmentedControlColors(
2736
colors,

‎apps/mobile/src/features/home/HomeScreen.tsx‎

Lines changed: 122 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { usePaneRole } from "../../components/ui/Pane";
2+
import { ScreenContent } from "../../components/ui/ScreenContent";
23
import { useActiveNewTask } from "../../state/active-new-task";
34
import { AppActivityIndicator } from "../../components/ui/AppActivityIndicator";
45
import { useAndroidControlSizing } from "../../components/ui/useAndroidControlSizing";
@@ -672,45 +673,51 @@ export function HomeScreen(props: HomeScreenProps) {
672673
if (!hasAnyThreads) {
673674
return (
674675
<View className={containerClassName}>
675-
<View
676-
className={cn(
677-
"flex-1 items-center justify-center px-8",
678-
contentBackground,
679-
Platform.OS === "android" && "overflow-hidden rounded-t-[28px]",
680-
)}
681-
style={{
682-
paddingBottom: Platform.OS === "ios" ? iosBottomClearance : Math.max(insets.bottom, 24),
683-
paddingTop: NATIVE_LIQUID_GLASS_SUPPORTED ? insets.top + 72 : 0,
684-
paddingLeft: 32 + (contentSideInsets?.left ?? 0),
685-
paddingRight: 32 + (contentSideInsets?.right ?? 0),
686-
}}
687-
>
688-
<View className="w-full max-w-[430px]">
689-
<EmptyState
690-
title={emptyState.title}
691-
detail={emptyState.detail}
692-
actionLabel={!props.catalogState.hasReadyEnvironment ? "Add environment" : undefined}
693-
onAction={!props.catalogState.hasReadyEnvironment ? props.onAddConnection : undefined}
694-
action={
695-
Platform.OS === "android" && !props.catalogState.hasReadyEnvironment ? (
696-
<FloatingActionButton
697-
label="Add environment"
698-
icon="plus"
699-
variant="extended"
700-
tone="primary"
701-
onPress={props.onAddConnection}
702-
/>
703-
) : undefined
704-
}
705-
variant="plain"
706-
/>
707-
{emptyState.loading ? (
708-
<View className="mt-4 items-center">
709-
<AppActivityIndicator colorClassName="accent-icon-muted" />
710-
</View>
711-
) : null}
676+
<ScreenContent surface={sidebarSurface ? "drawer" : "screen"}>
677+
<View
678+
className={cn(
679+
"flex-1 items-center justify-center px-8",
680+
Platform.OS !== "android" && contentBackground,
681+
)}
682+
style={{
683+
paddingBottom:
684+
Platform.OS === "ios" ? iosBottomClearance : Math.max(insets.bottom, 24),
685+
paddingTop: NATIVE_LIQUID_GLASS_SUPPORTED ? insets.top + 72 : 0,
686+
paddingLeft: 32 + (contentSideInsets?.left ?? 0),
687+
paddingRight: 32 + (contentSideInsets?.right ?? 0),
688+
}}
689+
>
690+
<View className="w-full max-w-[430px]">
691+
<EmptyState
692+
title={emptyState.title}
693+
detail={emptyState.detail}
694+
actionLabel={
695+
!props.catalogState.hasReadyEnvironment ? "Add environment" : undefined
696+
}
697+
onAction={
698+
!props.catalogState.hasReadyEnvironment ? props.onAddConnection : undefined
699+
}
700+
action={
701+
Platform.OS === "android" && !props.catalogState.hasReadyEnvironment ? (
702+
<FloatingActionButton
703+
label="Add environment"
704+
icon="plus"
705+
variant="extended"
706+
tone="primary"
707+
onPress={props.onAddConnection}
708+
/>
709+
) : undefined
710+
}
711+
variant="plain"
712+
/>
713+
{emptyState.loading ? (
714+
<View className="mt-4 items-center">
715+
<AppActivityIndicator colorClassName="accent-icon-muted" />
716+
</View>
717+
) : null}
718+
</View>
712719
</View>
713-
</View>
720+
</ScreenContent>
714721
</View>
715722
);
716723
}
@@ -766,97 +773,93 @@ export function HomeScreen(props: HomeScreenProps) {
766773

767774
if (Platform.OS === "android" && threadListV2Items.length === 0) {
768775
return (
769-
<View className="flex-1 bg-header">
776+
<ScreenContent surface="screen">
770777
<View
771-
className="flex-1 items-center justify-center overflow-hidden rounded-t-[28px] bg-screen px-4"
778+
className="flex-1 items-center justify-center px-4"
772779
style={{ paddingBottom: insets.bottom }}
773780
>
774781
{v2ListEmpty}
775782
</View>
776-
</View>
783+
</ScreenContent>
777784
);
778785
}
779786

780787
return (
781788
<View className={containerClassName}>
782-
<View
783-
className={
784-
Platform.OS === "android"
785-
? "flex-1 overflow-hidden rounded-t-[28px] bg-screen"
786-
: cn("flex-1", contentBackground)
787-
}
788-
>
789-
<SwipeableScrollGateProvider enabled={swipeEnabled} activation={swipeRowActivation}>
790-
<GestureDetector gesture={homeScrollGesture}>
791-
<AnimatedLegendList
792-
itemLayoutAnimation={sidebarSurface ? THREAD_SIDEBAR_ROW_LAYOUT : undefined}
793-
ref={listRef}
794-
onLoad={() => activateVisibleRows(threadListV2Items)}
795-
onTouchStart={(event) => trackListTouches(event, true)}
796-
onTouchEnd={(event) => trackListTouches(event, false)}
797-
onTouchCancel={(event) => trackListTouches(event, false)}
798-
renderScrollComponent={Platform.OS === "ios" ? renderHomeScrollView : undefined}
799-
data={threadListV2Items}
800-
renderItem={renderV2Item}
801-
keyExtractor={v2KeyExtractor}
802-
getItemType={(item) => item.type}
803-
itemsAreEqual={threadListV2ListItemsAreEqual}
804-
estimatedItemSize={ESTIMATED_THREAD_LIST_V2_ROW_HEIGHT}
805-
drawDistance={THREAD_LIST_V2_DRAW_DISTANCE}
806-
recycleItems
807-
extraData={v2ExtraData}
808-
ListHeaderComponent={v2ListHeader}
809-
ListFooterComponent={
810-
settledShelfExpanded && threadListV2Layout.hiddenSettledCount > 0 ? (
811-
<ThreadListV2ShowMoreRow
812-
hiddenCount={threadListV2Layout.hiddenSettledCount}
813-
{...(olderSettledShelf.loading
814-
? { state: "loading" as const }
815-
: olderSettledShelf.failed
816-
? { state: "failed" as const }
817-
: {})}
818-
onPress={() => {
819-
olderSettledShelf.retry();
820-
showMoreSettled();
821-
}}
822-
/>
823-
) : null
824-
}
825-
ListEmptyComponent={v2ListEmpty}
826-
style={{ flex: 1 }}
827-
automaticallyAdjustsScrollIndicatorInsets={Platform.OS === "ios"}
828-
// UIKit owns the bar's inset, so a minimizing bar and a resized column move
829-
// the list in the same frame as the bar.
830-
contentInsetAdjustmentBehavior="automatic"
831-
contentInsetStartAdjustment={Platform.OS === "ios" ? insets.top : 0}
832-
// RN scrollTo clamps against raw insets and ignores the automatic bar inset.
833-
scrollToOverflowEnabled
834-
initialScrollOffset={
835-
initialScrollOffset > 0
836-
? initialScrollOffset - (Platform.OS === "ios" ? insets.top : 0)
837-
: undefined
838-
}
839-
showsVerticalScrollIndicator={false}
840-
keyboardDismissMode="on-drag"
841-
keyboardShouldPersistTaps="handled"
842-
{...scrollGateHandlers}
843-
scrollEventThrottle={16}
844-
contentContainerStyle={{
845-
paddingLeft:
846-
(contentSideInsets?.left ?? 0) + (sidebarSurface ? 8 : 0) + androidListGutter,
847-
paddingRight:
848-
(contentSideInsets?.right ?? 0) + (sidebarSurface ? 8 : 0) + androidListGutter,
849-
paddingBottom:
850-
Platform.OS === "ios"
851-
? iosBottomClearance - (columnMetrics?.safeArea.bottom ?? insets.bottom)
852-
: (workspace?.bottomClearance ??
853-
Math.max(insets.bottom, 16) +
854-
(Platform.OS === "android" ? fabClearance : 88)),
855-
}}
856-
/>
857-
</GestureDetector>
858-
</SwipeableScrollGateProvider>
859-
</View>
789+
<ScreenContent surface="screen">
790+
<View className={cn("flex-1", Platform.OS !== "android" && contentBackground)}>
791+
<SwipeableScrollGateProvider enabled={swipeEnabled} activation={swipeRowActivation}>
792+
<GestureDetector gesture={homeScrollGesture}>
793+
<AnimatedLegendList
794+
itemLayoutAnimation={sidebarSurface ? THREAD_SIDEBAR_ROW_LAYOUT : undefined}
795+
ref={listRef}
796+
onLoad={() => activateVisibleRows(threadListV2Items)}
797+
onTouchStart={(event) => trackListTouches(event, true)}
798+
onTouchEnd={(event) => trackListTouches(event, false)}
799+
onTouchCancel={(event) => trackListTouches(event, false)}
800+
renderScrollComponent={Platform.OS === "ios" ? renderHomeScrollView : undefined}
801+
data={threadListV2Items}
802+
renderItem={renderV2Item}
803+
keyExtractor={v2KeyExtractor}
804+
getItemType={(item) => item.type}
805+
itemsAreEqual={threadListV2ListItemsAreEqual}
806+
estimatedItemSize={ESTIMATED_THREAD_LIST_V2_ROW_HEIGHT}
807+
drawDistance={THREAD_LIST_V2_DRAW_DISTANCE}
808+
recycleItems
809+
extraData={v2ExtraData}
810+
ListHeaderComponent={v2ListHeader}
811+
ListFooterComponent={
812+
settledShelfExpanded && threadListV2Layout.hiddenSettledCount > 0 ? (
813+
<ThreadListV2ShowMoreRow
814+
hiddenCount={threadListV2Layout.hiddenSettledCount}
815+
{...(olderSettledShelf.loading
816+
? { state: "loading" as const }
817+
: olderSettledShelf.failed
818+
? { state: "failed" as const }
819+
: {})}
820+
onPress={() => {
821+
olderSettledShelf.retry();
822+
showMoreSettled();
823+
}}
824+
/>
825+
) : null
826+
}
827+
ListEmptyComponent={v2ListEmpty}
828+
style={{ flex: 1 }}
829+
automaticallyAdjustsScrollIndicatorInsets={Platform.OS === "ios"}
830+
// UIKit owns the bar's inset, so a minimizing bar and a resized column move
831+
// the list in the same frame as the bar.
832+
contentInsetAdjustmentBehavior="automatic"
833+
contentInsetStartAdjustment={Platform.OS === "ios" ? insets.top : 0}
834+
// RN scrollTo clamps against raw insets and ignores the automatic bar inset.
835+
scrollToOverflowEnabled
836+
initialScrollOffset={
837+
initialScrollOffset > 0
838+
? initialScrollOffset - (Platform.OS === "ios" ? insets.top : 0)
839+
: undefined
840+
}
841+
showsVerticalScrollIndicator={false}
842+
keyboardDismissMode="on-drag"
843+
keyboardShouldPersistTaps="handled"
844+
{...scrollGateHandlers}
845+
scrollEventThrottle={16}
846+
contentContainerStyle={{
847+
paddingLeft:
848+
(contentSideInsets?.left ?? 0) + (sidebarSurface ? 8 : 0) + androidListGutter,
849+
paddingRight:
850+
(contentSideInsets?.right ?? 0) + (sidebarSurface ? 8 : 0) + androidListGutter,
851+
paddingBottom:
852+
Platform.OS === "ios"
853+
? iosBottomClearance - (columnMetrics?.safeArea.bottom ?? insets.bottom)
854+
: (workspace?.bottomClearance ??
855+
Math.max(insets.bottom, 16) +
856+
(Platform.OS === "android" ? fabClearance : 88)),
857+
}}
858+
/>
859+
</GestureDetector>
860+
</SwipeableScrollGateProvider>
861+
</View>
862+
</ScreenContent>
860863
</View>
861864
);
862865
}

0 commit comments

Comments
 (0)