From 0cfcac439d3bd2e0794336b21a32364b882e73f6 Mon Sep 17 00:00:00 2001 From: sipp11 Date: Fri, 19 Oct 2018 17:39:15 +0900 Subject: [PATCH] Fare on route page --- src/components/RouteDetail.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/components/RouteDetail.js b/src/components/RouteDetail.js index 29ac5dc..bee30d6 100644 --- a/src/components/RouteDetail.js +++ b/src/components/RouteDetail.js @@ -7,6 +7,7 @@ import Spinner from './Spinner' import { getRoute, polygonUpdate } from '../actions' import { getStopTime } from '../actions/stoptime' import { getTrip } from '../actions/trip' +import { getFareAttr } from '../actions/fare' import store from '../store' const StyledTripDesc = styled.div` @@ -83,14 +84,14 @@ const TripList = (props) => ( ) -const FareRuleList = (props) => ( +const FareAttrList = (props) => (
- {props.farerules.map(ele => ( + {props.fareattrItems && props.fareattrItems.map(ele => ( - {ele.fare.fare_id} - {ele.fare.price} + {ele.fare_id} - {ele.price} {ele.currency_type} ))} - {props.farerules.length === 0 && + {props.fareattrItems && props.fareattrItems.length === 0 && No fare rule set }
@@ -116,6 +117,7 @@ class RouteDetail extends Component { } else { this.pushShapeToStore(match, route) } + store.dispatch(getFareAttr(`agency=${match.params.agencyId}`)) } componentWillReceiveProps(newProps) { @@ -137,7 +139,7 @@ class RouteDetail extends Component { } render() { - const { route, match, trip } = this.props + const { route, match, trip, fareattr } = this.props const { routeId, agencyId, routeParams } = match.params const tRoute = route.results.filter(ele => ele.route_id === routeId) if (tRoute.length === 0) { @@ -162,7 +164,7 @@ class RouteDetail extends Component { ( )} /> ( - )} /> + )} /> ( )} /> @@ -173,6 +175,7 @@ class RouteDetail extends Component { const mapStateToProps = state => ({ route: state.route, trip: state.trip, + fareattr: state.fareattr, }) export default connect( mapStateToProps