Don't show the exclude switch when fertility is off

This commit is contained in:
bl00dymarie
2024-03-16 14:34:28 +01:00
parent e33c13e5e0
commit b481bd8352
+14 -9
View File
@@ -15,6 +15,7 @@ import Temperature from './temperature'
import { blank, save, shouldShow, symtomPage } from '../helpers/cycle-day' import { blank, save, shouldShow, symtomPage } from '../helpers/cycle-day'
import { showToast } from '../helpers/general' import { showToast } from '../helpers/general'
import { fertilityTrackingObservable } from '../../local-storage'
import { shared as sharedLabels } from '../../i18n/en/labels' import { shared as sharedLabels } from '../../i18n/en/labels'
import info from '../../i18n/en/symptom-info' import info from '../../i18n/en/symptom-info'
import { Colors, Containers, Sizes, Spacing } from '../../styles' import { Colors, Containers, Sizes, Spacing } from '../../styles'
@@ -25,6 +26,7 @@ const SymptomEditView = ({ date, onClose, symptom, symptomData }) => {
const [shouldShowInfo, setShouldShowInfo] = useState(false) const [shouldShowInfo, setShouldShowInfo] = useState(false)
const getParsedData = () => JSON.parse(JSON.stringify(data)) const getParsedData = () => JSON.parse(JSON.stringify(data))
const onPressLearnMore = () => setShouldShowInfo(!shouldShowInfo) const onPressLearnMore = () => setShouldShowInfo(!shouldShowInfo)
const isFertilityTrackingEnabled = fertilityTrackingObservable.value
const onEditNote = (note) => { const onEditNote = (note) => {
const parsedData = getParsedData() const parsedData = getParsedData()
@@ -167,15 +169,18 @@ const SymptomEditView = ({ date, onClose, symptom, symptomData }) => {
</Segment> </Segment>
) )
})} })}
{shouldShow(symptomConfig.excludeText) && ( {/* show exclude AppSwitch for bleeding, mucus, cervix, temperature */}
<Segment style={styles.segmentBorder}> {/* but if fertility is off only for bleeding */}
<AppSwitch {shouldShow(symptomConfig.excludeText) &&
onToggle={onExcludeToggle} (symptom === 'bleeding' || isFertilityTrackingEnabled) && (
text={symtomPage[symptom].excludeText} <Segment style={styles.segmentBorder}>
value={data.exclude} <AppSwitch
/> onToggle={onExcludeToggle}
</Segment> text={symtomPage[symptom].excludeText}
)} value={data.exclude}
/>
</Segment>
)}
{shouldShow(symptomConfig.note) && ( {shouldShow(symptomConfig.note) && (
<Segment style={styles.segmentBorder}> <Segment style={styles.segmentBorder}>
<AppText>{symtomPage[symptom].note}</AppText> <AppText>{symtomPage[symptom].note}</AppText>