From 7a574f1fd319f8fd6a385ed854751efacf7c4d71 Mon Sep 17 00:00:00 2001 From: Hannes Junnila Date: Thu, 1 Jun 2017 10:07:23 +0300 Subject: [PATCH 1/4] update lockfile --- yarn.lock | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/yarn.lock b/yarn.lock index 6cca522639..b91421db71 100644 --- a/yarn.lock +++ b/yarn.lock @@ -341,9 +341,9 @@ async@1.x, async@^1.3.0, async@^1.4.0, async@^1.5.0, async@^1.5.2: version "1.5.2" resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" -async@2.1.5, async@^2.1.2, async@^2.1.5: - version "2.1.5" - resolved "https://registry.yarnpkg.com/async/-/async-2.1.5.tgz#e587c68580994ac67fc56ff86d3ac56bdbe810bc" +async@2.4.1: + version "2.4.1" + resolved "https://registry.yarnpkg.com/async/-/async-2.4.1.tgz#62a56b279c98a11d0987096a01cc3eeb8eb7bbd7" dependencies: lodash "^4.14.0" @@ -351,6 +351,12 @@ async@^0.9.0, async@~0.9.0: version "0.9.2" resolved "https://registry.yarnpkg.com/async/-/async-0.9.2.tgz#aea74d5e61c1f899613bf64bda66d4c78f2fd17d" +async@^2.1.2, async@^2.1.5: + version "2.1.5" + resolved "https://registry.yarnpkg.com/async/-/async-2.1.5.tgz#e587c68580994ac67fc56ff86d3ac56bdbe810bc" + dependencies: + lodash "^4.14.0" + async@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/async/-/async-1.0.0.tgz#f8fc04ca3a13784ade9e1641af98578cfbd647a9" @@ -1541,11 +1547,11 @@ camelcase@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-3.0.0.tgz#32fc4b9fcdaf845fcdf7e73bb97cac2261f0ab0a" -caniuse-db@1.0.30000671: +caniuse-db@1.0.30000671, caniuse-db@^1.0.30000187, caniuse-db@^1.0.30000624: version "1.0.30000671" resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000671.tgz#9f071bbc7b96994638ccbaf47829d58a1577a8ed" -caniuse-db@^1.0.30000187, caniuse-db@^1.0.30000624, caniuse-db@^1.0.30000628: +caniuse-db@^1.0.30000628: version "1.0.30000631" resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000631.tgz#8aa6f65cff452c4aba1c2aaa1e724102fbb9114f" @@ -3555,9 +3561,9 @@ gemini-coverage@^1.0.0: q "^1.4.1" q-io "^2.0.6" -gemini@4.18.1: - version "4.18.1" - resolved "https://registry.yarnpkg.com/gemini/-/gemini-4.18.1.tgz#0a98cd1ea078daf56aa3c01e50ded7b8ad042777" +gemini@5.0.0-alpha.1: + version "5.0.0-alpha.1" + resolved "https://registry.yarnpkg.com/gemini/-/gemini-5.0.0-alpha.1.tgz#314792fdc08b9b6605bb69e72044445523206df7" dependencies: aliasify "^1.7.2" bluebird "^3.4.6" @@ -3572,6 +3578,7 @@ gemini@4.18.1: gemini-configparser "^0.1.1" gemini-core "^1.0.0" gemini-coverage "^1.0.0" + graceful-fs "^4.1.11" handlebars "^4.0.5" inherit "~2.2.1" js-yaml "^3.2.5" @@ -3784,7 +3791,7 @@ got@^3.2.0: read-all-stream "^3.0.0" timed-out "^2.0.0" -graceful-fs@^4.1.10, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9: +graceful-fs@^4.1.10, graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9: version "4.1.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" @@ -4672,7 +4679,7 @@ json-stable-stringify@~0.0.0: dependencies: jsonify "~0.0.0" -json-stringify-safe@5.0.1, json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.0, json-stringify-safe@~5.0.1: +json-stringify-safe@5.0.1, json-stringify-safe@~5.0.0, json-stringify-safe@~5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" @@ -7023,11 +7030,9 @@ range-parser@^1.0.3, range-parser@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.0.tgz#f49be6b487894ddc40dcc94a322f611092e00d5e" -raven-js@3.12.0: - version "3.12.0" - resolved "https://registry.yarnpkg.com/raven-js/-/raven-js-3.12.0.tgz#74bd45c87a1ad34476e77bd8385549d76766f6e7" - dependencies: - json-stringify-safe "^5.0.1" +raven-js@3.15.0: + version "3.15.0" + resolved "https://registry.yarnpkg.com/raven-js/-/raven-js-3.15.0.tgz#ebf95466b7d40fbbc3d6a5085af7c1431607926c" raven@1.1.3: version "1.1.3" From 347d639ec2eba3777b14918fc099ef0ee883d214 Mon Sep 17 00:00:00 2001 From: Hannes Junnila Date: Thu, 1 Jun 2017 10:07:40 +0300 Subject: [PATCH 2/4] Update time contents when props update --- app/component/ItineraryTimePicker.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/component/ItineraryTimePicker.js b/app/component/ItineraryTimePicker.js index c10a61c303..290bd056d7 100644 --- a/app/component/ItineraryTimePicker.js +++ b/app/component/ItineraryTimePicker.js @@ -19,6 +19,18 @@ export default class ItineraryTimePicker extends React.Component { this.onChangeTime = this.onChangeTime.bind(this); } + componentWillReceiveProps({ initHours, initMin }) { + if (this.props.initHours !== initHours || this.props.initMin !== initMin) { + this.setState({ + hours: initHours, + minutes: initMin, + lastKey: 0, + oldHour: initHours, + oldMinute: initMin, + }); + } + } + onChangeTime(event) { // If backspace is pressed, erase the value const timePropertyId = event.target.id === 'inputHours' ? 'hours' : 'minutes'; From 10d172d739834d153f2e193473365a8b09150b85 Mon Sep 17 00:00:00 2001 From: Hannes Junnila Date: Thu, 1 Jun 2017 10:07:56 +0300 Subject: [PATCH 3/4] Fix lint warning --- app/component/ItineraryTimePicker.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/component/ItineraryTimePicker.js b/app/component/ItineraryTimePicker.js index 290bd056d7..0e8ca81d78 100644 --- a/app/component/ItineraryTimePicker.js +++ b/app/component/ItineraryTimePicker.js @@ -1,6 +1,8 @@ import React, { PropTypes } from 'react'; import { isMobile } from '../util/browser'; +const setSelectionRange = e => e.target.setSelectionRange(0, 2); + export default class ItineraryTimePicker extends React.Component { static propTypes = { changeTime: PropTypes.func.isRequired, @@ -203,7 +205,7 @@ export default class ItineraryTimePicker extends React.Component { className="time-input-field" value={this.state.hours} maxLength={3} - onClick={e => e.target.setSelectionRange(0, 2)} + onClick={setSelectionRange} onChange={this.onChangeTime} onBlur={this.handleBlur} onKeyDown={this.handleKeyDown} @@ -216,7 +218,7 @@ export default class ItineraryTimePicker extends React.Component { className="time-input-field" value={this.state.minutes} maxLength={3} - onClick={e => e.target.setSelectionRange(0, 2)} + onClick={setSelectionRange} onChange={this.onChangeTime} onBlur={this.handleBlur} onKeyDown={this.handleKeyDown} From 561e6448f5edb643e37687dc5ed47dfa51248632 Mon Sep 17 00:00:00 2001 From: Hannes Junnila Date: Thu, 1 Jun 2017 10:31:58 +0300 Subject: [PATCH 4/4] Do not pad with zeros when updating field --- app/component/ItineraryTimePicker.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/component/ItineraryTimePicker.js b/app/component/ItineraryTimePicker.js index 0e8ca81d78..622933997a 100644 --- a/app/component/ItineraryTimePicker.js +++ b/app/component/ItineraryTimePicker.js @@ -22,7 +22,10 @@ export default class ItineraryTimePicker extends React.Component { } componentWillReceiveProps({ initHours, initMin }) { - if (this.props.initHours !== initHours || this.props.initMin !== initMin) { + if ( + Number(this.hourEl.value) !== Number(initHours) || + Number(this.minEl.value) !== Number(initMin) + ) { this.setState({ hours: initHours, minutes: initMin,