RouteResults widget
This commit is contained in:
parent
c718c49ceb
commit
ed70fce6a7
@ -251,9 +251,20 @@ class RouteSearch extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class RouteResults extends Component {
|
||||||
|
render() {
|
||||||
|
console.log(this.props.routes);
|
||||||
|
if (!this.props.routes) {
|
||||||
|
return (<div></div>);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (<div>
|
||||||
|
Trains:
|
||||||
|
</div>);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class RoutePlanner extends Component {
|
class RoutePlanner extends Component {
|
||||||
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const curTime = this.props.curTime;
|
const curTime = this.props.curTime;
|
||||||
const mapFilename = isSundaySchedule(curTime) ? "BART-Map-Sunday.png" : "BART-Map-Weekday-Saturday.png";
|
const mapFilename = isSundaySchedule(curTime) ? "BART-Map-Sunday.png" : "BART-Map-Weekday-Saturday.png";
|
||||||
@ -274,6 +285,7 @@ class RoutePlanner extends Component {
|
|||||||
Search scheduled trains:
|
Search scheduled trains:
|
||||||
<RouteSearch stations={this.props.stations} curTime={curTime} />
|
<RouteSearch stations={this.props.stations} curTime={curTime} />
|
||||||
<br/>
|
<br/>
|
||||||
|
<RouteResults routes={this.props.routes} />
|
||||||
or see the official bart scheduler for a given station, date and time:
|
or see the official bart scheduler for a given station, date and time:
|
||||||
<ScheduleWidget stations={this.props.stations}/>
|
<ScheduleWidget stations={this.props.stations}/>
|
||||||
</div>
|
</div>
|
||||||
@ -306,6 +318,7 @@ export class Root extends Component {
|
|||||||
<RoutePlanner
|
<RoutePlanner
|
||||||
curTime={new Date() }
|
curTime={new Date() }
|
||||||
stations={this.state.stations || []}
|
stations={this.state.stations || []}
|
||||||
|
routes={this.state.routes}
|
||||||
/> } />
|
/> } />
|
||||||
</div>
|
</div>
|
||||||
</BrowserRouter>
|
</BrowserRouter>
|
||||||
|
@ -14,6 +14,11 @@ export class UpdateReducer {
|
|||||||
if (elevators) {
|
if (elevators) {
|
||||||
state.elevators = elevators;
|
state.elevators = elevators;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const routes = _.get(data, "routes", false);
|
||||||
|
if (routes) {
|
||||||
|
state.routes = routes;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user