| ... | @@ -40,7 +40,6 @@ import { AppText as Text } from "../../components/AppText"; | ... | @@ -40,7 +40,6 @@ import { AppText as Text } from "../../components/AppText"; |
| 40 | import { AndroidScreenHeader } from "../../components/AndroidScreenHeader"; | 40 | import { AndroidScreenHeader } from "../../components/AndroidScreenHeader"; |
| 41 | import { MaterialButton } from "../../components/MaterialButton"; | 41 | import { MaterialButton } from "../../components/MaterialButton"; |
| 42 | import { MaterialIconButton } from "../../components/MaterialIconButton"; | 42 | import { MaterialIconButton } from "../../components/MaterialIconButton"; |
| 43 | import { MaterialRadioIndicator } from "../../components/MaterialRadioIndicator"; | | |
| 44 | import { ProviderIcon } from "../../components/ProviderIcon"; | 43 | import { ProviderIcon } from "../../components/ProviderIcon"; |
| 45 | import { ThemedSwitch } from "../../components/ThemedSwitch"; | 44 | import { ThemedSwitch } from "../../components/ThemedSwitch"; |
| 46 | import { cn } from "../../lib/cn"; | 45 | import { cn } from "../../lib/cn"; |
| ... | @@ -69,6 +68,7 @@ import { | ... | @@ -69,6 +68,7 @@ import { |
| 69 | NATIVE_MAIL_SEARCH_TOOLBAR_CONTENT_INSET, | 68 | NATIVE_MAIL_SEARCH_TOOLBAR_CONTENT_INSET, |
| 70 | NATIVE_MAIL_SEARCH_TOOLBAR_SUPPORTED, | 69 | NATIVE_MAIL_SEARCH_TOOLBAR_SUPPORTED, |
| 71 | } from "../layout/native-mail-search-toolbar"; | 70 | } from "../layout/native-mail-search-toolbar"; |
| | 71 | import { ModelRow, ChoiceRow } from "./ThreadSettingsRows"; |
| 72 | import { RUNTIME_MODE_CHOICES, selectableChoices } from "./thread-settings-options"; | 72 | import { RUNTIME_MODE_CHOICES, selectableChoices } from "./thread-settings-options"; |
| 73 | import { | 73 | import { |
| 74 | canCommitPendingModel, | 74 | canCommitPendingModel, |
| ... | @@ -113,101 +113,6 @@ const EMPTY_MODEL_FAVORITES: ReadonlyArray<{ | ... | @@ -113,101 +113,6 @@ const EMPTY_MODEL_FAVORITES: ReadonlyArray<{ |
| 113 | readonly model: string; | 113 | readonly model: string; |
| 114 | }> = []; | 114 | }> = []; |
| 115 | const FAVORITES_PROVIDER_FILTER = "@favorites"; | 115 | const FAVORITES_PROVIDER_FILTER = "@favorites"; |
| 116 | function ModelRow(props: { | | |
| 117 | readonly option: ModelOption; | | |
| 118 | readonly selected: boolean; | | |
| 119 | readonly onPress: () => void; | | |
| 120 | readonly isFavorite: boolean; | | |
| 121 | readonly favoritesLoaded: boolean; | | |
| 122 | readonly onToggleFavorite: () => void; | | |
| 123 | readonly isFirst: boolean; | | |
| 124 | readonly isLast: boolean; | | |
| 125 | }) { | | |
| 126 | const selectedMaterialRow = Platform.OS === "android" && props.selected; | | |
| 127 | return ( | | |
| 128 | <View | | |
| 129 | style={Platform.OS === "android" ? { minHeight: 56 } : undefined} | | |
| 130 | className={cn( | | |
| 131 | "mx-4 min-h-11 flex-row items-center gap-2 bg-card px-4", | | |
| 132 | selectedMaterialRow && "bg-thread-selected", | | |
| 133 | props.isFirst && "rounded-t-2xl", | | |
| 134 | props.isLast ? "rounded-b-2xl" : "border-b border-border-subtle", | | |
| 135 | )} | | |
| 136 | > | | |
| 137 | <Pressable | | |
| 138 | accessibilityLabel={[props.option.label, props.option.subtitle].filter(Boolean).join(", ")} | | |
| 139 | accessibilityRole="radio" | | |
| 140 | accessibilityState={{ | | |
| 141 | checked: props.selected, | | |
| 142 | disabled: props.option.isUnavailable === true, | | |
| 143 | }} | | |
| 144 | className="min-h-11 min-w-0 flex-1 flex-row items-center gap-2 active:opacity-70" | | |
| 145 | disabled={props.option.isUnavailable} | | |
| 146 | onPress={props.onPress} | | |
| 147 | > | | |
| 148 | {Platform.OS === "android" ? <MaterialRadioIndicator selected={props.selected} /> : null} | | |
| 149 | <View className="min-w-0 flex-1"> | | |
| 150 | <View className="flex-row items-center gap-2"> | | |
| 151 | <Text | | |
| 152 | className="min-w-0 shrink text-base font-t3-medium text-foreground" | | |
| 153 | numberOfLines={Platform.OS === "android" ? 2 : 1} | | |
| 154 | > | | |
| 155 | {props.option.label} | | |
| 156 | </Text> | | |
| 157 | {props.option.isDefault ? ( | | |
| 158 | <View className="rounded-md bg-subtle-strong px-1.5 py-0.5"> | | |
| 159 | <Text className="text-3xs font-t3-bold text-foreground-muted">Default</Text> | | |
| 160 | </View> | | |
| 161 | ) : null} | | |
| 162 | {props.option.isLegacy ? ( | | |
| 163 | <View className="rounded-md bg-subtle px-1.5 py-0.5"> | | |
| 164 | <Text className="text-3xs font-t3-bold text-foreground-muted">Legacy</Text> | | |
| 165 | </View> | | |
| 166 | ) : null} | | |
| 167 | {props.option.isUnavailable ? ( | | |
| 168 | <Text className="text-xs text-foreground">Unavailable</Text> | | |
| 169 | ) : null} | | |
| 170 | </View> | | |
| 171 | {props.option.subtitle ? ( | | |
| 172 | <Text | | |
| 173 | className="text-xs text-foreground-muted" | | |
| 174 | numberOfLines={Platform.OS === "android" ? 2 : 1} | | |
| 175 | > | | |
| 176 | {props.option.subtitle} | | |
| 177 | </Text> | | |
| 178 | ) : null} | | |
| 179 | </View> | | |
| 180 | {props.selected && Platform.OS !== "android" ? ( | | |
| 181 | <SymbolView | | |
| 182 | name="checkmark" | | |
| 183 | size={16} | | |
| 184 | tintColorClassName="accent-icon" | | |
| 185 | type="monochrome" | | |
| 186 | weight="semibold" | | |
| 187 | /> | | |
| 188 | ) : null} | | |
| 189 | </Pressable> | | |
| 190 | <Pressable | | |
| 191 | accessibilityLabel={`${props.isFavorite ? "Remove from" : "Add to"} favorites: ${ | | |
| 192 | props.option.providerLabel | | |
| 193 | }, ${props.option.label}`} | | |
| 194 | accessibilityRole="button" | | |
| 195 | accessibilityState={{ disabled: !props.favoritesLoaded, selected: props.isFavorite }} | | |
| 196 | className="min-h-11 min-w-11 items-center justify-center" | | |
| 197 | disabled={!props.favoritesLoaded} | | |
| 198 | onPress={props.onToggleFavorite} | | |
| 199 | > | | |
| 200 | <SymbolView | | |
| 201 | name={props.isFavorite ? "star.fill" : "star"} | | |
| 202 | size={18} | | |
| 203 | tintColorClassName={props.isFavorite ? "accent-icon" : "accent-icon-subtle"} | | |
| 204 | type="monochrome" | | |
| 205 | /> | | |
| 206 | </Pressable> | | |
| 207 | </View> | | |
| 208 | ); | | |
| 209 | } | | |
| 210 | | | |
| 211 | /** Provider catalog header with its harness logo and disclosure state. */ | 116 | /** Provider catalog header with its harness logo and disclosure state. */ |
| 212 | function ProviderHeader(props: { | 117 | function ProviderHeader(props: { |
| 213 | readonly driver: string | undefined; | 118 | readonly driver: string | undefined; |
| ... | @@ -296,46 +201,6 @@ function DisclosureRow(props: { | ... | @@ -296,46 +201,6 @@ function DisclosureRow(props: { |
| 296 | ); | 201 | ); |
| 297 | } | 202 | } |
| 298 | | 203 | |
| 299 | /** Single option inside a submenu panel. */ | | |
| 300 | function ChoiceRow(props: { | | |
| 301 | readonly label: string; | | |
| 302 | readonly description?: string; | | |
| 303 | readonly selected: boolean; | | |
| 304 | readonly onPress: () => void; | | |
| 305 | readonly isLast: boolean; | | |
| 306 | }) { | | |
| 307 | return ( | | |
| 308 | <Pressable | | |
| 309 | accessibilityLabel={props.description ? `${props.label}. ${props.description}` : props.label} | | |
| 310 | accessibilityRole="radio" | | |
| 311 | accessibilityState={{ checked: props.selected }} | | |
| 312 | onPress={props.onPress} | | |
| 313 | style={Platform.OS === "android" ? { minHeight: 56 } : undefined} | | |
| 314 | className={cn( | | |
| 315 | "min-h-14 flex-row items-center gap-3 bg-card px-4 py-3 active:bg-subtle", | | |
| 316 | !props.isLast && "border-b border-border-subtle", | | |
| 317 | )} | | |
| 318 | > | | |
| 319 | {Platform.OS === "android" ? <MaterialRadioIndicator selected={props.selected} /> : null} | | |
| 320 | <View className="min-w-0 flex-1 gap-0.5"> | | |
| 321 | <Text className="text-base font-t3-medium text-foreground">{props.label}</Text> | | |
| 322 | {props.description ? ( | | |
| 323 | <Text className="text-sm leading-5 text-foreground-muted">{props.description}</Text> | | |
| 324 | ) : null} | | |
| 325 | </View> | | |
| 326 | {props.selected && Platform.OS !== "android" ? ( | | |
| 327 | <SymbolView | | |
| 328 | name="checkmark" | | |
| 329 | size={16} | | |
| 330 | tintColorClassName="accent-icon" | | |
| 331 | type="monochrome" | | |
| 332 | weight="semibold" | | |
| 333 | /> | | |
| 334 | ) : null} | | |
| 335 | </Pressable> | | |
| 336 | ); | | |
| 337 | } | | |
| 338 | | | |
| 339 | function SwitchRow(props: { | 204 | function SwitchRow(props: { |
| 340 | readonly label: string; | 205 | readonly label: string; |
| 341 | readonly value: boolean; | 206 | readonly value: boolean; |