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

Merge branch 'master' into 117-implement-pain

parents a664b6df edf9b04b
No related branches found
No related tags found
No related merge requests found
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- color for the app bar and other primary UI elements -->
<color name="colorPrimary">#ff7e5f</color>
<!-- a darker variant of the primary color, used for
the status bar (on Android 5.0+) and contextual app bars -->
<color name="colorPrimaryDark">#c74e34</color>
<!-- a secondary color for controls like checkboxes and text fields -->
<color name="colorAccent">#351c4d</color>
</resources>
\ No newline at end of file
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
<!-- Base application theme. --> <!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. --> <!-- Customize your theme here. -->
<item name="colorAccent">@color/colorAccent</item>
</style> </style>
</resources> </resources>
...@@ -51,6 +51,7 @@ export default class CycleDayOverView extends Component { ...@@ -51,6 +51,7 @@ export default class CycleDayOverView extends Component {
const cycleDay = this.state.cycleDay const cycleDay = this.state.cycleDay
const getCycleDayNumber = cycleModule().getCycleDayNumber const getCycleDayNumber = cycleModule().getCycleDayNumber
const cycleDayNumber = getCycleDayNumber(cycleDay.date) const cycleDayNumber = getCycleDayNumber(cycleDay.date)
const dateInFuture = LocalDate.now().isBefore(LocalDate.parse(this.state.cycleDay.date))
return ( return (
<View style={{ flex: 1 }}> <View style={{ flex: 1 }}>
<Header <Header
...@@ -65,36 +66,42 @@ export default class CycleDayOverView extends Component { ...@@ -65,36 +66,42 @@ export default class CycleDayOverView extends Component {
title='Bleeding' title='Bleeding'
onPress={() => this.navigate('BleedingEditView')} onPress={() => this.navigate('BleedingEditView')}
data={getLabel('bleeding', cycleDay.bleeding)} data={getLabel('bleeding', cycleDay.bleeding)}
disabled={dateInFuture}
/> />
<SymptomBox <SymptomBox
title='Temperature' title='Temperature'
onPress={() => this.navigate('TemperatureEditView')} onPress={() => this.navigate('TemperatureEditView')}
data={getLabel('temperature', cycleDay.temperature)} data={getLabel('temperature', cycleDay.temperature)}
disabled={dateInFuture}
/> />
<SymptomBox <SymptomBox
title='Mucus' title='Mucus'
onPress={() => this.navigate('MucusEditView')} onPress={() => this.navigate('MucusEditView')}
data={getLabel('mucus', cycleDay.mucus)} data={getLabel('mucus', cycleDay.mucus)}
disabled={dateInFuture}
/> />
<SymptomBox <SymptomBox
title='Cervix' title='Cervix'
onPress={() => this.navigate('CervixEditView')} onPress={() => this.navigate('CervixEditView')}
data={getLabel('cervix', cycleDay.cervix)} data={getLabel('cervix', cycleDay.cervix)}
/> disabled={dateInFuture}
<SymptomBox
title='Note'
onPress={() => this.navigate('NoteEditView')}
data={getLabel('note', cycleDay.note)}
/> />
<SymptomBox <SymptomBox
title='Desire' title='Desire'
onPress={() => this.navigate('DesireEditView')} onPress={() => this.navigate('DesireEditView')}
data={getLabel('desire', cycleDay.desire)} data={getLabel('desire', cycleDay.desire)}
disabled={dateInFuture}
/> />
<SymptomBox <SymptomBox
title='Sex' title='Sex'
onPress={() => this.navigate('SexEditView')} onPress={() => this.navigate('SexEditView')}
data={getLabel('sex', cycleDay.sex)} data={getLabel('sex', cycleDay.sex)}
disabled={dateInFuture}
/>
<SymptomBox
title='Note'
onPress={() => this.navigate('NoteEditView')}
data={getLabel('note', cycleDay.note)}
/> />
<SymptomBox <SymptomBox
title='Pain' title='Pain'
...@@ -208,26 +215,26 @@ function getLabel(symptomName, symptom) { ...@@ -208,26 +215,26 @@ function getLabel(symptomName, symptom) {
return label.slice(0, 42) + '...' return label.slice(0, 42) + '...'
} }
class SymptomBox extends Component { class SymptomBox extends Component {
render() { render() {
const d = this.props.data const d = this.props.data
const boxActive = d ? styles.symptomBoxActive : {} const boxActive = d ? styles.symptomBoxActive : {}
const iconActive = d ? iconStyles.symptomBoxActive : {} const iconActive = d ? iconStyles.symptomBoxActive : {}
const textStyle = d ? styles.symptomTextActive : {} const iconStyle = Object.assign({}, iconStyles.symptomBox, iconActive, disabledStyle)
const textActive = d ? styles.symptomTextActive : {}
const symptomBoxStyle = Object.assign({}, styles.symptomBox, boxActive) const disabledStyle = this.props.disabled ? styles.symptomInFuture : {}
const iconStyle = Object.assign({}, iconStyles.symptomBox, iconActive)
return ( return (
<TouchableOpacity onPress={this.props.onPress}> <TouchableOpacity onPress={this.props.onPress} disabled={this.props.disabled}>
<View style={symptomBoxStyle}> <View style={[styles.symptomBox, boxActive, disabledStyle]}>
<Icon <Icon
name='thermometer' name='thermometer'
{...iconStyle} {...iconStyle}
/> />
<Text style={textStyle}>{this.props.title}</Text> <Text style={[textActive, disabledStyle]}>{this.props.title}</Text>
</View> </View>
<View style={styles.symptomDataBox}> <View style={[styles.symptomDataBox, disabledStyle]}>
<Text style={styles.symptomDataText}>{this.props.data}</Text> <Text style={styles.symptomDataText}>{this.props.data}</Text>
</View> </View>
</TouchableOpacity> </TouchableOpacity>
......
...@@ -33,7 +33,8 @@ export default class Temp extends Component { ...@@ -33,7 +33,8 @@ export default class Temp extends Component {
exclude: temp ? temp.exclude : false, exclude: temp ? temp.exclude : false,
time: temp ? temp.time : LocalTime.now().truncatedTo(minutes).toString(), time: temp ? temp.time : LocalTime.now().truncatedTo(minutes).toString(),
isTimePickerVisible: false, isTimePickerVisible: false,
outOfRange: null outOfRange: null,
note: temp ? temp.note : null
} }
if (temp) { if (temp) {
...@@ -54,7 +55,8 @@ export default class Temp extends Component { ...@@ -54,7 +55,8 @@ export default class Temp extends Component {
const dataToSave = { const dataToSave = {
value: Number(this.state.temperature), value: Number(this.state.temperature),
exclude: this.state.exclude, exclude: this.state.exclude,
time: this.state.time time: this.state.time,
note: this.state.note
} }
saveSymptom('temperature', this.cycleDay, dataToSave) saveSymptom('temperature', this.cycleDay, dataToSave)
this.props.navigate('CycleDay', {cycleDay: this.cycleDay}) this.props.navigate('CycleDay', {cycleDay: this.cycleDay})
...@@ -126,6 +128,21 @@ export default class Temp extends Component { ...@@ -126,6 +128,21 @@ export default class Temp extends Component {
}} }}
onCancel={() => this.setState({ isTimePickerVisible: false })} onCancel={() => this.setState({ isTimePickerVisible: false })}
/> />
<View style={styles.symptomViewRowInline}>
<Text style={styles.symptomDayView}>Note</Text>
</View>
<View>
<TextInput
style={styles.temperatureTextInput}
multiline={true}
autoFocus={this.state.focusTextArea}
placeholder="enter"
value={this.state.note}
onChangeText={(val) => {
this.setState({ note: val })
}}
/>
</View>
<View style={styles.symptomViewRowInline}> <View style={styles.symptomViewRowInline}>
<Text style={styles.symptomDayView}>Exclude</Text> <Text style={styles.symptomDayView}>Exclude</Text>
<Switch <Switch
......
...@@ -15,6 +15,10 @@ const TemperatureSchema = { ...@@ -15,6 +15,10 @@ const TemperatureSchema = {
type: 'string', type: 'string',
optional: true optional: true
}, },
note: {
type: 'string',
optional: true
}
} }
} }
......
...@@ -61,6 +61,10 @@ export default StyleSheet.create({ ...@@ -61,6 +61,10 @@ export default StyleSheet.create({
symptomTextActive: { symptomTextActive: {
color: fontOnPrimaryColor color: fontOnPrimaryColor
}, },
symptomInFuture: {
borderColor: 'lightgrey',
color: 'lightgrey'
},
symptomDataBox: { symptomDataBox: {
borderColor: secondaryColor, borderColor: secondaryColor,
borderStyle: 'solid', borderStyle: 'solid',
...@@ -132,7 +136,8 @@ export default StyleSheet.create({ ...@@ -132,7 +136,8 @@ export default StyleSheet.create({
}, },
temperatureTextInput: { temperatureTextInput: {
fontSize: 20, fontSize: 20,
color: 'black' color: 'black',
textAlign: 'center'
}, },
temperatureTextInputSuggestion: { temperatureTextInputSuggestion: {
color: '#939393' color: '#939393'
......
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