Skip to content

Commit 10cac0f

Browse files
Merge pull request #219 from opentripplanner/tripmon-merge-steps
Saved Trips: Remove "wizard" mode
2 parents 9e98f86 + 38cdbc3 commit 10cac0f

File tree

4 files changed

+43
-85
lines changed

4 files changed

+43
-85
lines changed

Diff for: lib/components/user/saved-trip-editor.js

+32-16
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,47 @@ import StackedPaneDisplay from './stacked-pane-display'
77
* This component handles editing of an existing trip.
88
*/
99
const SavedTripEditor = ({
10+
isCreating,
1011
monitoredTrip,
1112
onCancel,
1213
onComplete,
1314
onDeleteTrip,
1415
panes
1516
}) => {
1617
if (monitoredTrip) {
17-
const paneSequence = [
18-
{
19-
pane: panes.basics,
20-
title: 'Trip overview'
21-
},
22-
{
23-
pane: panes.notifications,
24-
title: 'Trip notifications'
25-
},
26-
{
27-
// TODO: Find a better place for this.
28-
pane: () => <Button bsStyle='danger' onClick={onDeleteTrip}>Delete Trip</Button>,
29-
title: 'Danger zone'
30-
}
31-
]
18+
let paneSequence
19+
if (isCreating) {
20+
paneSequence = [
21+
{
22+
pane: panes.basics,
23+
title: 'Trip information'
24+
},
25+
{
26+
pane: panes.notifications,
27+
title: 'Trip notifications'
28+
}
29+
]
30+
} else {
31+
paneSequence = [
32+
{
33+
pane: panes.basics,
34+
title: 'Trip overview'
35+
},
36+
{
37+
pane: panes.notifications,
38+
title: 'Trip notifications'
39+
},
40+
{
41+
// TODO: Find a better place for this.
42+
pane: () => <Button bsStyle='danger' onClick={onDeleteTrip}>Delete Trip</Button>,
43+
title: 'Danger zone'
44+
}
45+
]
46+
}
47+
3248
return (
3349
<>
34-
<h1>{monitoredTrip.tripName}</h1>
50+
<h1>{isCreating ? 'Save trip' : monitoredTrip.tripName}</h1>
3551
<StackedPaneDisplay
3652
onCancel={onCancel}
3753
onComplete={onComplete}

Diff for: lib/components/user/saved-trip-screen.js

+9-24
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import * as uiActions from '../../actions/ui'
66
import * as userActions from '../../actions/user'
77
import DesktopNav from '../app/desktop-nav'
88
import SavedTripEditor from './saved-trip-editor'
9-
import SavedTripWizard from './saved-trip-wizard'
109
import TripBasicsPane from './trip-basics-pane'
1110
import TripNotificationsPane from './trip-notifications-pane'
1211
import TripSummaryPane from './trip-summary-pane'
@@ -187,36 +186,22 @@ class SavedTripScreen extends Component {
187186
}
188187

189188
render () {
190-
const { isCreating, monitoredTrips } = this.props
189+
const { isCreating } = this.props
191190
const { monitoredTrip } = this.state
192191

193-
let content
194-
if (isCreating && !hasMaxTripCount(monitoredTrips)) {
195-
content = (
196-
<SavedTripWizard
197-
monitoredTrip={monitoredTrip}
198-
onComplete={this._handleSaveNewTrip}
199-
panes={this._panes}
200-
/>
201-
)
202-
} else {
203-
content = (
204-
<SavedTripEditor
205-
monitoredTrip={monitoredTrip}
206-
onCancel={this._goToSavedTrips}
207-
onComplete={this._handleSaveTripEdits}
208-
onDeleteTrip={this._handleDeleteTrip}
209-
panes={this._panes}
210-
/>
211-
)
212-
}
213-
214192
return (
215193
<div className='otp'>
216194
{/* TODO: Do mobile view. */}
217195
<DesktopNav />
218196
<form className='container'>
219-
{content}
197+
<SavedTripEditor
198+
isCreating={isCreating}
199+
monitoredTrip={monitoredTrip}
200+
onCancel={isCreating ? this._goToTripPlanner : this._goToSavedTrips}
201+
onComplete={isCreating ? this._handleSaveNewTrip : this._handleSaveTripEdits}
202+
onDeleteTrip={this._handleDeleteTrip}
203+
panes={this._panes}
204+
/>
220205
</form>
221206
</div>
222207
)

Diff for: lib/components/user/saved-trip-wizard.js

-43
This file was deleted.

Diff for: lib/components/user/trip-notifications-pane.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ class TripNotificationsPane extends Component {
7171
</FormGroup>
7272

7373
<Alert bsStyle='warning'>
74-
Under construction!
74+
Under construction!
7575
<FormGroup>
7676
<ControlLabel>Notify me if:</ControlLabel>
7777
<Checkbox>A different route or transfer point is recommended</Checkbox>
7878
<Checkbox>There is an alert for a route or stop that is part of my journey</Checkbox>
7979

80-
Your arrival or departure time changes by more than:
80+
Your arrival or departure time changes by more than:
8181
<FormControl componentClass='select' defaultValue={5} placeholder='select'>
8282
<option value={5}>5 min. (default)</option>
8383
<option value={10}>10 min.</option>

0 commit comments

Comments
 (0)