From ff1afcb8dcd143a4442ab824d6f150f7972f6a69 Mon Sep 17 00:00:00 2001 From: emelko Date: Sun, 19 May 2019 12:56:08 +0200 Subject: [PATCH] Adds info button to the body as alert --- components/cycle-day/symptoms/bleeding.js | 52 ++++++++++++++++----- components/cycle-day/symptoms/cervix.js | 52 ++++++++++++++++----- components/cycle-day/symptoms/desire.js | 52 ++++++++++++++++----- components/cycle-day/symptoms/mucus.js | 55 ++++++++++++++++------ components/cycle-day/symptoms/note.js | 56 +++++++++++++++++------ components/cycle-day/symptoms/sex.js | 54 ++++++++++++++++------ styles/index.js | 5 ++ 7 files changed, 249 insertions(+), 77 deletions(-) diff --git a/components/cycle-day/symptoms/bleeding.js b/components/cycle-day/symptoms/bleeding.js index 9d94a03..465e441 100644 --- a/components/cycle-day/symptoms/bleeding.js +++ b/components/cycle-day/symptoms/bleeding.js @@ -1,11 +1,19 @@ import React from 'react' import { + Alert, Switch, - ScrollView + ScrollView, + TouchableOpacity, + View } from 'react-native' -import styles from '../../../styles' +import FeatherIcon from 'react-native-vector-icons/Feather' + import { bleeding } from '../../../i18n/en/cycle-day' +import infoLabels from '../../../i18n/en/symptom-info' +import styles, { iconStyles } from '../../../styles' + import SelectTabGroup from '../select-tab-group' + import SymptomSection from './symptom-section' import SymptomView from './symptom-view' @@ -22,6 +30,14 @@ export default class Bleeding extends SymptomView { symptomName = 'bleeding' + showInfoBox(){ + const symptomName = 'bleeding' + Alert.alert( + infoLabels[symptomName].title, + infoLabels[symptomName].text + ) + } + onBackButtonPress() { if (typeof this.state.currentValue != 'number') { this.deleteSymptomEntry() @@ -42,16 +58,28 @@ export default class Bleeding extends SymptomView { ] return ( - - this.setState({ currentValue: val })} - /> - + + + this.setState({ currentValue: val })} + /> + + + + + + typeof this.state[val] != 'number') if (nothingEntered) { @@ -53,16 +69,28 @@ export default class Cervix extends SymptomView { // const mandatoryNotCompleted = typeof this.state.opening != 'number' || typeof this.state.firmness != 'number' return ( - - this.setState({ opening: val })} - /> - + + + this.setState({ opening: val })} + /> + + + + + + - - this.setState({ currentValue: val })} - /> - + + + this.setState({ currentValue: val })} + /> + + + + + + ) } diff --git a/components/cycle-day/symptoms/mucus.js b/components/cycle-day/symptoms/mucus.js index 2d7b9d1..49eceb9 100644 --- a/components/cycle-day/symptoms/mucus.js +++ b/components/cycle-day/symptoms/mucus.js @@ -1,12 +1,20 @@ import React from 'react' import { + Alert, Switch, - ScrollView + ScrollView, + TouchableOpacity, + View } from 'react-native' -import styles from '../../../styles' +import FeatherIcon from 'react-native-vector-icons/Feather' + +import styles, { iconStyles } from '../../../styles' +import infoLabels from '../../../i18n/en/symptom-info' import { mucus as labels } from '../../../i18n/en/cycle-day' import computeNfpValue from '../../../lib/nfp-mucus' + import SelectTabGroup from '../select-tab-group' + import SymptomSection from './symptom-section' import SymptomView from './symptom-view' @@ -19,6 +27,14 @@ export default class Mucus extends SymptomView { } symptomName = 'mucus' + + showInfoBox(){ + const symptomName = 'mucus' + Alert.alert( + infoLabels[symptomName].title, + infoLabels[symptomName].text + ) + } onBackButtonPress() { const nothingEntered = ['feeling', 'texture'].every(val => typeof this.state[val] != 'number') @@ -26,7 +42,7 @@ export default class Mucus extends SymptomView { this.deleteSymptomEntry() return } - + const feeling = this.state.feeling const texture = this.state.texture this.saveSymptomEntry({ @@ -53,16 +69,29 @@ export default class Mucus extends SymptomView { // const mandatoryNotCompletedYet = typeof this.state.feeling != 'number' || typeof this.state.texture != 'number' return ( - - this.setState({ feeling: val })} - active={this.state.feeling} - /> - + + + this.setState({ feeling: val })} + active={this.state.feeling} + /> + + + + + + + - - { - this.setState({ currentValue: val }) - }} - value={this.state.currentValue} - /> - + + + { + this.setState({ currentValue: val }) + }} + value={this.state.currentValue} + /> + + + + + + ) } diff --git a/components/cycle-day/symptoms/sex.js b/components/cycle-day/symptoms/sex.js index 9b195da..bd9487d 100644 --- a/components/cycle-day/symptoms/sex.js +++ b/components/cycle-day/symptoms/sex.js @@ -1,12 +1,20 @@ import React from 'react' import { + Alert, + ScrollView, TextInput, - ScrollView + TouchableOpacity, + View } from 'react-native' -import styles from '../../../styles' +import FeatherIcon from 'react-native-vector-icons/Feather' + +import infoLabels from '../../../i18n/en/symptom-info' import { sex as sexLabels, contraceptives as contraceptivesLabels } from '../../../i18n/en/cycle-day' import { shared as sharedLabels } from '../../../i18n/en/labels' +import styles, { iconStyles } from '../../../styles' + import SelectBoxGroup from '../select-box-group' + import SymptomSection from './symptom-section' import SymptomView from './symptom-view' @@ -24,8 +32,16 @@ export default class Sex extends SymptomView { if (this.state.note) this.state.other = true } - symptomName = "sex" + symptomName = 'sex' + showInfoBox(){ + const symptomName = 'sex' + Alert.alert( + infoLabels[symptomName].title, + infoLabels[symptomName].text + ) + } + onBackButtonPress() { const nothingEntered = Object.values(this.state).every(val => !val) if (nothingEntered) { @@ -51,16 +67,28 @@ export default class Sex extends SymptomView { renderContent() { return ( - - - + + + + + + + + +