diff options
author | Ansh <anshnanda10@gmail.com> | 2023-06-23 10:48:52 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-23 12:48:52 -0500 |
commit | 08804f265e6ff8ec600295772baf8a72cbf5150d (patch) | |
tree | 1cacb5db38402483e637cb825aa5e308730804ff /src/view/com/modals/lang-settings/ConfirmLanguagesButton.tsx | |
parent | 9b19a95e638b2a5379560b5ffb27c423ad9a2e4e (diff) | |
download | voidsky-08804f265e6ff8ec600295772baf8a72cbf5150d.tar.zst |
[APP-690] better handling of post languages language filtering (#893)
* add SelectLangBtn * memoized objects that are created to reduce re-creation on re-render * add langs when uploading post * only send the top 3 languages otherwise backend will throw error * mv ContentLanguagesSettings to folder * add post languages settings modal and state * fix typos * modify feed manip to also check langs label on post * Fix tests * Remove log * Update feed-manip.ts * Fix syntax errors * UI tuneups * Show the currently selected languages in the composer * fix linting * Use a bcp-47 matching function * Fix a duplicate language issue * Fix web * Dont include lang in prompt * Make select language btn an observer * Keep device languages on top of language selection UIs * Fix android build settings * Enforce a max of 3 languages in posts * Fix tests * Fix types --------- Co-authored-by: Paul Frazee <pfrazee@gmail.com>
Diffstat (limited to 'src/view/com/modals/lang-settings/ConfirmLanguagesButton.tsx')
-rw-r--r-- | src/view/com/modals/lang-settings/ConfirmLanguagesButton.tsx | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/view/com/modals/lang-settings/ConfirmLanguagesButton.tsx b/src/view/com/modals/lang-settings/ConfirmLanguagesButton.tsx new file mode 100644 index 000000000..e1ecce589 --- /dev/null +++ b/src/view/com/modals/lang-settings/ConfirmLanguagesButton.tsx @@ -0,0 +1,52 @@ +import React from 'react' +import {StyleSheet, Text, View, Pressable} from 'react-native' +import LinearGradient from 'react-native-linear-gradient' +import {s, colors, gradients} from 'lib/styles' +import {isDesktopWeb} from 'platform/detection' +import {usePalette} from 'lib/hooks/usePalette' + +export const ConfirmLanguagesButton = ({ + onPress, + extraText, +}: { + onPress: () => void + extraText?: string +}) => { + const pal = usePalette('default') + return ( + <View style={[styles.btnContainer, pal.borderDark]}> + <Pressable + testID="confirmContentLanguagesBtn" + onPress={onPress} + accessibilityRole="button" + accessibilityLabel="Confirm content language settings" + accessibilityHint=""> + <LinearGradient + colors={[gradients.blueLight.start, gradients.blueLight.end]} + start={{x: 0, y: 0}} + end={{x: 1, y: 1}} + style={[styles.btn]}> + <Text style={[s.white, s.bold, s.f18]}>Done{extraText}</Text> + </LinearGradient> + </Pressable> + </View> + ) +} + +const styles = StyleSheet.create({ + btnContainer: { + paddingTop: 10, + paddingHorizontal: 10, + paddingBottom: isDesktopWeb ? 0 : 40, + borderTopWidth: isDesktopWeb ? 0 : 1, + }, + btn: { + flexDirection: 'row', + alignItems: 'center', + justifyContent: 'center', + width: '100%', + borderRadius: 32, + padding: 14, + backgroundColor: colors.gray1, + }, +}) |