The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import { T } from "gt-react-native"; |
| 2 | import type { EnvironmentId } from "@t3tools/contracts"; |
| 3 | import type { ComponentProps } from "react"; |
| 4 | import { View } from "react-native"; |
| 5 | |
| 6 | import { SymbolView } from "../../components/ui/AppSymbol"; |
| 7 | import { AppText as Text } from "../../components/ui/AppText"; |
| 8 | import { ConnectionEnvironmentRow } from "./ConnectionEnvironmentRow"; |
| 9 | |
| 10 | type EnvironmentRowProps = ComponentProps<typeof ConnectionEnvironmentRow>; |
| 11 | |
| 12 | export function LocalEnvironmentList({ |
| 13 | environments, |
| 14 | expandedId, |
| 15 | onToggle, |
| 16 | ...rowActions |
| 17 | }: Pick< |
| 18 | EnvironmentRowProps, |
| 19 | "onReconnect" | "onRemove" | "onSetEnabled" | "onUpdate" | "opensDetails" |
| 20 | > & { |
| 21 | readonly environments: ReadonlyArray<EnvironmentRowProps["environment"]>; |
| 22 | readonly expandedId: EnvironmentId | null; |
| 23 | readonly onToggle: (environmentId: EnvironmentId) => void; |
| 24 | }) { |
| 25 | if (environments.length === 0) { |
| 26 | return ( |
| 27 | <View |
| 28 | collapsable={false} |
| 29 | className="items-center gap-3 rounded-[24px] bg-grouped-card px-6 py-8" |
| 30 | > |
| 31 | <View className="h-12 w-12 items-center justify-center rounded-[16px] bg-subtle"> |
| 32 | <SymbolView |
| 33 | name="point.3.connected.trianglepath.dotted" |
| 34 | size={20} |
| 35 | tintColorClassName="accent-icon-muted" |
| 36 | type="monochrome" |
| 37 | /> |
| 38 | </View> |
| 39 | <Text className="text-center text-sm leading-normal text-foreground-muted"> |
| 40 | <T>No environments connected yet.</T> |
| 41 | {"\n"} |
| 42 | <T> |
| 43 | Tap <Text className="font-t3-bold text-foreground">+</Text> to add one. |
| 44 | </T> |
| 45 | </Text> |
| 46 | </View> |
| 47 | ); |
| 48 | } |
| 49 | |
| 50 | return ( |
| 51 | <View collapsable={false} className="overflow-hidden rounded-[24px] bg-grouped-card"> |
| 52 | {environments.map((environment) => ( |
| 53 | <View key={environment.environmentId} collapsable={false}> |
| 54 | <ConnectionEnvironmentRow |
| 55 | environment={environment} |
| 56 | expanded={expandedId === environment.environmentId} |
| 57 | onToggle={() => onToggle(environment.environmentId)} |
| 58 | {...rowActions} |
| 59 | /> |
| 60 | </View> |
| 61 | ))} |
| 62 | </View> |
| 63 | ); |
| 64 | } |