RouteResults widget

This commit is contained in:
ronreg-ribdev 2020-06-05 03:42:01 -07:00
parent c718c49ceb
commit ed70fce6a7
2 changed files with 20 additions and 2 deletions

View File

@ -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>

View File

@ -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;
}
} }
} }
} }