Add WIP for customization section
This commit is contained in:
@@ -6,13 +6,18 @@ import AppText from './app-text'
|
|||||||
|
|
||||||
import { Containers } from '../../styles'
|
import { Containers } from '../../styles'
|
||||||
|
|
||||||
const AppSwitch = ({ onToggle, text, value }) => {
|
const AppSwitch = ({ onToggle, text, value, trackColor }) => {
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
<View style={styles.textContainer}>
|
<View style={styles.textContainer}>
|
||||||
<AppText>{text}</AppText>
|
<AppText>{text}</AppText>
|
||||||
</View>
|
</View>
|
||||||
<Switch onValueChange={onToggle} style={styles.switch} value={value} />
|
<Switch
|
||||||
|
onValueChange={onToggle}
|
||||||
|
style={styles.switch}
|
||||||
|
value={value}
|
||||||
|
trackColor={trackColor}
|
||||||
|
/>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -21,6 +26,7 @@ AppSwitch.propTypes = {
|
|||||||
onToggle: PropTypes.func.isRequired,
|
onToggle: PropTypes.func.isRequired,
|
||||||
text: PropTypes.string,
|
text: PropTypes.string,
|
||||||
value: PropTypes.bool,
|
value: PropTypes.bool,
|
||||||
|
trackColor: PropTypes.string,
|
||||||
}
|
}
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import React, { useState } from 'react'
|
import React, { useState } from 'react'
|
||||||
import { Platform, StyleSheet, View } from 'react-native'
|
|
||||||
|
|
||||||
import AppIcon from '../../common/app-icon'
|
|
||||||
import AppPage from '../../common/app-page'
|
import AppPage from '../../common/app-page'
|
||||||
import AppSwitch from '../../common/app-switch'
|
import AppSwitch from '../../common/app-switch'
|
||||||
import AppText from '../../common/app-text'
|
import AppText from '../../common/app-text'
|
||||||
@@ -9,7 +7,7 @@ import TemperatureSlider from './temperature-slider'
|
|||||||
import Segment from '../../common/segment'
|
import Segment from '../../common/segment'
|
||||||
|
|
||||||
import { useCervixObservable, saveUseCervix } from '../../../local-storage'
|
import { useCervixObservable, saveUseCervix } from '../../../local-storage'
|
||||||
import { Colors, Spacing, Typography } from '../../../styles'
|
import { Colors } from '../../../styles'
|
||||||
import labels from '../../../i18n/en/settings'
|
import labels from '../../../i18n/en/settings'
|
||||||
|
|
||||||
const Settings = () => {
|
const Settings = () => {
|
||||||
@@ -17,6 +15,9 @@ const Settings = () => {
|
|||||||
useCervixObservable.value
|
useCervixObservable.value
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const [isEnabled, setIsEnabled] = useState(false)
|
||||||
|
const toggleSwitch = () => setIsEnabled((previousState) => !previousState)
|
||||||
|
|
||||||
const onCervixToggle = (value) => {
|
const onCervixToggle = (value) => {
|
||||||
setShouldUseCervix(value)
|
setShouldUseCervix(value)
|
||||||
saveUseCervix(value)
|
saveUseCervix(value)
|
||||||
@@ -27,47 +28,93 @@ const Settings = () => {
|
|||||||
: labels.useCervix.cervixModeOff
|
: labels.useCervix.cervixModeOff
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AppPage>
|
<AppPage title={'Customization'}>
|
||||||
|
<Segment title={'Tracking categories'}>
|
||||||
|
<AppSwitch
|
||||||
|
onToggle={toggleSwitch}
|
||||||
|
text={'temperature'}
|
||||||
|
value={isEnabled}
|
||||||
|
trackColor={{ true: Colors.turquoiseDark }}
|
||||||
|
/>
|
||||||
|
<AppSwitch
|
||||||
|
onToggle={toggleSwitch}
|
||||||
|
text={'cervical mucus'}
|
||||||
|
value={isEnabled}
|
||||||
|
trackColor={{ true: Colors.turquoiseDark }}
|
||||||
|
/>
|
||||||
|
<AppSwitch
|
||||||
|
onToggle={toggleSwitch}
|
||||||
|
text={'cervix'}
|
||||||
|
value={isEnabled}
|
||||||
|
trackColor={{ true: Colors.turquoiseDark }}
|
||||||
|
/>
|
||||||
|
<AppSwitch
|
||||||
|
onToggle={toggleSwitch}
|
||||||
|
text={'sex'}
|
||||||
|
value={isEnabled}
|
||||||
|
trackColor={{ true: Colors.turquoiseDark }}
|
||||||
|
/>
|
||||||
|
<AppSwitch
|
||||||
|
onToggle={toggleSwitch}
|
||||||
|
text={'desire'}
|
||||||
|
value={isEnabled}
|
||||||
|
trackColor={{ true: Colors.turquoiseDark }}
|
||||||
|
/>
|
||||||
|
<AppSwitch
|
||||||
|
onToggle={toggleSwitch}
|
||||||
|
text={'pain'}
|
||||||
|
value={isEnabled}
|
||||||
|
trackColor={{ true: Colors.turquoiseDark }}
|
||||||
|
/>
|
||||||
|
<AppSwitch
|
||||||
|
onToggle={toggleSwitch}
|
||||||
|
text={'mood'}
|
||||||
|
value={isEnabled}
|
||||||
|
trackColor={{ true: Colors.turquoiseDark }}
|
||||||
|
/>
|
||||||
|
<AppSwitch
|
||||||
|
onToggle={toggleSwitch}
|
||||||
|
text={'note'}
|
||||||
|
value={isEnabled}
|
||||||
|
trackColor={{ true: Colors.turquoiseDark }}
|
||||||
|
/>
|
||||||
|
</Segment>
|
||||||
|
|
||||||
|
<Segment title={'Fertility feature'}>
|
||||||
|
<AppSwitch
|
||||||
|
onToggle={toggleSwitch}
|
||||||
|
text={'If turned on ...'}
|
||||||
|
value={isEnabled}
|
||||||
|
trackColor={{ true: Colors.turquoiseDark }}
|
||||||
|
/>
|
||||||
|
</Segment>
|
||||||
|
|
||||||
|
<Segment title={labels.tempScale.segmentTitle}>
|
||||||
|
<AppText>{labels.tempScale.segmentExplainer}</AppText>
|
||||||
|
<TemperatureSlider />
|
||||||
|
</Segment>
|
||||||
|
|
||||||
<Segment title={labels.useCervix.title}>
|
<Segment title={labels.useCervix.title}>
|
||||||
<AppSwitch
|
<AppSwitch
|
||||||
onToggle={onCervixToggle}
|
onToggle={onCervixToggle}
|
||||||
text={cervixText}
|
text={cervixText}
|
||||||
value={shouldUseCervix}
|
value={shouldUseCervix}
|
||||||
|
trackColor={{ true: Colors.turquoiseDark }}
|
||||||
/>
|
/>
|
||||||
</Segment>
|
</Segment>
|
||||||
{/* for iOS disabled temporarily, TODO https://gitlab.com/bloodyhealth/drip/-/issues/545 */}
|
|
||||||
{Platform.OS !== 'ios' && (
|
<Segment title={'Period prediction'}>
|
||||||
<Segment title={labels.tempScale.segmentTitle}>
|
<AppSwitch
|
||||||
<AppText>{labels.tempScale.segmentExplainer}</AppText>
|
onToggle={toggleSwitch}
|
||||||
<TemperatureSlider />
|
text={
|
||||||
</Segment>
|
'If turned on drip will predict your next menstrual bleeding, after you have tracked 3 complete menstrual cycles.'
|
||||||
)}
|
}
|
||||||
<Segment last>
|
value={isEnabled}
|
||||||
<View style={styles.line}>
|
trackColor={{ true: Colors.turquoiseDark }}
|
||||||
<AppIcon
|
|
||||||
color={Colors.purple}
|
|
||||||
name="info-with-circle"
|
|
||||||
style={styles.icon}
|
|
||||||
/>
|
/>
|
||||||
<AppText style={styles.title}>{labels.preOvu.title}</AppText>
|
|
||||||
</View>
|
|
||||||
<AppText>{labels.preOvu.note}</AppText>
|
|
||||||
</Segment>
|
</Segment>
|
||||||
</AppPage>
|
</AppPage>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Settings
|
export default Settings
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
|
||||||
icon: {
|
|
||||||
marginRight: Spacing.base,
|
|
||||||
},
|
|
||||||
line: {
|
|
||||||
flexDirection: 'row',
|
|
||||||
alignItems: 'center',
|
|
||||||
},
|
|
||||||
title: {
|
|
||||||
...Typography.subtitle,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|||||||
Reference in New Issue
Block a user