SexLabel on cycle day overview now shows all the selected values

This commit is contained in:
emelko
2018-08-30 21:39:21 +02:00
parent 4dd1ae3f29
commit 7c1cd18b1c
3 changed files with 29 additions and 27 deletions
+15 -9
View File
@@ -21,7 +21,8 @@ import {
cervixFirmness as firmnessLabels,
cervixPosition as positionLabels,
intensity as intensityLabels,
pain as painLabels
pain as painLabels,
sex as sexLabels
} from './labels/labels'
export default class CycleDayOverView extends Component {
@@ -162,15 +163,20 @@ function getLabel(symptomName, symptom) {
}
},
sex: sex => {
const sexLabel = []
if ( sex.solo || sex.partner ) {
sexLabel.push('activity')
let sexLabel = []
if (sex && Object.values(sex).some(val => val)){
Object.keys(sex).forEach(key => {
if(sex[key] && key !== 'note') {
sexLabel.push(sexLabels[key])
}
if(key === "note" && sex.note) {
sexLabel.push(sex.note)
}
})
sexLabel = sexLabel.join(', ')
if (sex.exclude) sexLabel = `(${sexLabel})`
}
if (sex.condom || sex.pill || sex.iud ||
sex.patch || sex.ring || sex.implant || sex.other) {
sexLabel.push('contraceptive')
}
return sexLabel.join(', ')
return sexLabel
},
pain: pain => {
let painLabel = []
+4 -5
View File
@@ -6,11 +6,9 @@ export const cervixOpening = ['closed', 'medium', 'open']
export const cervixFirmness = ['hard', 'soft']
export const cervixPosition = ['low', 'medium', 'high']
export const intensity = ['low', 'medium', 'high']
export const sexActivity = {
export const sex = {
solo: 'Solo',
partner: 'Partner'
}
export const contraceptives = {
partner: 'Partner',
condom: 'Condom',
pill: 'Pill',
iud: 'IUD',
@@ -28,7 +26,8 @@ export const pain = {
nausea: 'Nausea',
tenderBreasts: 'Tender breasts',
migraine: 'Migraine',
other: 'Other'
other: 'Other',
note: 'Note'
}
export const fertilityStatus = {
+10 -13
View File
@@ -8,10 +8,7 @@ import {
} from 'react-native'
import styles from '../../../styles'
import { saveSymptom } from '../../../db'
import {
sexActivity as activityLabels,
contraceptives as contraceptiveLabels
} from '../labels/labels'
import { sex as sexLabels } from '../labels/labels'
import ActionButtonFooter from './action-button-footer'
export default class Sex extends Component {
@@ -36,7 +33,7 @@ export default class Sex extends Component {
<ScrollView>
<View>
<View style={styles.symptomViewRowInline}>
<Text style={styles.symptomDayView}>{activityLabels.solo}</Text>
<Text style={styles.symptomDayView}>{sexLabels.solo}</Text>
<CheckBox
value={this.state.solo}
onValueChange={(val) => {
@@ -44,7 +41,7 @@ export default class Sex extends Component {
}}
/>
<Text style={styles.symptomDayView}>
{activityLabels.partner}
{sexLabels.partner}
</Text>
<CheckBox
value={this.state.partner}
@@ -56,7 +53,7 @@ export default class Sex extends Component {
<Text style={styles.symptomDayView}>CONTRACEPTIVES</Text>
<View style={styles.symptomViewRowInline}>
<Text style={styles.symptomDayView}>
{contraceptiveLabels.condom}
{sexLabels.condom}
</Text>
<CheckBox
value={this.state.condom}
@@ -65,7 +62,7 @@ export default class Sex extends Component {
}}
/>
<Text style={styles.symptomDayView}>
{contraceptiveLabels.pill}
{sexLabels.pill}
</Text>
<CheckBox
value={this.state.pill}
@@ -76,7 +73,7 @@ export default class Sex extends Component {
</View>
<View style={styles.symptomViewRowInline}>
<Text style={styles.symptomDayView}>
{contraceptiveLabels.iud}
{sexLabels.iud}
</Text>
<CheckBox
value={this.state.iud}
@@ -85,7 +82,7 @@ export default class Sex extends Component {
}}
/>
<Text style={styles.symptomDayView}>
{contraceptiveLabels.patch}
{sexLabels.patch}
</Text>
<CheckBox
value={this.state.patch}
@@ -96,7 +93,7 @@ export default class Sex extends Component {
</View>
<View style={styles.symptomViewRowInline}>
<Text style={styles.symptomDayView}>
{contraceptiveLabels.ring}
{sexLabels.ring}
</Text>
<CheckBox
value={this.state.ring}
@@ -105,7 +102,7 @@ export default class Sex extends Component {
}}
/>
<Text style={styles.symptomDayView}>
{contraceptiveLabels.implant}
{sexLabels.implant}
</Text>
<CheckBox
value={this.state.implant}
@@ -116,7 +113,7 @@ export default class Sex extends Component {
</View>
<View style={styles.symptomViewRowInline}>
<Text style={styles.symptomDayView}>
{contraceptiveLabels.other}
{sexLabels.other}
</Text>
<CheckBox
value={this.state.other}