({ handlePresentModalPress })
| 4 | import { Model, Theme } from '../../types' |
| 5 | |
| 6 | export function ChatModelModal({ handlePresentModalPress }: { handlePresentModalPress: () => void }) { |
| 7 | const { theme } = useContext(ThemeContext) |
| 8 | const { setChatType, chatType, models } = useContext(AppContext) |
| 9 | const styles = getStyles(theme) |
| 10 | const options = models |
| 11 | |
| 12 | function _setChatType(v: Model) { |
| 13 | setChatType(v) |
| 14 | handlePresentModalPress() |
| 15 | } |
| 16 | |
| 17 | return ( |
| 18 | <View style={styles.bottomSheetContainer}> |
| 19 | <View> |
| 20 | <View style={styles.chatOptionsTextContainer}> |
| 21 | <Text style={styles.chatOptionsText}> |
| 22 | Models |
| 23 | </Text> |
| 24 | </View> |
| 25 | { |
| 26 | options.map((option, index) => ( |
| 27 | <TouchableHighlight |
| 28 | underlayColor={'transparent'} |
| 29 | onPress={() => _setChatType(option)} |
| 30 | accessibilityRole="button" |
| 31 | accessibilityLabel={`Select model ${option.name}`} |
| 32 | key={index}> |
| 33 | <View style={optionContainer(theme, chatType.label, option.label)}> |
| 34 | <option.icon |
| 35 | size={20} |
| 36 | theme={theme} |
| 37 | selected={chatType.label === option.label} |
| 38 | /> |
| 39 | <Text style={optionText(theme, chatType.label, option.label)}> |
| 40 | {option.name} |
| 41 | </Text> |
| 42 | </View> |
| 43 | </TouchableHighlight> |
| 44 | )) |
| 45 | } |
| 46 | </View> |
| 47 | </View> |
| 48 | ) |
| 49 | } |
| 50 |
nothing calls this directly
no test coverage detected