diff --git a/i18n/english.yml b/i18n/english.yml index 33d4fa5c5..80e42408f 100644 --- a/i18n/english.yml +++ b/i18n/english.yml @@ -1157,6 +1157,14 @@ components: line: Line priority: Priority problemType: Problem Type + RouteLayout: + errorOccurred: An error occurred while trying to fetch the data + jumpToRoute: Jump to a Route + route: "Route:" + RouteRow: + patterns: "%num% Patterns" + stops: "%num% Stops" + trips: "%num% Trips" SelectFileModal: ok: OK cancel: Cancel diff --git a/i18n/german.yml b/i18n/german.yml index a7110f645..8a3bf9ef6 100644 --- a/i18n/german.yml +++ b/i18n/german.yml @@ -1159,6 +1159,14 @@ components: und eine detailierte Beschreibung der Schritte, die Sie zuvor ausgeführt haben an %supportEmail%. view: Ansehen + RouteLayout: + errorOccurred: An error occurred while trying to fetch the data + jumpToRoute: Jump to a Route + route: "Route:" + RouteRow: + patterns: "%num% Patterns" + stops: "%num% Stops" + trips: "%num% Trips" SelectFileModal: cancel: Abbrechen ok: OK diff --git a/i18n/polish.yml b/i18n/polish.yml index 2ee92208d..613369242 100644 --- a/i18n/polish.yml +++ b/i18n/polish.yml @@ -1145,6 +1145,14 @@ components: the following text (current URL and error details), and a detailed description of the steps you followed to %supportEmail%. view: View + RouteLayout: + errorOccurred: An error occurred while trying to fetch the data + jumpToRoute: Jump to a Route + route: "Route:" + RouteRow: + patterns: "%num% Patterns" + stops: "%num% Stops" + trips: "%num% Trips" SelectFileModal: cancel: Cancel ok: OK diff --git a/lib/manager/components/reporter/components/RouteLayout.js b/lib/manager/components/reporter/components/RouteLayout.js index b508bf935..865b1ead7 100644 --- a/lib/manager/components/reporter/components/RouteLayout.js +++ b/lib/manager/components/reporter/components/RouteLayout.js @@ -17,13 +17,14 @@ import Loading from '../../../../common/components/Loading' import ActiveDateTimeFilter from '../containers/ActiveDateTimeFilter' import * as routesActions from '../../../../gtfs/actions/routes' import * as patternsActions from '../../../../gtfs/actions/patterns' -import TripsPerHourChart from './TripsPerHourChart' - +import { getComponentMessages } from '../../../../common/util/config' import type {Props as ContainerProps} from '../containers/Routes' import type {RouteRowData} from '../../../selectors' import type {FetchStatus} from '../../../../types' import type {AllRoutesSubState, RouteListItem} from '../../../../types/reducers' +import TripsPerHourChart from './TripsPerHourChart' + type Props = ContainerProps & { allRoutes: AllRoutesSubState, fetchRouteDetails: typeof routesActions.fetchRouteDetails, @@ -40,6 +41,8 @@ type Props = ContainerProps & { const PAGE_SIZE = 10 export default class RouteLayout extends Component { + messages = getComponentMessages('RouteLayout') + componentWillMount () { const {fetchRouteDetails, fetchRoutes, fetchStatus, version} = this.props const {namespace} = version @@ -54,8 +57,9 @@ export default class RouteLayout extends Component { fetchRouteDetails(version.namespace) } - _onPaginationSelect = (value: number) => { + _onPaginationSelect = (e: SyntheticMouseEvent) => { const {routeOffsetChange, version} = this.props + const value = +e.currentTarget.textContent routeOffsetChange({ namespace: version.namespace, offset: (value - 1) * PAGE_SIZE @@ -98,18 +102,33 @@ export default class RouteLayout extends Component { // order to see items 1 - 4). const extraPage = +(routeOffset % PAGE_SIZE > 0) const activePage = Math.floor(routeOffset / PAGE_SIZE) + 1 + extraPage + const numPages = Math.ceil(numRoutes / PAGE_SIZE) + + const paginationItems = [] + for (let pageNum = 1; pageNum <= numPages; pageNum++) { + paginationItems.push( + + {pageNum} + + ) + } return (
{allRoutes !== null && allRoutes.data !== null && - +