If existing display mucus feeling and texture value on button

This commit is contained in:
emelko
2018-07-04 14:14:05 +02:00
parent bb27cb0983
commit 9ab4bd0dfa
+15 -13
View File
@@ -6,11 +6,12 @@ import {
} from 'react-native' } from 'react-native'
import styles from '../../styles' import styles from '../../styles'
import { import {
bleedingLabels as bleedingLabels, bleeding as labels,
mucusFeeling as feelingLabels mucusFeeling as feelingLabels,
} from './labels/labels' mucusTexture as textureLabels,
import cycleDayModule from '../../lib/get-cycle-day-number' } from '../labels/labels'
import { bleedingDaysSortedByDate } from '../../db' import cycleDayModule from '../lib/get-cycle-day-number'
import { bleedingDaysSortedByDate } from '../db'
const getCycleDayNumber = cycleDayModule() const getCycleDayNumber = cycleDayModule()
@@ -42,7 +43,7 @@ export default class DayView extends Component {
const bleedingValue = this.cycleDay.bleeding && this.cycleDay.bleeding.value const bleedingValue = this.cycleDay.bleeding && this.cycleDay.bleeding.value
let bleedingLabel let bleedingLabel
if (typeof bleedingValue === 'number') { if (typeof bleedingValue === 'number') {
bleedingLabel = `${bleedingLabels[bleedingValue]}` bleedingLabel = `${labels[bleedingValue]}`
if (this.cycleDay.bleeding.exclude) bleedingLabel = "( " + bleedingLabel + " )" if (this.cycleDay.bleeding.exclude) bleedingLabel = "( " + bleedingLabel + " )"
} else { } else {
bleedingLabel = 'edit' bleedingLabel = 'edit'
@@ -58,13 +59,14 @@ export default class DayView extends Component {
temperatureLabel = 'edit' temperatureLabel = 'edit'
} }
const mucusFeelingValue = this.cycleDay.mucus && this.cycleDay.mucus.value const mucusFeelingValue = this.cycleDay.mucus && this.cycleDay.mucus.feeling
let mucusFeelingLabel const mucusTextureValue = this.cycleDay.mucus && this.cycleDay.mucus.texture
if (typeof mucusFeelingValue === 'number') { let mucusLabel
mucusFeelingLabel = `${feelingLabels[mucusFeelingValue]}` if (typeof mucusFeelingValue === 'number' && typeof mucusTextureValue === 'number') {
if (this.cycleDay.mucus.exclude) mucusFeelingLabel = "( " + mucusFeelingLabel + " )" mucusLabel = `${feelingLabels[mucusFeelingValue]} + ${textureLabels[mucusTextureValue]}`
if (this.cycleDay.mucus.exclude) mucusLabel = "( " + mucusLabel + " )"
} else { } else {
mucusFeelingLabel = 'edit' mucusLabel = 'edit'
} }
return ( return (
@@ -94,7 +96,7 @@ export default class DayView extends Component {
<View style={ styles.singleButtonView }> <View style={ styles.singleButtonView }>
<Button <Button
onPress={() => this.showView('mucusEditView')} onPress={() => this.showView('mucusEditView')}
title={mucusFeelingLabel}> title={mucusLabel}>
</Button> </Button>
</View> </View>
</View> </View>