Adds cervix to symptoms:

has 3 properties: opening, firmness and position (which is optional);
This commit is contained in:
emelko
2018-07-20 12:25:17 +02:00
parent fc014f3ee2
commit 4a2b99f9d5
6 changed files with 332 additions and 3 deletions
@@ -10,6 +10,9 @@ import {
mucusFeeling as feelingLabels,
mucusTexture as textureLabels,
mucusNFP as computeSensiplanMucusLabels,
cervixOpening as openingLabels,
cervixFirmness as firmnessLabels,
cervixPosition as positionLabels
} from './labels/labels'
import cycleDayModule from '../../lib/get-cycle-day-number'
import { bleedingDaysSortedByDate } from '../../db'
@@ -49,6 +52,7 @@ export default class DayView extends Component {
} else {
bleedingLabel = 'edit'
}
const temperatureValue = this.cycleDay.temperature && this.cycleDay.temperature.value
let temperatureLabel
if (typeof temperatureValue === 'number') {
@@ -71,6 +75,17 @@ export default class DayView extends Component {
mucusLabel = 'edit'
}
const cervixOpeningValue = this.cycleDay.cervix && this.cycleDay.cervix.opening
const cervixFirmnessValue = this.cycleDay.cervix && this.cycleDay.cervix.firmness
const cervixPositionValue = this.cycleDay.cervix && this.cycleDay.cervix.position
let cervixLabel
if (typeof cervixPositionValue === 'number' && typeof cervixOpeningValue === 'number') {
cervixLabel = `${openingLabels[cervixOpeningValue]} + ${firmnessLabels[cervixFirmnessValue]} ( ${positionLabels[cervixPositionValue]} )`
if (this.cycleDay.cervix.exclude) cervixLabel = "( " + cervixLabel + " )"
} else {
cervixLabel = 'edit'
}
return (
<View style={styles.symptomEditView}>
<View style={styles.symptomViewRowInline}>
@@ -100,6 +115,17 @@ export default class DayView extends Component {
</Button>
</View>
</View>
<View style={ styles.itemsInRowSeparatedView }>
<View style={{flex: 1}}>
<Text style={styles.symptomDayView}>Cervix</Text>
</View>
<View style={ styles.singleButtonView }>
<Button
onPress={() => this.showView('cervixEditView')}
title={cervixLabel}>
</Button>
</View>
</View>
</View >
)
}