Skip to content
Snippets Groups Projects
Commit b8e99194 authored by emelko's avatar emelko
Browse files

Reorganise labels for cylce day overview

parent 4a2b99f9
No related branches found
No related tags found
No related merge requests found
......@@ -44,44 +44,49 @@ export default class DayView extends Component {
}
render() {
const bleedingValue = this.cycleDay.bleeding && this.cycleDay.bleeding.value
let bleedingLabel
if (typeof bleedingValue === 'number') {
bleedingLabel = `${bleedingLabels[bleedingValue]}`
if (this.cycleDay.bleeding.exclude) bleedingLabel = "( " + bleedingLabel + " )"
if (this.cycleDay.bleeding) {
const bleeding = this.cycleDay.bleeding
if (typeof bleeding === 'number') {
bleedingLabel = `${bleedingLabels[bleeding]}`
if (bleeding.exclude) bleedingLabel = "( " + bleedingLabel + " )"
}
} else {
bleedingLabel = 'edit'
}
const temperatureValue = this.cycleDay.temperature && this.cycleDay.temperature.value
let temperatureLabel
if (typeof temperatureValue === 'number') {
temperatureLabel = `${temperatureValue} °C - ${this.cycleDay.temperature.time}`
if (this.cycleDay.temperature.exclude) {
temperatureLabel = "( " + temperatureLabel + " )"
if (this.cycleDay.temperature) {
const temperature = this.cycleDay.temperature
if (typeof temperature === 'number') {
temperatureLabel = `${temperature} °C - ${temperature.time}`
if (temperature.exclude) {
temperatureLabel = "( " + temperatureLabel + " )"
}
}
} else {
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
if (typeof mucusFeelingValue === 'number' && typeof mucusTextureValue === 'number') {
mucusLabel = `${feelingLabels[mucusFeelingValue]} + ${textureLabels[mucusTextureValue]} ( ${computeSensiplanMucusLabels[mucusComputedValue]} )`
if (this.cycleDay.mucus.exclude) mucusLabel = "( " + mucusLabel + " )"
if (this.cycleDay.mucus) {
const mucus = this.cycleDay.mucus
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 {
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 + " )"
if (this.cycleDay.cervix) {
const cervix = this.cycleDay.cervix
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 {
cervixLabel = 'edit'
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment