Reorganise labels for cylce day overview

This commit is contained in:
emelko
2018-07-20 12:25:59 +02:00
parent 4a2b99f9d5
commit b8e99194d9
+25 -20
View File
@@ -44,44 +44,49 @@ export default class DayView extends Component {
} }
render() { render() {
const bleedingValue = this.cycleDay.bleeding && this.cycleDay.bleeding.value
let bleedingLabel let bleedingLabel
if (typeof bleedingValue === 'number') { if (this.cycleDay.bleeding) {
bleedingLabel = `${bleedingLabels[bleedingValue]}` const bleeding = this.cycleDay.bleeding
if (this.cycleDay.bleeding.exclude) bleedingLabel = "( " + bleedingLabel + " )" if (typeof bleeding === 'number') {
bleedingLabel = `${bleedingLabels[bleeding]}`
if (bleeding.exclude) bleedingLabel = "( " + bleedingLabel + " )"
}
} else { } else {
bleedingLabel = 'edit' bleedingLabel = 'edit'
} }
const temperatureValue = this.cycleDay.temperature && this.cycleDay.temperature.value
let temperatureLabel let temperatureLabel
if (typeof temperatureValue === 'number') { if (this.cycleDay.temperature) {
temperatureLabel = `${temperatureValue} °C - ${this.cycleDay.temperature.time}` const temperature = this.cycleDay.temperature
if (this.cycleDay.temperature.exclude) { if (typeof temperature === 'number') {
temperatureLabel = `${temperature} °C - ${temperature.time}`
if (temperature.exclude) {
temperatureLabel = "( " + temperatureLabel + " )" temperatureLabel = "( " + temperatureLabel + " )"
} }
}
} else { } else {
temperatureLabel = 'edit' temperatureLabel = 'edit'
} }
const mucusFeelingValue = this.cycleDay.mucus && this.cycleDay.mucus.feeling
const mucusTextureValue = this.cycleDay.mucus && this.cycleDay.mucus.texture
const mucusComputedValue = this.cycleDay.mucus && this.cycleDay.mucus.computedNfp
let mucusLabel let mucusLabel
if (typeof mucusFeelingValue === 'number' && typeof mucusTextureValue === 'number') { if (this.cycleDay.mucus) {
mucusLabel = `${feelingLabels[mucusFeelingValue]} + ${textureLabels[mucusTextureValue]} ( ${computeSensiplanMucusLabels[mucusComputedValue]} )` const mucus = this.cycleDay.mucus
if (this.cycleDay.mucus.exclude) mucusLabel = "( " + mucusLabel + " )" if (typeof mucus.feeling === 'number' && typeof mucus.texture === 'number') {
mucusLabel = `${feelingLabels[mucus.feeling]} + ${textureLabels[mucus.texture]} ( ${computeSensiplanMucusLabels[mucus.computedNfp]} )`
if (mucus.exclude) mucusLabel = "( " + mucusLabel + " )"
}
} else { } else {
mucusLabel = 'edit' 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 let cervixLabel
if (typeof cervixPositionValue === 'number' && typeof cervixOpeningValue === 'number') { if (this.cycleDay.cervix) {
cervixLabel = `${openingLabels[cervixOpeningValue]} + ${firmnessLabels[cervixFirmnessValue]} ( ${positionLabels[cervixPositionValue]} )` const cervix = this.cycleDay.cervix
if (this.cycleDay.cervix.exclude) cervixLabel = "( " + cervixLabel + " )" if (cervix.opening > -1 && cervix.firmness > -1) {
cervixLabel = `${openingLabels[cervix.opening]} + ${firmnessLabels[cervix.firmness]}`
if (cervix.position > -1) cervixLabel += `+ ${positionLabels[cervix.position]}`
if (cervix.exclude) cervixLabel = "( " + cervixLabel + " )"
}
} else { } else {
cervixLabel = 'edit' cervixLabel = 'edit'
} }