disables entries for future datas except note, puts note at the end of the symptom list

This commit is contained in:
tina
2018-08-31 13:00:39 +02:00
parent 54a3db4096
commit a3c02d30a0
3 changed files with 103 additions and 88 deletions
+21 -10
View File
@@ -49,6 +49,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
@@ -63,36 +64,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)}
/> />
{/* this is just to make the last row adhere to the grid {/* this is just to make the last row adhere to the grid
(and) because there are no pseudo properties in RN */} (and) because there are no pseudo properties in RN */}
@@ -174,18 +181,22 @@ 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 textActive = d ? styles.symptomTextActive : {}
const disabledStyle = this.props.disabled ? styles.symptomInFuture : {}
const symptomBoxStyle = Object.assign({}, styles.symptomBox, boxActive) const symptomBoxStyle = Object.assign({}, styles.symptomBox, boxActive, disabledStyle)
const iconStyle = Object.assign({}, iconStyles.symptomBox, iconActive) const iconStyle = Object.assign({}, iconStyles.symptomBox, iconActive, disabledStyle)
const symptomDataBoxStyle = Object.assign({}, styles.symptomDataBox, disabledStyle)
const textStyle = Object.assign({}, textActive, disabledStyle)
return ( return (
<TouchableOpacity onPress={this.props.onPress}> <TouchableOpacity onPress={this.props.onPress} disabled={this.props.disabled}>
<View style={symptomBoxStyle}> <View style={symptomBoxStyle}>
<Icon <Icon
name='thermometer' name='thermometer'
@@ -193,7 +204,7 @@ class SymptomBox extends Component {
/> />
<Text style={textStyle}>{this.props.title}</Text> <Text style={textStyle}>{this.props.title}</Text>
</View> </View>
<View style={styles.symptomDataBox}> <View style={symptomDataBoxStyle}>
<Text style={styles.symptomDataText}>{this.props.data}</Text> <Text style={styles.symptomDataText}>{this.props.data}</Text>
</View> </View>
</TouchableOpacity> </TouchableOpacity>
+78 -78
View File
@@ -3721,8 +3721,8 @@
"integrity": "sha512-z8H8/diyk76B7q5wg+Ud0+CqzcAF3mBBI/bA5ne5zrRUUIvNkJY//D3BqyH571KuAC4Nr7Rw7CjWX4r0y9DvNg==", "integrity": "sha512-z8H8/diyk76B7q5wg+Ud0+CqzcAF3mBBI/bA5ne5zrRUUIvNkJY//D3BqyH571KuAC4Nr7Rw7CjWX4r0y9DvNg==",
"optional": true, "optional": true,
"requires": { "requires": {
"nan": "^2.9.2", "nan": "2.10.0",
"node-pre-gyp": "^0.10.0" "node-pre-gyp": "0.10.0"
}, },
"dependencies": { "dependencies": {
"abbrev": { "abbrev": {
@@ -3744,8 +3744,8 @@
"bundled": true, "bundled": true,
"optional": true, "optional": true,
"requires": { "requires": {
"delegates": "^1.0.0", "delegates": "1.0.0",
"readable-stream": "^2.0.6" "readable-stream": "2.3.6"
} }
}, },
"balanced-match": { "balanced-match": {
@@ -3756,7 +3756,7 @@
"version": "1.1.11", "version": "1.1.11",
"bundled": true, "bundled": true,
"requires": { "requires": {
"balanced-match": "^1.0.0", "balanced-match": "1.0.0",
"concat-map": "0.0.1" "concat-map": "0.0.1"
} }
}, },
@@ -3810,7 +3810,7 @@
"bundled": true, "bundled": true,
"optional": true, "optional": true,
"requires": { "requires": {
"minipass": "^2.2.1" "minipass": "2.2.4"
} }
}, },
"fs.realpath": { "fs.realpath": {
@@ -3823,14 +3823,14 @@
"bundled": true, "bundled": true,
"optional": true, "optional": true,
"requires": { "requires": {
"aproba": "^1.0.3", "aproba": "1.2.0",
"console-control-strings": "^1.0.0", "console-control-strings": "1.1.0",
"has-unicode": "^2.0.0", "has-unicode": "2.0.1",
"object-assign": "^4.1.0", "object-assign": "4.1.1",
"signal-exit": "^3.0.0", "signal-exit": "3.0.2",
"string-width": "^1.0.1", "string-width": "1.0.2",
"strip-ansi": "^3.0.1", "strip-ansi": "3.0.1",
"wide-align": "^1.1.0" "wide-align": "1.1.2"
} }
}, },
"glob": { "glob": {
@@ -3838,12 +3838,12 @@
"bundled": true, "bundled": true,
"optional": true, "optional": true,
"requires": { "requires": {
"fs.realpath": "^1.0.0", "fs.realpath": "1.0.0",
"inflight": "^1.0.4", "inflight": "1.0.6",
"inherits": "2", "inherits": "2.0.3",
"minimatch": "^3.0.4", "minimatch": "3.0.4",
"once": "^1.3.0", "once": "1.4.0",
"path-is-absolute": "^1.0.0" "path-is-absolute": "1.0.1"
} }
}, },
"has-unicode": { "has-unicode": {
@@ -3856,7 +3856,7 @@
"bundled": true, "bundled": true,
"optional": true, "optional": true,
"requires": { "requires": {
"safer-buffer": "^2.1.0" "safer-buffer": "2.1.2"
} }
}, },
"ignore-walk": { "ignore-walk": {
@@ -3864,7 +3864,7 @@
"bundled": true, "bundled": true,
"optional": true, "optional": true,
"requires": { "requires": {
"minimatch": "^3.0.4" "minimatch": "3.0.4"
} }
}, },
"inflight": { "inflight": {
@@ -3872,8 +3872,8 @@
"bundled": true, "bundled": true,
"optional": true, "optional": true,
"requires": { "requires": {
"once": "^1.3.0", "once": "1.4.0",
"wrappy": "1" "wrappy": "1.0.2"
} }
}, },
"inherits": { "inherits": {
@@ -3889,7 +3889,7 @@
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true,
"requires": { "requires": {
"number-is-nan": "^1.0.0" "number-is-nan": "1.0.1"
} }
}, },
"isarray": { "isarray": {
@@ -3901,7 +3901,7 @@
"version": "3.0.4", "version": "3.0.4",
"bundled": true, "bundled": true,
"requires": { "requires": {
"brace-expansion": "^1.1.7" "brace-expansion": "1.1.11"
} }
}, },
"minimist": { "minimist": {
@@ -3912,8 +3912,8 @@
"version": "2.2.4", "version": "2.2.4",
"bundled": true, "bundled": true,
"requires": { "requires": {
"safe-buffer": "^5.1.1", "safe-buffer": "5.1.1",
"yallist": "^3.0.0" "yallist": "3.0.2"
} }
}, },
"minizlib": { "minizlib": {
@@ -3921,7 +3921,7 @@
"bundled": true, "bundled": true,
"optional": true, "optional": true,
"requires": { "requires": {
"minipass": "^2.2.1" "minipass": "2.2.4"
} }
}, },
"mkdirp": { "mkdirp": {
@@ -3941,9 +3941,9 @@
"bundled": true, "bundled": true,
"optional": true, "optional": true,
"requires": { "requires": {
"debug": "^2.1.2", "debug": "2.6.9",
"iconv-lite": "^0.4.4", "iconv-lite": "0.4.21",
"sax": "^1.2.4" "sax": "1.2.4"
} }
}, },
"node-pre-gyp": { "node-pre-gyp": {
@@ -3951,16 +3951,16 @@
"bundled": true, "bundled": true,
"optional": true, "optional": true,
"requires": { "requires": {
"detect-libc": "^1.0.2", "detect-libc": "1.0.3",
"mkdirp": "^0.5.1", "mkdirp": "0.5.1",
"needle": "^2.2.0", "needle": "2.2.0",
"nopt": "^4.0.1", "nopt": "4.0.1",
"npm-packlist": "^1.1.6", "npm-packlist": "1.1.10",
"npmlog": "^4.0.2", "npmlog": "4.1.2",
"rc": "^1.1.7", "rc": "1.2.7",
"rimraf": "^2.6.1", "rimraf": "2.6.2",
"semver": "^5.3.0", "semver": "5.5.0",
"tar": "^4" "tar": "4.4.1"
} }
}, },
"nopt": { "nopt": {
@@ -3968,8 +3968,8 @@
"bundled": true, "bundled": true,
"optional": true, "optional": true,
"requires": { "requires": {
"abbrev": "1", "abbrev": "1.1.1",
"osenv": "^0.1.4" "osenv": "0.1.5"
} }
}, },
"npm-bundled": { "npm-bundled": {
@@ -3982,8 +3982,8 @@
"bundled": true, "bundled": true,
"optional": true, "optional": true,
"requires": { "requires": {
"ignore-walk": "^3.0.1", "ignore-walk": "3.0.1",
"npm-bundled": "^1.0.1" "npm-bundled": "1.0.3"
} }
}, },
"npmlog": { "npmlog": {
@@ -3991,10 +3991,10 @@
"bundled": true, "bundled": true,
"optional": true, "optional": true,
"requires": { "requires": {
"are-we-there-yet": "~1.1.2", "are-we-there-yet": "1.1.4",
"console-control-strings": "~1.1.0", "console-control-strings": "1.1.0",
"gauge": "~2.7.3", "gauge": "2.7.4",
"set-blocking": "~2.0.0" "set-blocking": "2.0.0"
} }
}, },
"number-is-nan": { "number-is-nan": {
@@ -4010,7 +4010,7 @@
"version": "1.4.0", "version": "1.4.0",
"bundled": true, "bundled": true,
"requires": { "requires": {
"wrappy": "1" "wrappy": "1.0.2"
} }
}, },
"os-homedir": { "os-homedir": {
@@ -4028,8 +4028,8 @@
"bundled": true, "bundled": true,
"optional": true, "optional": true,
"requires": { "requires": {
"os-homedir": "^1.0.0", "os-homedir": "1.0.2",
"os-tmpdir": "^1.0.0" "os-tmpdir": "1.0.2"
} }
}, },
"path-is-absolute": { "path-is-absolute": {
@@ -4047,10 +4047,10 @@
"bundled": true, "bundled": true,
"optional": true, "optional": true,
"requires": { "requires": {
"deep-extend": "^0.5.1", "deep-extend": "0.5.1",
"ini": "~1.3.0", "ini": "1.3.5",
"minimist": "^1.2.0", "minimist": "1.2.0",
"strip-json-comments": "~2.0.1" "strip-json-comments": "2.0.1"
}, },
"dependencies": { "dependencies": {
"minimist": { "minimist": {
@@ -4065,13 +4065,13 @@
"bundled": true, "bundled": true,
"optional": true, "optional": true,
"requires": { "requires": {
"core-util-is": "~1.0.0", "core-util-is": "1.0.2",
"inherits": "~2.0.3", "inherits": "2.0.3",
"isarray": "~1.0.0", "isarray": "1.0.0",
"process-nextick-args": "~2.0.0", "process-nextick-args": "2.0.0",
"safe-buffer": "~5.1.1", "safe-buffer": "5.1.1",
"string_decoder": "~1.1.1", "string_decoder": "1.1.1",
"util-deprecate": "~1.0.1" "util-deprecate": "1.0.2"
} }
}, },
"rimraf": { "rimraf": {
@@ -4079,7 +4079,7 @@
"bundled": true, "bundled": true,
"optional": true, "optional": true,
"requires": { "requires": {
"glob": "^7.0.5" "glob": "7.1.2"
} }
}, },
"safe-buffer": { "safe-buffer": {
@@ -4115,9 +4115,9 @@
"version": "1.0.2", "version": "1.0.2",
"bundled": true, "bundled": true,
"requires": { "requires": {
"code-point-at": "^1.0.0", "code-point-at": "1.1.0",
"is-fullwidth-code-point": "^1.0.0", "is-fullwidth-code-point": "1.0.0",
"strip-ansi": "^3.0.0" "strip-ansi": "3.0.1"
} }
}, },
"string_decoder": { "string_decoder": {
@@ -4125,14 +4125,14 @@
"bundled": true, "bundled": true,
"optional": true, "optional": true,
"requires": { "requires": {
"safe-buffer": "~5.1.0" "safe-buffer": "5.1.1"
} }
}, },
"strip-ansi": { "strip-ansi": {
"version": "3.0.1", "version": "3.0.1",
"bundled": true, "bundled": true,
"requires": { "requires": {
"ansi-regex": "^2.0.0" "ansi-regex": "2.1.1"
} }
}, },
"strip-json-comments": { "strip-json-comments": {
@@ -4145,13 +4145,13 @@
"bundled": true, "bundled": true,
"optional": true, "optional": true,
"requires": { "requires": {
"chownr": "^1.0.1", "chownr": "1.0.1",
"fs-minipass": "^1.2.5", "fs-minipass": "1.2.5",
"minipass": "^2.2.4", "minipass": "2.2.4",
"minizlib": "^1.1.0", "minizlib": "1.1.0",
"mkdirp": "^0.5.0", "mkdirp": "0.5.1",
"safe-buffer": "^5.1.1", "safe-buffer": "5.1.1",
"yallist": "^3.0.2" "yallist": "3.0.2"
} }
}, },
"util-deprecate": { "util-deprecate": {
@@ -4164,7 +4164,7 @@
"bundled": true, "bundled": true,
"optional": true, "optional": true,
"requires": { "requires": {
"string-width": "^1.0.2" "string-width": "1.0.2"
} }
}, },
"wrappy": { "wrappy": {
+4
View File
@@ -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',