diff --git a/components/cycle-day/cycle-day-overview.js b/components/cycle-day/cycle-day-overview.js index 85e8d48a59b75f4165cf0a8a3bb0ec229ae586c9..2c6916f67fa74448788a29868470bdd6739c5cf3 100644 --- a/components/cycle-day/cycle-day-overview.js +++ b/components/cycle-day/cycle-day-overview.js @@ -49,6 +49,7 @@ export default class CycleDayOverView extends Component { const cycleDay = this.state.cycleDay const getCycleDayNumber = cycleModule().getCycleDayNumber const cycleDayNumber = getCycleDayNumber(cycleDay.date) + const dateInFuture = LocalDate.now().isBefore(LocalDate.parse(this.state.cycleDay.date)) return ( <View style={{ flex: 1 }}> <Header @@ -63,36 +64,42 @@ export default class CycleDayOverView extends Component { title='Bleeding' onPress={() => this.navigate('BleedingEditView')} data={getLabel('bleeding', cycleDay.bleeding)} + disabled={dateInFuture} /> <SymptomBox title='Temperature' onPress={() => this.navigate('TemperatureEditView')} data={getLabel('temperature', cycleDay.temperature)} + disabled={dateInFuture} /> <SymptomBox title='Mucus' onPress={() => this.navigate('MucusEditView')} data={getLabel('mucus', cycleDay.mucus)} + disabled={dateInFuture} /> <SymptomBox title='Cervix' onPress={() => this.navigate('CervixEditView')} data={getLabel('cervix', cycleDay.cervix)} - /> - <SymptomBox - title='Note' - onPress={() => this.navigate('NoteEditView')} - data={getLabel('note', cycleDay.note)} + disabled={dateInFuture} /> <SymptomBox title='Desire' onPress={() => this.navigate('DesireEditView')} data={getLabel('desire', cycleDay.desire)} + disabled={dateInFuture} /> <SymptomBox title='Sex' onPress={() => this.navigate('SexEditView')} 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 (and) because there are no pseudo properties in RN */} @@ -174,18 +181,22 @@ function getLabel(symptomName, symptom) { return label.slice(0, 42) + '...' } + class SymptomBox extends Component { render() { const d = this.props.data const boxActive = d ? styles.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 iconStyle = Object.assign({}, iconStyles.symptomBox, iconActive) + const symptomBoxStyle = Object.assign({}, styles.symptomBox, boxActive, disabledStyle) + const iconStyle = Object.assign({}, iconStyles.symptomBox, iconActive, disabledStyle) + const symptomDataBoxStyle = Object.assign({}, styles.symptomDataBox, disabledStyle) + const textStyle = Object.assign({}, textActive, disabledStyle) return ( - <TouchableOpacity onPress={this.props.onPress}> + <TouchableOpacity onPress={this.props.onPress} disabled={this.props.disabled}> <View style={symptomBoxStyle}> <Icon name='thermometer' @@ -193,7 +204,7 @@ class SymptomBox extends Component { /> <Text style={textStyle}>{this.props.title}</Text> </View> - <View style={styles.symptomDataBox}> + <View style={symptomDataBoxStyle}> <Text style={styles.symptomDataText}>{this.props.data}</Text> </View> </TouchableOpacity> diff --git a/package-lock.json b/package-lock.json index 49c8ac7241667ba94212a29ccd802fce1a69203a..48fa357aa3468dbaaf81d3a82258b5b877dea8ef 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3721,8 +3721,8 @@ "integrity": "sha512-z8H8/diyk76B7q5wg+Ud0+CqzcAF3mBBI/bA5ne5zrRUUIvNkJY//D3BqyH571KuAC4Nr7Rw7CjWX4r0y9DvNg==", "optional": true, "requires": { - "nan": "^2.9.2", - "node-pre-gyp": "^0.10.0" + "nan": "2.10.0", + "node-pre-gyp": "0.10.0" }, "dependencies": { "abbrev": { @@ -3744,8 +3744,8 @@ "bundled": true, "optional": true, "requires": { - "delegates": "^1.0.0", - "readable-stream": "^2.0.6" + "delegates": "1.0.0", + "readable-stream": "2.3.6" } }, "balanced-match": { @@ -3756,7 +3756,7 @@ "version": "1.1.11", "bundled": true, "requires": { - "balanced-match": "^1.0.0", + "balanced-match": "1.0.0", "concat-map": "0.0.1" } }, @@ -3810,7 +3810,7 @@ "bundled": true, "optional": true, "requires": { - "minipass": "^2.2.1" + "minipass": "2.2.4" } }, "fs.realpath": { @@ -3823,14 +3823,14 @@ "bundled": true, "optional": true, "requires": { - "aproba": "^1.0.3", - "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.0", - "object-assign": "^4.1.0", - "signal-exit": "^3.0.0", - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wide-align": "^1.1.0" + "aproba": "1.2.0", + "console-control-strings": "1.1.0", + "has-unicode": "2.0.1", + "object-assign": "4.1.1", + "signal-exit": "3.0.2", + "string-width": "1.0.2", + "strip-ansi": "3.0.1", + "wide-align": "1.1.2" } }, "glob": { @@ -3838,12 +3838,12 @@ "bundled": true, "optional": true, "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" } }, "has-unicode": { @@ -3856,7 +3856,7 @@ "bundled": true, "optional": true, "requires": { - "safer-buffer": "^2.1.0" + "safer-buffer": "2.1.2" } }, "ignore-walk": { @@ -3864,7 +3864,7 @@ "bundled": true, "optional": true, "requires": { - "minimatch": "^3.0.4" + "minimatch": "3.0.4" } }, "inflight": { @@ -3872,8 +3872,8 @@ "bundled": true, "optional": true, "requires": { - "once": "^1.3.0", - "wrappy": "1" + "once": "1.4.0", + "wrappy": "1.0.2" } }, "inherits": { @@ -3889,7 +3889,7 @@ "version": "1.0.0", "bundled": true, "requires": { - "number-is-nan": "^1.0.0" + "number-is-nan": "1.0.1" } }, "isarray": { @@ -3901,7 +3901,7 @@ "version": "3.0.4", "bundled": true, "requires": { - "brace-expansion": "^1.1.7" + "brace-expansion": "1.1.11" } }, "minimist": { @@ -3912,8 +3912,8 @@ "version": "2.2.4", "bundled": true, "requires": { - "safe-buffer": "^5.1.1", - "yallist": "^3.0.0" + "safe-buffer": "5.1.1", + "yallist": "3.0.2" } }, "minizlib": { @@ -3921,7 +3921,7 @@ "bundled": true, "optional": true, "requires": { - "minipass": "^2.2.1" + "minipass": "2.2.4" } }, "mkdirp": { @@ -3941,9 +3941,9 @@ "bundled": true, "optional": true, "requires": { - "debug": "^2.1.2", - "iconv-lite": "^0.4.4", - "sax": "^1.2.4" + "debug": "2.6.9", + "iconv-lite": "0.4.21", + "sax": "1.2.4" } }, "node-pre-gyp": { @@ -3951,16 +3951,16 @@ "bundled": true, "optional": true, "requires": { - "detect-libc": "^1.0.2", - "mkdirp": "^0.5.1", - "needle": "^2.2.0", - "nopt": "^4.0.1", - "npm-packlist": "^1.1.6", - "npmlog": "^4.0.2", - "rc": "^1.1.7", - "rimraf": "^2.6.1", - "semver": "^5.3.0", - "tar": "^4" + "detect-libc": "1.0.3", + "mkdirp": "0.5.1", + "needle": "2.2.0", + "nopt": "4.0.1", + "npm-packlist": "1.1.10", + "npmlog": "4.1.2", + "rc": "1.2.7", + "rimraf": "2.6.2", + "semver": "5.5.0", + "tar": "4.4.1" } }, "nopt": { @@ -3968,8 +3968,8 @@ "bundled": true, "optional": true, "requires": { - "abbrev": "1", - "osenv": "^0.1.4" + "abbrev": "1.1.1", + "osenv": "0.1.5" } }, "npm-bundled": { @@ -3982,8 +3982,8 @@ "bundled": true, "optional": true, "requires": { - "ignore-walk": "^3.0.1", - "npm-bundled": "^1.0.1" + "ignore-walk": "3.0.1", + "npm-bundled": "1.0.3" } }, "npmlog": { @@ -3991,10 +3991,10 @@ "bundled": true, "optional": true, "requires": { - "are-we-there-yet": "~1.1.2", - "console-control-strings": "~1.1.0", - "gauge": "~2.7.3", - "set-blocking": "~2.0.0" + "are-we-there-yet": "1.1.4", + "console-control-strings": "1.1.0", + "gauge": "2.7.4", + "set-blocking": "2.0.0" } }, "number-is-nan": { @@ -4010,7 +4010,7 @@ "version": "1.4.0", "bundled": true, "requires": { - "wrappy": "1" + "wrappy": "1.0.2" } }, "os-homedir": { @@ -4028,8 +4028,8 @@ "bundled": true, "optional": true, "requires": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.0" + "os-homedir": "1.0.2", + "os-tmpdir": "1.0.2" } }, "path-is-absolute": { @@ -4047,10 +4047,10 @@ "bundled": true, "optional": true, "requires": { - "deep-extend": "^0.5.1", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" + "deep-extend": "0.5.1", + "ini": "1.3.5", + "minimist": "1.2.0", + "strip-json-comments": "2.0.1" }, "dependencies": { "minimist": { @@ -4065,13 +4065,13 @@ "bundled": true, "optional": true, "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "2.0.0", + "safe-buffer": "5.1.1", + "string_decoder": "1.1.1", + "util-deprecate": "1.0.2" } }, "rimraf": { @@ -4079,7 +4079,7 @@ "bundled": true, "optional": true, "requires": { - "glob": "^7.0.5" + "glob": "7.1.2" } }, "safe-buffer": { @@ -4115,9 +4115,9 @@ "version": "1.0.2", "bundled": true, "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" } }, "string_decoder": { @@ -4125,14 +4125,14 @@ "bundled": true, "optional": true, "requires": { - "safe-buffer": "~5.1.0" + "safe-buffer": "5.1.1" } }, "strip-ansi": { "version": "3.0.1", "bundled": true, "requires": { - "ansi-regex": "^2.0.0" + "ansi-regex": "2.1.1" } }, "strip-json-comments": { @@ -4145,13 +4145,13 @@ "bundled": true, "optional": true, "requires": { - "chownr": "^1.0.1", - "fs-minipass": "^1.2.5", - "minipass": "^2.2.4", - "minizlib": "^1.1.0", - "mkdirp": "^0.5.0", - "safe-buffer": "^5.1.1", - "yallist": "^3.0.2" + "chownr": "1.0.1", + "fs-minipass": "1.2.5", + "minipass": "2.2.4", + "minizlib": "1.1.0", + "mkdirp": "0.5.1", + "safe-buffer": "5.1.1", + "yallist": "3.0.2" } }, "util-deprecate": { @@ -4164,7 +4164,7 @@ "bundled": true, "optional": true, "requires": { - "string-width": "^1.0.2" + "string-width": "1.0.2" } }, "wrappy": { diff --git a/styles/index.js b/styles/index.js index 406de7abddc38fd42041dfcf537bc973a0d3a165..2546606ad451cb7340e6242aed5b36bd382e4eb2 100644 --- a/styles/index.js +++ b/styles/index.js @@ -61,6 +61,10 @@ export default StyleSheet.create({ symptomTextActive: { color: fontOnPrimaryColor }, + symptomInFuture: { + borderColor: 'lightgrey', + color: 'lightgrey' + }, symptomDataBox: { borderColor: secondaryColor, borderStyle: 'solid',