| ... | @@ -1,7 +1,10 @@ | ... | @@ -1,7 +1,10 @@ |
| 1 | import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollView"; | 1 | import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollView"; |
| | 2 | import { useAuth } from "@clerk/expo"; |
| 2 | import { CameraView, useCameraPermissions } from "expo-camera"; | 3 | import { CameraView, useCameraPermissions } from "expo-camera"; |
| | 4 | import * as Haptics from "expo-haptics"; |
| 3 | import { | 5 | import { |
| 4 | StackActions, | 6 | StackActions, |
| | 7 | useIsFocused, |
| 5 | useNavigation, | 8 | useNavigation, |
| 6 | useRoute, | 9 | useRoute, |
| 7 | type StaticScreenProps, | 10 | type StaticScreenProps, |
| ... | @@ -9,16 +12,24 @@ import { | ... | @@ -9,16 +12,24 @@ import { |
| 9 | import type { EnvironmentId } from "@t3tools/contracts"; | 12 | import type { EnvironmentId } from "@t3tools/contracts"; |
| 10 | import { AsyncResult } from "effect/reactivity"; | 13 | import { AsyncResult } from "effect/reactivity"; |
| 11 | import { useCallback, useEffect, useRef, useState } from "react"; | 14 | import { useCallback, useEffect, useRef, useState } from "react"; |
| 12 | import { Alert, Linking, Platform, View } from "react-native"; | 15 | import { Alert, Linking, Pressable, StyleSheet, View } from "react-native"; |
| | 16 | import Svg, { Defs, RadialGradient, Rect, Stop } from "react-native-svg"; |
| 13 | import { useSafeAreaInsets } from "react-native-safe-area-context"; | 17 | import { useSafeAreaInsets } from "react-native-safe-area-context"; |
| | 18 | import { cn } from "../../lib/cn"; |
| 14 | import { useUniwindTheme } from "../../lib/useUniwindTheme"; | 19 | import { useUniwindTheme } from "../../lib/useUniwindTheme"; |
| | 20 | import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider"; |
| 15 | import { SettingsScreen } from "../settings/components/SettingsScreen"; | 21 | import { SettingsScreen } from "../settings/components/SettingsScreen"; |
| 16 | import { AppText as Text } from "../../components/AppText"; | 22 | import { AppText as Text, AppTextInput, type AppTextInputProps } from "../../components/AppText"; |
| 17 | import { ErrorBanner } from "../../components/ErrorBanner"; | 23 | import { FrostedCutout } from "../../components/FrostedCutout"; |
| 18 | import { ConnectionFormField } from "./ConnectionFormField"; | | |
| 19 | import { ConnectionSheetButton } from "./ConnectionSheetButton"; | | |
| 20 | import { buildPairingUrl, extractPairingUrlFromQrPayload, parsePairingUrl } from "./pairing"; | 24 | import { buildPairingUrl, extractPairingUrlFromQrPayload, parsePairingUrl } from "./pairing"; |
| 21 | import { useRemoteConnections } from "../../state/use-remote-environment-registry"; | 25 | import { |
| | 26 | setPendingConnectionError, |
| | 27 | useRemoteConnections, |
| | 28 | } from "../../state/use-remote-environment-registry"; |
| | 29 | import { SymbolView } from "../../components/AppSymbol"; |
| | 30 | import { hasCloudPublicConfig } from "../cloud/publicConfig"; |
| | 31 | import { CloudEnvironmentRows } from "./CloudEnvironmentRows"; |
| | 32 | import { splitEnvironmentSections } from "./environmentSections"; |
| 22 | | 33 | |
| 23 | type ConnectionsNewRouteParams = { | 34 | type ConnectionsNewRouteParams = { |
| 24 | readonly mode?: string; | 35 | readonly mode?: string; |
| ... | @@ -51,9 +62,11 @@ export function ConnectionsNewRouteScreen({ | ... | @@ -51,9 +62,11 @@ export function ConnectionsNewRouteScreen({ |
| 51 | const [hostInput, setHostInput] = useState(""); | 62 | const [hostInput, setHostInput] = useState(""); |
| 52 | const [codeInput, setCodeInput] = useState(""); | 63 | const [codeInput, setCodeInput] = useState(""); |
| 53 | const [isSubmitting, setIsSubmitting] = useState(false); | 64 | const [isSubmitting, setIsSubmitting] = useState(false); |
| 54 | const [showScanner, setShowScanner] = useState(params.mode === "scan_qr"); | | |
| 55 | const [cameraPermission, requestCameraPermission] = useCameraPermissions(); | 65 | const [cameraPermission, requestCameraPermission] = useCameraPermissions(); |
| | 66 | const screenFocused = useIsFocused(); |
| 56 | const [scannerLocked, setScannerLocked] = useState(false); | 67 | const [scannerLocked, setScannerLocked] = useState(false); |
| | 68 | // A good scan parks the camera so it can't re-read the code over later edits. |
| | 69 | const [scanComplete, setScanComplete] = useState(false); |
| 57 | const attemptedAutoConnectRef = useRef<string | null>(null); | 70 | const attemptedAutoConnectRef = useRef<string | null>(null); |
| 58 | | 71 | |
| 59 | const headerIconColor = useUniwindTheme()["--color-icon"]; | 72 | const headerIconColor = useUniwindTheme()["--color-icon"]; |
| ... | @@ -84,34 +97,25 @@ export function ConnectionsNewRouteScreen({ | ... | @@ -84,34 +97,25 @@ export function ConnectionsNewRouteScreen({ |
| 84 | | 97 | |
| 85 | const handleHostChange = useCallback((value: string) => { | 98 | const handleHostChange = useCallback((value: string) => { |
| 86 | setHostInput(value); | 99 | setHostInput(value); |
| | 100 | setPendingConnectionError(null); |
| 87 | }, []); | 101 | }, []); |
| 88 | | 102 | |
| 89 | const handleCodeChange = useCallback((value: string) => { | 103 | const handleCodeChange = useCallback((value: string) => { |
| 90 | setCodeInput(value); | 104 | setCodeInput(value); |
| | 105 | setPendingConnectionError(null); |
| 91 | }, []); | 106 | }, []); |
| 92 | | 107 | |
| 93 | const openScanner = useCallback(async () => { | 108 | // The error is shared app state; a stale failure must not greet the next visit. |
| 94 | if (cameraPermission?.granted) { | 109 | useEffect(() => () => setPendingConnectionError(null), []); |
| 95 | setScannerLocked(false); | | |
| 96 | setShowScanner(true); | | |
| 97 | return; | | |
| 98 | } | | |
| 99 | | 110 | |
| | 111 | // Opening the sheet never prompts; a tap on the scan card asks for the camera. |
| | 112 | const handleScanPress = useCallback(async () => { |
| 100 | const permission = await requestCameraPermission(); | 113 | const permission = await requestCameraPermission(); |
| 101 | if (permission.granted) { | 114 | if (permission.granted) { |
| 102 | setScannerLocked(false); | 115 | setScanComplete(false); |
| 103 | setShowScanner(true); | | |
| 104 | return; | | |
| 105 | } | | |
| 106 | | | |
| 107 | if (permission.canAskAgain) { | | |
| 108 | Alert.alert( | | |
| 109 | "Camera access needed", | | |
| 110 | "Allow camera access to scan an environment pairing QR code.", | | |
| 111 | ); | | |
| 112 | return; | 116 | return; |
| 113 | } | 117 | } |
| 114 | | 118 | if (permission.canAskAgain) return; |
| 115 | Alert.alert( | 119 | Alert.alert( |
| 116 | "Camera access needed", | 120 | "Camera access needed", |
| 117 | "Camera access was denied for this app. Open Settings to enable it.", | 121 | "Camera access was denied for this app. Open Settings to enable it.", |
| ... | @@ -120,12 +124,7 @@ export function ConnectionsNewRouteScreen({ | ... | @@ -120,12 +124,7 @@ export function ConnectionsNewRouteScreen({ |
| 120 | { text: "Open Settings", onPress: () => void Linking.openSettings() }, | 124 | { text: "Open Settings", onPress: () => void Linking.openSettings() }, |
| 121 | ], | 125 | ], |
| 122 | ); | 126 | ); |
| 123 | }, [cameraPermission?.granted, requestCameraPermission]); | 127 | }, [requestCameraPermission]); |
| 124 | | | |
| 125 | const closeScanner = useCallback(() => { | | |
| 126 | setShowScanner(false); | | |
| 127 | setScannerLocked(false); | | |
| 128 | }, []); | | |
| 129 | | 128 | |
| 130 | const handleQrScan = useCallback( | 129 | const handleQrScan = useCallback( |
| 131 | ({ data }: { readonly data: string }) => { | 130 | ({ data }: { readonly data: string }) => { |
| ... | @@ -141,13 +140,14 @@ export function ConnectionsNewRouteScreen({ | ... | @@ -141,13 +140,14 @@ export function ConnectionsNewRouteScreen({ |
| 141 | setHostInput(host); | 140 | setHostInput(host); |
| 142 | setCodeInput(code); | 141 | setCodeInput(code); |
| 143 | onChangeConnectionPairingUrl(pairingUrl); | 142 | onChangeConnectionPairingUrl(pairingUrl); |
| 144 | setShowScanner(false); | 143 | setScanComplete(true); |
| | 144 | setScannerLocked(false); |
| 145 | } catch (error) { | 145 | } catch (error) { |
| | 146 | void Haptics.notificationAsync(Haptics.NotificationFeedbackType.Error); |
| 146 | Alert.alert( | 147 | Alert.alert( |
| 147 | "Invalid QR code", | 148 | "Invalid QR code", |
| 148 | error instanceof Error ? error.message : "Scanned QR code was not recognized.", | 149 | error instanceof Error ? error.message : "Scanned QR code was not recognized.", |
| 149 | ); | 150 | ); |
| 150 | } finally { | | |
| 151 | setTimeout(() => { | 151 | setTimeout(() => { |
| 152 | setScannerLocked(false); | 152 | setScannerLocked(false); |
| 153 | }, 600); | 153 | }, 600); |
| ... | @@ -162,6 +162,11 @@ export function ConnectionsNewRouteScreen({ | ... | @@ -162,6 +162,11 @@ export function ConnectionsNewRouteScreen({ |
| 162 | onChangeConnectionPairingUrl(pairingUrl); | 162 | onChangeConnectionPairingUrl(pairingUrl); |
| 163 | try { | 163 | try { |
| 164 | const result = await onConnectPress(pairingUrl, params.routeFor); | 164 | const result = await onConnectPress(pairingUrl, params.routeFor); |
| | 165 | void Haptics.notificationAsync( |
| | 166 | AsyncResult.isSuccess(result) |
| | 167 | ? Haptics.NotificationFeedbackType.Success |
| | 168 | : Haptics.NotificationFeedbackType.Error, |
| | 169 | ); |
| 165 | if (AsyncResult.isSuccess(result)) { | 170 | if (AsyncResult.isSuccess(result)) { |
| 166 | if (replaceWithHome || !navigation.canGoBack()) { | 171 | if (replaceWithHome || !navigation.canGoBack()) { |
| 167 | navigation.dispatch(StackActions.replace("Home")); | 172 | navigation.dispatch(StackActions.replace("Home")); |
| ... | @@ -192,96 +197,260 @@ export function ConnectionsNewRouteScreen({ | ... | @@ -192,96 +197,260 @@ export function ConnectionsNewRouteScreen({ |
| 192 | return ( | 197 | return ( |
| 193 | <SettingsScreen | 198 | <SettingsScreen |
| 194 | formSheet={routeName === "ConnectionsNew"} | 199 | formSheet={routeName === "ConnectionsNew"} |
| 195 | title={showScanner ? "Scan QR Code" : "Add Environment"} | 200 | title="Add environment" |
| 196 | actions={[ | 201 | actions={[ |
| 197 | { | 202 | { |
| 198 | accessibilityLabel: showScanner ? "Close scanner" : "Scan QR code", | 203 | accessibilityLabel: isSubmitting ? "Connecting" : "Add environment", |
| 199 | icon: showScanner ? "xmark" : Platform.OS === "ios" ? "qrcode.viewfinder" : "camera", | 204 | loading: isSubmitting, |
| | 205 | icon: "checkmark", |
| 200 | tintColor: headerIconColor, | 206 | tintColor: headerIconColor, |
| | 207 | disabled: connectDisabled, |
| 201 | onPress: () => { | 208 | onPress: () => { |
| 202 | if (showScanner) { | 209 | void handleSubmit(); |
| 203 | closeScanner(); | | |
| 204 | } else { | | |
| 205 | void openScanner(); | | |
| 206 | } | | |
| 207 | }, | 210 | }, |
| 208 | }, | 211 | }, |
| 209 | ]} | 212 | ]} |
| 210 | > | 213 | > |
| 211 | <ScrollView | 214 | <ScrollView |
| 212 | contentInsetAdjustmentBehavior="automatic" | 215 | contentInsetAdjustmentBehavior="automatic" |
| | 216 | keyboardShouldPersistTaps="handled" |
| 213 | showsVerticalScrollIndicator={false} | 217 | showsVerticalScrollIndicator={false} |
| 214 | className="flex-1" | 218 | className="flex-1" |
| 215 | contentInset={{ bottom: Math.max(insets.bottom, 18) + 18 }} | 219 | contentInset={{ bottom: Math.max(insets.bottom, 18) + 18 }} |
| 216 | contentContainerStyle={{ | 220 | contentContainerStyle={{ |
| 217 | paddingHorizontal: 20, | 221 | paddingHorizontal: 16, |
| 218 | paddingTop: 16, | 222 | paddingTop: 4, |
| 219 | }} | 223 | }} |
| 220 | > | 224 | > |
| 221 | <View collapsable={false} className="gap-5"> | 225 | <View collapsable={false} className="gap-6.5"> |
| 222 | {showScanner ? ( | 226 | <PairingScanCard |
| 223 | cameraPermission?.granted ? ( | 227 | cameraActive={cameraPermission?.granted === true && screenFocused && !scanComplete} |
| 224 | <View className="overflow-hidden rounded-[24px] border-continuous"> | 228 | onScan={handleQrScan} |
| 225 | <CameraView | 229 | onScanPress={() => { |
| 226 | barcodeScannerSettings={{ barcodeTypes: ["qr"] }} | 230 | void handleScanPress(); |
| 227 | onBarcodeScanned={handleQrScan} | 231 | }} |
| 228 | style={{ aspectRatio: 1, width: "100%" }} | 232 | /> |
| 229 | /> | 233 | |
| 230 | </View> | 234 | <View collapsable={false} className="gap-2"> |
| 231 | ) : ( | 235 | <Text className="px-4 text-sm font-t3-medium text-foreground-muted">Or enter it</Text> |
| 232 | <View className="items-center gap-3 rounded-[24px] border-continuous bg-grouped-card px-5 py-8"> | 236 | <View |
| 233 | <Text className="text-center text-sm leading-normal text-foreground-muted"> | 237 | collapsable={false} |
| 234 | Camera permission is required to scan a QR code. | 238 | className={cn( |
| 235 | </Text> | 239 | "overflow-hidden rounded-[26px] border-continuous border bg-grouped-card", |
| 236 | <ConnectionSheetButton | 240 | pairingConnectionError ? "border-danger-foreground" : "border-transparent", |
| 237 | compact | 241 | )} |
| 238 | icon="camera" | 242 | > |
| 239 | label="Allow camera" | 243 | <PairingInputRow |
| 240 | tone="secondary" | 244 | label="Address" |
| 241 | onPress={() => { | | |
| 242 | void openScanner(); | | |
| 243 | }} | | |
| 244 | /> | | |
| 245 | </View> | | |
| 246 | ) | | |
| 247 | ) : ( | | |
| 248 | <View collapsable={false} className="gap-4 rounded-[24px] bg-grouped-card p-4"> | | |
| 249 | <ConnectionFormField | | |
| 250 | label="Host" | | |
| 251 | autoCapitalize="none" | | |
| 252 | autoCorrect={false} | | |
| 253 | keyboardType="url" | 245 | keyboardType="url" |
| 254 | placeholder="192.168.1.100:8080" | 246 | placeholder="192.168.1.100:3773" |
| 255 | value={hostInput} | 247 | value={hostInput} |
| 256 | onChangeText={handleHostChange} | 248 | onChangeText={handleHostChange} |
| 257 | /> | 249 | /> |
| 258 | | 250 | <View className="ml-4 border-t border-border-subtle" /> |
| 259 | <ConnectionFormField | 251 | <PairingInputRow |
| 260 | label="Pairing code" | 252 | label="Code" |
| 261 | autoCapitalize="none" | 253 | placeholder="Pairing code" |
| 262 | autoCorrect={false} | 254 | returnKeyType="go" |
| 263 | placeholder="abc-123-xyz" | | |
| 264 | value={codeInput} | 255 | value={codeInput} |
| 265 | onChangeText={handleCodeChange} | 256 | onChangeText={handleCodeChange} |
| | 257 | onSubmitEditing={() => { |
| | 258 | if (!connectDisabled) void handleSubmit(); |
| | 259 | }} |
| 266 | /> | 260 | /> |
| 267 | | | |
| 268 | {pairingConnectionError ? <ErrorBanner message={pairingConnectionError} /> : null} | | |
| 269 | | | |
| 270 | <View className="android:flex-row android:justify-end"> | | |
| 271 | <ConnectionSheetButton | | |
| 272 | icon="plus" | | |
| 273 | label={isSubmitting ? "Pairing..." : "Add environment"} | | |
| 274 | disabled={connectDisabled} | | |
| 275 | tone="primary" | | |
| 276 | onPress={() => { | | |
| 277 | void handleSubmit(); | | |
| 278 | }} | | |
| 279 | /> | | |
| 280 | </View> | | |
| 281 | </View> | 261 | </View> |
| 282 | )} | 262 | <Text |
| | 263 | accessibilityLiveRegion="polite" |
| | 264 | className={cn( |
| | 265 | "px-4 text-sm leading-normal", |
| | 266 | pairingConnectionError ? "text-danger-foreground" : "text-foreground-muted", |
| | 267 | )} |
| | 268 | > |
| | 269 | {pairingConnectionError ?? |
| | 270 | "For machines on your local network or tailnet. The machine keeps its own provider credentials."} |
| | 271 | </Text> |
| | 272 | </View> |
| | 273 | |
| | 274 | {hasCloudPublicConfig() ? <T3ConnectSection /> : null} |
| 283 | </View> | 275 | </View> |
| 284 | </ScrollView> | 276 | </ScrollView> |
| 285 | </SettingsScreen> | 277 | </SettingsScreen> |
| 286 | ); | 278 | ); |
| 287 | } | 279 | } |
| | 280 | |
| | 281 | const SCAN_CARD_HEIGHT = 250; |
| | 282 | const SCAN_RETICLE_SIZE = 150; |
| | 283 | const SCAN_RETICLE_TOP = 36; |
| | 284 | const SCAN_RETICLE_RADIUS = 28; |
| | 285 | |
| | 286 | /** |
| | 287 | * Live QR scanner: the camera fills the card, blurred everywhere except the |
| | 288 | * reticle so the code being aimed at stays sharp. Without a camera it shows the |
| | 289 | * same frame over a dark gradient. |
| | 290 | */ |
| | 291 | function PairingScanCard(props: { |
| | 292 | readonly cameraActive: boolean; |
| | 293 | readonly onScan: (result: { readonly data: string }) => void; |
| | 294 | readonly onScanPress: () => void; |
| | 295 | }) { |
| | 296 | const light = useAppearancePreferences().themeAppearance === "light"; |
| | 297 | return ( |
| | 298 | <Pressable |
| | 299 | accessibilityRole={props.cameraActive ? undefined : "button"} |
| | 300 | accessibilityLabel={props.cameraActive ? undefined : "Scan QR code"} |
| | 301 | disabled={props.cameraActive} |
| | 302 | onPress={props.onScanPress} |
| | 303 | className={cn( |
| | 304 | "overflow-hidden rounded-[26px] border-continuous", |
| | 305 | light ? "bg-white" : "bg-black", |
| | 306 | )} |
| | 307 | style={{ height: SCAN_CARD_HEIGHT }} |
| | 308 | > |
| | 309 | <Svg accessibilityElementsHidden height="100%" style={StyleSheet.absoluteFill} width="100%"> |
| | 310 | <Defs> |
| | 311 | <RadialGradient id="pairing-scan-backdrop" cx="50%" cy="50%" r="50%"> |
| | 312 | <Stop offset="0%" stopColor={light ? "#f4f4f5" : "#2e2e2e"} /> |
| | 313 | <Stop offset="100%" stopColor={light ? "#d9d9dc" : "#0e0e0e"} /> |
| | 314 | </RadialGradient> |
| | 315 | </Defs> |
| | 316 | <Rect fill="url(#pairing-scan-backdrop)" height="100%" width="100%" /> |
| | 317 | </Svg> |
| | 318 | |
| | 319 | {props.cameraActive ? ( |
| | 320 | <> |
| | 321 | <CameraView |
| | 322 | active |
| | 323 | barcodeScannerSettings={{ barcodeTypes: ["qr"] }} |
| | 324 | onBarcodeScanned={props.onScan} |
| | 325 | style={StyleSheet.absoluteFill} |
| | 326 | /> |
| | 327 | <FrostedCutout |
| | 328 | cutoutTop={SCAN_RETICLE_TOP} |
| | 329 | cutoutWidth={SCAN_RETICLE_SIZE} |
| | 330 | cutoutHeight={SCAN_RETICLE_SIZE} |
| | 331 | cutoutRadius={SCAN_RETICLE_RADIUS} |
| | 332 | appearance={light ? "light" : "dark"} |
| | 333 | /> |
| | 334 | </> |
| | 335 | ) : null} |
| | 336 | |
| | 337 | <View |
| | 338 | pointerEvents="none" |
| | 339 | className="absolute inset-x-0 items-center gap-3.5" |
| | 340 | style={{ top: SCAN_RETICLE_TOP }} |
| | 341 | > |
| | 342 | <View |
| | 343 | className={cn( |
| | 344 | "items-center justify-center gap-2 border-continuous border-[3px]", |
| | 345 | light ? "border-black/70" : "border-white/80", |
| | 346 | )} |
| | 347 | style={{ |
| | 348 | borderRadius: SCAN_RETICLE_RADIUS, |
| | 349 | height: SCAN_RETICLE_SIZE, |
| | 350 | width: SCAN_RETICLE_SIZE, |
| | 351 | }} |
| | 352 | > |
| | 353 | {props.cameraActive ? null : ( |
| | 354 | <> |
| | 355 | <SymbolView |
| | 356 | name="qrcode.viewfinder" |
| | 357 | size={44} |
| | 358 | tintColorClassName={light ? "accent-black/60" : "accent-white/70"} |
| | 359 | type="monochrome" |
| | 360 | weight="light" |
| | 361 | /> |
| | 362 | <Text |
| | 363 | className={cn("font-t3-medium text-sm", light ? "text-black/70" : "text-white/80")} |
| | 364 | > |
| | 365 | Tap to scan |
| | 366 | </Text> |
| | 367 | </> |
| | 368 | )} |
| | 369 | </View> |
| | 370 | <Text className={cn("text-center text-sm", light ? "text-black/70" : "text-white/80")}> |
| | 371 | Scan the code from t3 pair or desktop Connections settings |
| | 372 | </Text> |
| | 373 | </View> |
| | 374 | </Pressable> |
| | 375 | ); |
| | 376 | } |
| | 377 | |
| | 378 | /** |
| | 379 | * Managed-relay alternative to manual pairing: signed in, the account's |
| | 380 | * published environments connect with a switch; signed out, one row opens the |
| | 381 | * T3 Account sheet. |
| | 382 | */ |
| | 383 | function T3ConnectSection() { |
| | 384 | const { isLoaded, isSignedIn } = useAuth({ treatPendingAsSignedOut: false }); |
| | 385 | const navigation = useNavigation(); |
| | 386 | const { connectedEnvironments, onSetEnvironmentEnabled, onRemoveEnvironmentPress } = |
| | 387 | useRemoteConnections(); |
| | 388 | const { connectedCloudEnvironments } = splitEnvironmentSections({ |
| | 389 | connectedEnvironments, |
| | 390 | cloudEnvironments: null, |
| | 391 | }); |
| | 392 | |
| | 393 | return ( |
| | 394 | <View collapsable={false} className="gap-2"> |
| | 395 | <Text className="px-4 text-sm font-t3-medium text-foreground-muted"> |
| | 396 | Or use the managed relay |
| | 397 | </Text> |
| | 398 | {isSignedIn ? ( |
| | 399 | <CloudEnvironmentRows |
| | 400 | connectedCloudEnvironments={connectedCloudEnvironments} |
| | 401 | onSetEnvironmentEnabled={onSetEnvironmentEnabled} |
| | 402 | onRemoveEnvironment={onRemoveEnvironmentPress} |
| | 403 | showHeader={false} |
| | 404 | /> |
| | 405 | ) : ( |
| | 406 | <Pressable |
| | 407 | accessibilityRole="button" |
| | 408 | disabled={!isLoaded} |
| | 409 | onPress={() => navigation.navigate("SettingsSheet", { screen: "SettingsAuth" })} |
| | 410 | className="min-h-13 flex-row items-center gap-3 rounded-[26px] border-continuous bg-grouped-card px-4 active:opacity-70" |
| | 411 | > |
| | 412 | <View className="min-w-0 flex-1 py-3"> |
| | 413 | <Text className="text-base text-foreground">Sign in to T3 Connect</Text> |
| | 414 | <Text className="text-sm text-foreground-muted"> |
| | 415 | Reach your machines from anywhere, no network setup. |
| | 416 | </Text> |
| | 417 | </View> |
| | 418 | <SymbolView |
| | 419 | name="chevron.right" |
| | 420 | size={14} |
| | 421 | tintColorClassName="accent-chevron" |
| | 422 | type="monochrome" |
| | 423 | weight="semibold" |
| | 424 | /> |
| | 425 | </Pressable> |
| | 426 | )} |
| | 427 | </View> |
| | 428 | ); |
| | 429 | } |
| | 430 | |
| | 431 | /** Inline grouped-list field: fixed label column, input filling the rest. */ |
| | 432 | function PairingInputRow({ |
| | 433 | label, |
| | 434 | ...inputProps |
| | 435 | }: Omit<AppTextInputProps, "accessibilityLabel" | "className"> & { |
| | 436 | readonly label: string; |
| | 437 | }) { |
| | 438 | return ( |
| | 439 | <View collapsable={false} className="h-13 flex-row items-center gap-3 px-4"> |
| | 440 | <Text |
| | 441 | accessibilityElementsHidden |
| | 442 | importantForAccessibility="no-hide-descendants" |
| | 443 | className="w-20 text-base leading-[23px] text-foreground-muted" |
| | 444 | > |
| | 445 | {label} |
| | 446 | </Text> |
| | 447 | <AppTextInput |
| | 448 | {...inputProps} |
| | 449 | accessibilityLabel={label} |
| | 450 | autoCapitalize="none" |
| | 451 | autoCorrect={false} |
| | 452 | className="min-h-0 flex-1 rounded-none border-0 bg-transparent p-0 text-base leading-[23px]" |
| | 453 | /> |
| | 454 | </View> |
| | 455 | ); |
| | 456 | } |