| ... | @@ -24,13 +24,7 @@ import { availableCloudEnvironmentPresentation } from "../cloud/cloudEnvironment | ... | @@ -24,13 +24,7 @@ import { availableCloudEnvironmentPresentation } from "../cloud/cloudEnvironment |
| 24 | import { ConnectionStatusDot } from "./ConnectionStatusDot"; | 24 | import { ConnectionStatusDot } from "./ConnectionStatusDot"; |
| 25 | import { type RelayEnvironmentView, useConnectionController } from "./useConnectionController"; | 25 | import { type RelayEnvironmentView, useConnectionController } from "./useConnectionController"; |
| 26 | | 26 | |
| 27 | /** | 27 | interface CloudEnvironmentRowsProps { |
| 28 | * "T3 Connect" section: every environment published to the signed-in account, | | |
| 29 | * with connect switches, availability status, refresh, and loading/error | | |
| 30 | * states. Shared between the Settings environments screen and the T3 Connect | | |
| 31 | * onboarding sheet. | | |
| 32 | */ | | |
| 33 | export function CloudEnvironmentRows(props: { | | |
| 34 | readonly connectedCloudEnvironments: ReadonlyArray<ConnectedEnvironmentSummary>; | 28 | readonly connectedCloudEnvironments: ReadonlyArray<ConnectedEnvironmentSummary>; |
| 35 | readonly onReconnectEnvironment: (environmentId: EnvironmentId) => void; | 29 | readonly onReconnectEnvironment: (environmentId: EnvironmentId) => void; |
| 36 | readonly showcaseAvailableEnvironments?: ReadonlyArray<RelayEnvironmentView>; | 30 | readonly showcaseAvailableEnvironments?: ReadonlyArray<RelayEnvironmentView>; |
| ... | @@ -41,8 +35,31 @@ export function CloudEnvironmentRows(props: { | ... | @@ -41,8 +35,31 @@ export function CloudEnvironmentRows(props: { |
| 41 | * pull-to-refresh). | 35 | * pull-to-refresh). |
| 42 | */ | 36 | */ |
| 43 | readonly showHeader?: boolean; | 37 | readonly showHeader?: boolean; |
| 44 | }) { | 38 | } |
| | 39 | |
| | 40 | /** |
| | 41 | * "T3 Connect" section: every environment published to the signed-in account, |
| | 42 | * with connect switches, availability status, refresh, and loading/error |
| | 43 | * states. Shared between the Settings environments screen and the T3 Connect |
| | 44 | * onboarding sheet. |
| | 45 | */ |
| | 46 | export function CloudEnvironmentRows(props: CloudEnvironmentRowsProps) { |
| | 47 | // Showcase captures run without a Clerk publishable key, so `ClerkProvider` |
| | 48 | // is never mounted and any `useAuth` call throws — the fixture states whether |
| | 49 | // the rows are signed in instead of asking Clerk. |
| | 50 | if (props.showcaseSignedIn !== undefined) { |
| | 51 | return props.showcaseSignedIn ? <CloudEnvironmentRowsContent {...props} /> : null; |
| | 52 | } |
| | 53 | return <SignedInCloudEnvironmentRows {...props} />; |
| | 54 | } |
| | 55 | |
| | 56 | function SignedInCloudEnvironmentRows(props: CloudEnvironmentRowsProps) { |
| 45 | const { isSignedIn } = useAuth({ treatPendingAsSignedOut: false }); | 57 | const { isSignedIn } = useAuth({ treatPendingAsSignedOut: false }); |
| | 58 | if (!isSignedIn) return null; |
| | 59 | return <CloudEnvironmentRowsContent {...props} />; |
| | 60 | } |
| | 61 | |
| | 62 | function CloudEnvironmentRowsContent(props: CloudEnvironmentRowsProps) { |
| 46 | const controller = useConnectionController(); | 63 | const controller = useConnectionController(); |
| 47 | const iconColor = useThemeColor("--color-icon"); | 64 | const iconColor = useThemeColor("--color-icon"); |
| 48 | const availableCloudEnvironments = | 65 | const availableCloudEnvironments = |
| ... | @@ -67,8 +84,6 @@ export function CloudEnvironmentRows(props: { | ... | @@ -67,8 +84,6 @@ export function CloudEnvironmentRows(props: { |
| 67 | | 84 | |
| 68 | const showHeader = props.showHeader ?? true; | 85 | const showHeader = props.showHeader ?? true; |
| 69 | | 86 | |
| 70 | if (!(props.showcaseSignedIn ?? isSignedIn)) return null; | | |
| 71 | | | |
| 72 | return ( | 87 | return ( |
| 73 | <View collapsable={false} className={cn("gap-3", showHeader && "mt-5")}> | 88 | <View collapsable={false} className={cn("gap-3", showHeader && "mt-5")}> |
| 74 | {showHeader ? ( | 89 | {showHeader ? ( |