Skip to content

Commit

Permalink
fixed OrderReadyTime bug
Browse files Browse the repository at this point in the history
  • Loading branch information
amituuush committed Nov 21, 2016
1 parent caeb290 commit 0e1377e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 54 deletions.
6 changes: 5 additions & 1 deletion customer/components/App/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,9 @@ var App = React.createClass({

if (this.state.pickupTime === true) {
var expectedPickupTime = moment().add(this.state.durationSeconds, 's').format('LT');
this.setState({
expectedPickupTime: expectedPickupTime
})
} else {
var expectedPickupTime = '';
}
Expand Down Expand Up @@ -580,7 +583,8 @@ var App = React.createClass({
previousOrders: this.state.previousOrders,
favoriteOrders: this.state.favoriteOrders,
handleMenuToggle:this._handleMenuToggle,
menuShow:this.state.menuShow
menuShow:this.state.menuShow,
expectedPickupTime: this.state.expectedPickupTime
})
}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ var ConfirmationView = React.createClass({
selectedShopLocation: React.PropTypes.shape({
lat: React.PropTypes.number,
lng: React.PropTypes.number
})
}),
expectedPickupTime: React.PropTypes.string
},

render: function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,14 @@ var OrderReadyTime = React.createClass({
React.PropTypes.string,
React.PropTypes.bool
]),
duration: React.PropTypes.string
duration: React.PropTypes.string,
expectedPickupTime: React.PropTypes.string
},

render: function() {

var methodOfTransIcon;
switch(this.props.methodOfTrans) {
case 'walking':
methodOfTransIcon = <div className="method-of-trans-icon"><i className="fa fa-male fa-3x" aria-hidden="true"></i></div>;
break;
case 'biking':
methodOfTransIcon = <div className="method-of-trans-icon"><i className="fa fa-bicycle fa-3x" aria-hidden="true"></i></div>;
break;
case 'driving':
methodOfTransIcon = <div className="method-of-trans-icon"><i className="fa fa-car fa-3x" aria-hidden="true"></i></div>;
break;
default:
methodOfTransIcon = <div className="method-of-trans-icon">No user input :(</div>
}

var pickupTime;
if (this.props.pickupTime) {
if (this.props.pickupTime === true) {
pickupTime = <div className="order-ready-time-container">
<h2>Head to the shop,
and your order will be ready in...</h2>
Expand Down
45 changes: 10 additions & 35 deletions public/customer-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -25406,6 +25406,9 @@

if (this.state.pickupTime === true) {
var expectedPickupTime = (0, _moment2.default)().add(this.state.durationSeconds, 's').format('LT');
this.setState({
expectedPickupTime: expectedPickupTime
});
} else {
var expectedPickupTime = '';
}
Expand Down Expand Up @@ -25804,7 +25807,8 @@
previousOrders: this.state.previousOrders,
favoriteOrders: this.state.favoriteOrders,
handleMenuToggle: this._handleMenuToggle,
menuShow: this.state.menuShow
menuShow: this.state.menuShow,
expectedPickupTime: this.state.expectedPickupTime
})
)
);
Expand Down Expand Up @@ -61993,7 +61997,8 @@
selectedShopLocation: _react2.default.PropTypes.shape({
lat: _react2.default.PropTypes.number,
lng: _react2.default.PropTypes.number
})
}),
expectedPickupTime: _react2.default.PropTypes.string
},

render: function render() {
Expand Down Expand Up @@ -62069,44 +62074,14 @@
propTypes: {
methodOfTrans: _react2.default.PropTypes.string,
pickupTime: _react2.default.PropTypes.oneOfType([_react2.default.PropTypes.string, _react2.default.PropTypes.bool]),
duration: _react2.default.PropTypes.string
duration: _react2.default.PropTypes.string,
expectedPickupTime: _react2.default.PropTypes.string
},

render: function render() {

var methodOfTransIcon;
switch (this.props.methodOfTrans) {
case 'walking':
methodOfTransIcon = _react2.default.createElement(
'div',
{ className: 'method-of-trans-icon' },
_react2.default.createElement('i', { className: 'fa fa-male fa-3x', 'aria-hidden': 'true' })
);
break;
case 'biking':
methodOfTransIcon = _react2.default.createElement(
'div',
{ className: 'method-of-trans-icon' },
_react2.default.createElement('i', { className: 'fa fa-bicycle fa-3x', 'aria-hidden': 'true' })
);
break;
case 'driving':
methodOfTransIcon = _react2.default.createElement(
'div',
{ className: 'method-of-trans-icon' },
_react2.default.createElement('i', { className: 'fa fa-car fa-3x', 'aria-hidden': 'true' })
);
break;
default:
methodOfTransIcon = _react2.default.createElement(
'div',
{ className: 'method-of-trans-icon' },
'No user input :('
);
}

var pickupTime;
if (this.props.pickupTime) {
if (this.props.pickupTime === true) {
pickupTime = _react2.default.createElement(
'div',
{ className: 'order-ready-time-container' },
Expand Down

0 comments on commit 0e1377e

Please sign in to comment.