From 593aa69833bd3e4c92190063e99b1f706bd7d3a5 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 7 Jul 2026 12:33:02 -0700 Subject: [PATCH] Polish connect onboarding sheet - Restore native sheet header and close affordance - Add pull-to-refresh and simplify onboarding actions - Reuse cloud rows without the section header in onboarding --- apps/mobile/src/Stack.tsx | 4 ++ .../cloud/ConnectOnboardingRouteScreen.tsx | 72 +++++++++---------- .../connection/CloudEnvironmentRows.tsx | 51 ++++++++----- 3 files changed, 71 insertions(+), 56 deletions(-) diff --git a/apps/mobile/src/Stack.tsx b/apps/mobile/src/Stack.tsx index 7c12431911..d68d6f2b97 100644 --- a/apps/mobile/src/Stack.tsx +++ b/apps/mobile/src/Stack.tsx @@ -421,6 +421,10 @@ export const RootStack = createNativeStackNavigator({ screen: ConnectOnboardingRouteScreen, linking: "connect-onboarding", options: { + // Root screenOptions hide headers; formSheets that want the native + // title bar opt back in with the sheet header preset. + ...SHEET_SOLID_HEADER_OPTIONS, + title: "Set up T3 Connect", gestureEnabled: true, presentation: "formSheet", sheetAllowedDetents: [0.6, 0.95], diff --git a/apps/mobile/src/features/cloud/ConnectOnboardingRouteScreen.tsx b/apps/mobile/src/features/cloud/ConnectOnboardingRouteScreen.tsx index f7f4c26b35..3e71b600eb 100644 --- a/apps/mobile/src/features/cloud/ConnectOnboardingRouteScreen.tsx +++ b/apps/mobile/src/features/cloud/ConnectOnboardingRouteScreen.tsx @@ -1,7 +1,8 @@ +import { NativeHeaderToolbar } from "../../native/StackHeader"; import { useAuth } from "@clerk/expo"; import { useNavigation } from "@react-navigation/native"; -import { useCallback } from "react"; -import { Pressable, ScrollView, View } from "react-native"; +import { useCallback, useState } from "react"; +import { Pressable, RefreshControl, ScrollView, View } from "react-native"; import { useSafeAreaInsets } from "react-native-safe-area-context"; import { reportAtomCommandResult, settlePromise } from "@t3tools/client-runtime/state/runtime"; @@ -9,6 +10,7 @@ import { AppText as Text } from "../../components/AppText"; import { useRemoteConnections } from "../../state/use-remote-environment-registry"; import { CloudEnvironmentRows } from "../connection/CloudEnvironmentRows"; import { splitEnvironmentSections } from "../connection/environmentSections"; +import { useConnectionController } from "../connection/useConnectionController"; import { optOutOfConnectOnboarding } from "./connectOnboardingOptOut"; import { hasCloudPublicConfig } from "./publicConfig"; @@ -28,12 +30,25 @@ function ConfiguredConnectOnboardingRouteScreen() { const insets = useSafeAreaInsets(); const { isSignedIn, userId } = useAuth({ treatPendingAsSignedOut: false }); const { connectedEnvironments, onReconnectEnvironment } = useRemoteConnections(); + const { refreshRelayEnvironments } = useConnectionController(); const { connectedCloudEnvironments } = splitEnvironmentSections({ connectedEnvironments, cloudEnvironments: null, }); - const handleDone = useCallback(() => { + // Pull-to-refresh tracks its own spinner instead of discovery's refreshing + // flag, so background refreshes (e.g. the sign-in one) don't yank the + // content down. + const [isPullRefreshing, setIsPullRefreshing] = useState(false); + const handlePullRefresh = useCallback(() => { + void (async () => { + setIsPullRefreshing(true); + await refreshRelayEnvironments(); + setIsPullRefreshing(false); + })(); + }, [refreshRelayEnvironments]); + + const handleClose = useCallback(() => { navigation.goBack(); }, [navigation]); @@ -49,38 +64,28 @@ function ConfiguredConnectOnboardingRouteScreen() { return ( + + + + } > - - - Set up T3 Connect - - Skip - - - - Environments published from your other devices are ready to connect here. - - - {isSignedIn ? ( ) : ( @@ -90,25 +95,16 @@ function ConfiguredConnectOnboardingRouteScreen() { )} - + {userId ? ( - Done + {"Don't show this again"} - {userId ? ( - - {"Don't show this again"} - - ) : null} - + ) : null} ); diff --git a/apps/mobile/src/features/connection/CloudEnvironmentRows.tsx b/apps/mobile/src/features/connection/CloudEnvironmentRows.tsx index 2796d2e570..2f0c3c54c6 100644 --- a/apps/mobile/src/features/connection/CloudEnvironmentRows.tsx +++ b/apps/mobile/src/features/connection/CloudEnvironmentRows.tsx @@ -33,6 +33,12 @@ import { type RelayEnvironmentView, useConnectionController } from "./useConnect export function CloudEnvironmentRows(props: { readonly connectedCloudEnvironments: ReadonlyArray; readonly onReconnectEnvironment: (environmentId: EnvironmentId) => void; + /** + * Hide the "T3 Connect" section title + refresh button for hosts that + * provide their own chrome (the onboarding sheet's native header and + * pull-to-refresh). + */ + readonly showHeader?: boolean; }) { const { isSignedIn } = useAuth({ treatPendingAsSignedOut: false }); const controller = useConnectionController(); @@ -56,27 +62,36 @@ export function CloudEnvironmentRows(props: { setExpandedErrorId((current) => (current === environmentId ? null : environmentId)); }, []); + const showHeader = props.showHeader ?? true; + if (!isSignedIn) return null; return ( - - - T3 Connect - { - void controller.refreshRelayEnvironments(); - }} - className="h-9 w-9 items-center justify-center rounded-full bg-subtle active:opacity-70 disabled:opacity-50" - > - {controller.relayDiscovery.isRefreshing ? ( - - ) : ( - - )} - - + + {showHeader ? ( + + T3 Connect + { + void controller.refreshRelayEnvironments(); + }} + className="h-9 w-9 items-center justify-center rounded-full bg-subtle active:opacity-70 disabled:opacity-50" + > + {controller.relayDiscovery.isRefreshing ? ( + + ) : ( + + )} + + + ) : null} {hasCloudRows ? (