SexLabel on cycle day overview now shows all the selected values
This commit is contained in:
@@ -21,7 +21,8 @@ import {
|
|||||||
cervixFirmness as firmnessLabels,
|
cervixFirmness as firmnessLabels,
|
||||||
cervixPosition as positionLabels,
|
cervixPosition as positionLabels,
|
||||||
intensity as intensityLabels,
|
intensity as intensityLabels,
|
||||||
pain as painLabels
|
pain as painLabels,
|
||||||
|
sex as sexLabels
|
||||||
} from './labels/labels'
|
} from './labels/labels'
|
||||||
|
|
||||||
export default class CycleDayOverView extends Component {
|
export default class CycleDayOverView extends Component {
|
||||||
@@ -162,15 +163,20 @@ function getLabel(symptomName, symptom) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
sex: sex => {
|
sex: sex => {
|
||||||
const sexLabel = []
|
let sexLabel = []
|
||||||
if ( sex.solo || sex.partner ) {
|
if (sex && Object.values(sex).some(val => val)){
|
||||||
sexLabel.push('activity')
|
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 ||
|
return sexLabel
|
||||||
sex.patch || sex.ring || sex.implant || sex.other) {
|
|
||||||
sexLabel.push('contraceptive')
|
|
||||||
}
|
|
||||||
return sexLabel.join(', ')
|
|
||||||
},
|
},
|
||||||
pain: pain => {
|
pain: pain => {
|
||||||
let painLabel = []
|
let painLabel = []
|
||||||
|
|||||||
@@ -6,11 +6,9 @@ export const cervixOpening = ['closed', 'medium', 'open']
|
|||||||
export const cervixFirmness = ['hard', 'soft']
|
export const cervixFirmness = ['hard', 'soft']
|
||||||
export const cervixPosition = ['low', 'medium', 'high']
|
export const cervixPosition = ['low', 'medium', 'high']
|
||||||
export const intensity = ['low', 'medium', 'high']
|
export const intensity = ['low', 'medium', 'high']
|
||||||
export const sexActivity = {
|
export const sex = {
|
||||||
solo: 'Solo',
|
solo: 'Solo',
|
||||||
partner: 'Partner'
|
partner: 'Partner',
|
||||||
}
|
|
||||||
export const contraceptives = {
|
|
||||||
condom: 'Condom',
|
condom: 'Condom',
|
||||||
pill: 'Pill',
|
pill: 'Pill',
|
||||||
iud: 'IUD',
|
iud: 'IUD',
|
||||||
@@ -28,7 +26,8 @@ export const pain = {
|
|||||||
nausea: 'Nausea',
|
nausea: 'Nausea',
|
||||||
tenderBreasts: 'Tender breasts',
|
tenderBreasts: 'Tender breasts',
|
||||||
migraine: 'Migraine',
|
migraine: 'Migraine',
|
||||||
other: 'Other'
|
other: 'Other',
|
||||||
|
note: 'Note'
|
||||||
}
|
}
|
||||||
|
|
||||||
export const fertilityStatus = {
|
export const fertilityStatus = {
|
||||||
|
|||||||
@@ -8,10 +8,7 @@ import {
|
|||||||
} from 'react-native'
|
} from 'react-native'
|
||||||
import styles from '../../../styles'
|
import styles from '../../../styles'
|
||||||
import { saveSymptom } from '../../../db'
|
import { saveSymptom } from '../../../db'
|
||||||
import {
|
import { sex as sexLabels } from '../labels/labels'
|
||||||
sexActivity as activityLabels,
|
|
||||||
contraceptives as contraceptiveLabels
|
|
||||||
} from '../labels/labels'
|
|
||||||
import ActionButtonFooter from './action-button-footer'
|
import ActionButtonFooter from './action-button-footer'
|
||||||
|
|
||||||
export default class Sex extends Component {
|
export default class Sex extends Component {
|
||||||
@@ -36,7 +33,7 @@ export default class Sex extends Component {
|
|||||||
<ScrollView>
|
<ScrollView>
|
||||||
<View>
|
<View>
|
||||||
<View style={styles.symptomViewRowInline}>
|
<View style={styles.symptomViewRowInline}>
|
||||||
<Text style={styles.symptomDayView}>{activityLabels.solo}</Text>
|
<Text style={styles.symptomDayView}>{sexLabels.solo}</Text>
|
||||||
<CheckBox
|
<CheckBox
|
||||||
value={this.state.solo}
|
value={this.state.solo}
|
||||||
onValueChange={(val) => {
|
onValueChange={(val) => {
|
||||||
@@ -44,7 +41,7 @@ export default class Sex extends Component {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Text style={styles.symptomDayView}>
|
<Text style={styles.symptomDayView}>
|
||||||
{activityLabels.partner}
|
{sexLabels.partner}
|
||||||
</Text>
|
</Text>
|
||||||
<CheckBox
|
<CheckBox
|
||||||
value={this.state.partner}
|
value={this.state.partner}
|
||||||
@@ -56,7 +53,7 @@ export default class Sex extends Component {
|
|||||||
<Text style={styles.symptomDayView}>CONTRACEPTIVES</Text>
|
<Text style={styles.symptomDayView}>CONTRACEPTIVES</Text>
|
||||||
<View style={styles.symptomViewRowInline}>
|
<View style={styles.symptomViewRowInline}>
|
||||||
<Text style={styles.symptomDayView}>
|
<Text style={styles.symptomDayView}>
|
||||||
{contraceptiveLabels.condom}
|
{sexLabels.condom}
|
||||||
</Text>
|
</Text>
|
||||||
<CheckBox
|
<CheckBox
|
||||||
value={this.state.condom}
|
value={this.state.condom}
|
||||||
@@ -65,7 +62,7 @@ export default class Sex extends Component {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Text style={styles.symptomDayView}>
|
<Text style={styles.symptomDayView}>
|
||||||
{contraceptiveLabels.pill}
|
{sexLabels.pill}
|
||||||
</Text>
|
</Text>
|
||||||
<CheckBox
|
<CheckBox
|
||||||
value={this.state.pill}
|
value={this.state.pill}
|
||||||
@@ -76,7 +73,7 @@ export default class Sex extends Component {
|
|||||||
</View>
|
</View>
|
||||||
<View style={styles.symptomViewRowInline}>
|
<View style={styles.symptomViewRowInline}>
|
||||||
<Text style={styles.symptomDayView}>
|
<Text style={styles.symptomDayView}>
|
||||||
{contraceptiveLabels.iud}
|
{sexLabels.iud}
|
||||||
</Text>
|
</Text>
|
||||||
<CheckBox
|
<CheckBox
|
||||||
value={this.state.iud}
|
value={this.state.iud}
|
||||||
@@ -85,7 +82,7 @@ export default class Sex extends Component {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Text style={styles.symptomDayView}>
|
<Text style={styles.symptomDayView}>
|
||||||
{contraceptiveLabels.patch}
|
{sexLabels.patch}
|
||||||
</Text>
|
</Text>
|
||||||
<CheckBox
|
<CheckBox
|
||||||
value={this.state.patch}
|
value={this.state.patch}
|
||||||
@@ -96,7 +93,7 @@ export default class Sex extends Component {
|
|||||||
</View>
|
</View>
|
||||||
<View style={styles.symptomViewRowInline}>
|
<View style={styles.symptomViewRowInline}>
|
||||||
<Text style={styles.symptomDayView}>
|
<Text style={styles.symptomDayView}>
|
||||||
{contraceptiveLabels.ring}
|
{sexLabels.ring}
|
||||||
</Text>
|
</Text>
|
||||||
<CheckBox
|
<CheckBox
|
||||||
value={this.state.ring}
|
value={this.state.ring}
|
||||||
@@ -105,7 +102,7 @@ export default class Sex extends Component {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Text style={styles.symptomDayView}>
|
<Text style={styles.symptomDayView}>
|
||||||
{contraceptiveLabels.implant}
|
{sexLabels.implant}
|
||||||
</Text>
|
</Text>
|
||||||
<CheckBox
|
<CheckBox
|
||||||
value={this.state.implant}
|
value={this.state.implant}
|
||||||
@@ -116,7 +113,7 @@ export default class Sex extends Component {
|
|||||||
</View>
|
</View>
|
||||||
<View style={styles.symptomViewRowInline}>
|
<View style={styles.symptomViewRowInline}>
|
||||||
<Text style={styles.symptomDayView}>
|
<Text style={styles.symptomDayView}>
|
||||||
{contraceptiveLabels.other}
|
{sexLabels.other}
|
||||||
</Text>
|
</Text>
|
||||||
<CheckBox
|
<CheckBox
|
||||||
value={this.state.other}
|
value={this.state.other}
|
||||||
|
|||||||
Reference in New Issue
Block a user