| 1 | import { Pressable, View } from "react-native"; |
| 2 | |
| 3 | import { AppText as Text } from "../../../components/AppText"; |
| 4 | import { SettingsSection } from "./SettingsSection"; |
| 5 | |
| 6 | export function SettingsProjectOverridesSection(props: { |
| 7 | readonly projectLabel: string; |
| 8 | readonly hasOverrides: boolean; |
| 9 | readonly supportsOverrides: boolean; |
| 10 | readonly pending: boolean; |
| 11 | readonly disabled?: boolean; |
| 12 | readonly onClear: () => void; |
| 13 | }) { |
| 14 | return ( |
| 15 | <SettingsSection title="Project"> |
| 16 | <View className="min-h-16 flex-row items-center gap-3 px-4 py-3"> |
| 17 | <Text className="min-w-0 flex-1 text-base text-foreground" numberOfLines={2}> |
| 18 | {props.projectLabel} |
| 19 | </Text> |
| 20 | {!props.pending && props.supportsOverrides && props.hasOverrides ? ( |
| 21 | <Pressable |
| 22 | accessibilityRole="button" |
| 23 | accessibilityLabel="Use environment defaults" |
| 24 | disabled={props.disabled} |
| 25 | onPress={props.onClear} |
| 26 | className="px-2 py-2 active:opacity-70" |
| 27 | > |
| 28 | <Text className="text-sm font-t3-medium text-primary-text">Use defaults</Text> |
| 29 | </Pressable> |
| 30 | ) : null} |
| 31 | </View> |
| 32 | {!props.supportsOverrides ? ( |
| 33 | <Text className="px-4 pb-3 text-sm text-foreground-muted"> |
| 34 | Update the selected environments to edit project overrides. |
| 35 | </Text> |
| 36 | ) : null} |
| 37 | </SettingsSection> |
| 38 | ); |
| 39 | } |