-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bb57863
commit b5658e1
Showing
9 changed files
with
115 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
src/screens/browse/settings/modals/ConcurrentSearchesModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import React from 'react'; | ||
import { Text, StyleSheet } from 'react-native'; | ||
|
||
import { Portal, Modal, overlay } from 'react-native-paper'; | ||
|
||
import { RadioButton } from '@components/RadioButton/RadioButton'; | ||
import { ThemeColors } from '@theme/types'; | ||
import { getString } from '@strings/translations'; | ||
import { useBrowseSettings } from '@hooks/persisted/index'; | ||
|
||
interface DisplayModeModalProps { | ||
globalSearchConcurrency: number; | ||
modalVisible: boolean; | ||
hideModal: () => void; | ||
theme: ThemeColors; | ||
} | ||
|
||
const ConcurrentSearchesModal: React.FC<DisplayModeModalProps> = ({ | ||
theme, | ||
globalSearchConcurrency, | ||
hideModal, | ||
modalVisible, | ||
}) => { | ||
const { setBrowseSettings } = useBrowseSettings(); | ||
|
||
return ( | ||
<Portal> | ||
<Modal | ||
visible={modalVisible} | ||
onDismiss={hideModal} | ||
contentContainerStyle={[ | ||
styles.containerStyle, | ||
{ backgroundColor: overlay(2, theme.surface) }, | ||
]} | ||
> | ||
<Text style={[styles.modalHeader, { color: theme.onSurface }]}> | ||
{getString('browseSettingsScreen.concurrentSearches')} | ||
</Text> | ||
{[1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(concurrency => ( | ||
<RadioButton | ||
key={concurrency} | ||
status={globalSearchConcurrency === concurrency} | ||
onPress={() => | ||
setBrowseSettings({ globalSearchConcurrency: concurrency }) | ||
} | ||
label={concurrency.toString()} | ||
theme={theme} | ||
/> | ||
))} | ||
</Modal> | ||
</Portal> | ||
); | ||
}; | ||
|
||
export default ConcurrentSearchesModal; | ||
|
||
const styles = StyleSheet.create({ | ||
containerStyle: { | ||
paddingVertical: 20, | ||
margin: 20, | ||
borderRadius: 28, | ||
}, | ||
modalHeader: { | ||
paddingHorizontal: 24, | ||
fontSize: 24, | ||
marginBottom: 10, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters