@@ -6,11 +6,9 @@ import sortBy from 'lodash/sortBy';
66import groupBy from 'lodash/groupBy' ;
77import padStart from 'lodash/padStart' ;
88import { FormattedMessage , useIntl } from 'react-intl' ;
9- import { matchShape , routerShape } from 'found' ;
109import { useFragment } from 'react-relay' ;
11- import { connectToStores } from 'fluxible-addons-react' ;
1210import cx from 'classnames' ;
13- import { configShape } from '../../util/shapes ' ;
11+ import { useRouter } from 'found ' ;
1412import Icon from '../Icon' ;
1513import FilterTimeTableModal from './FilterTimeTableModal' ;
1614import TimeTableOptionsPanel from './TimeTableOptionsPanel' ;
@@ -23,6 +21,7 @@ import ScrollableWrapper from '../ScrollableWrapper';
2321import { replaceQueryParams } from '../../util/queryUtils' ;
2422import { PREFIX_STOPS } from '../../util/path' ;
2523import { TimetableFragment } from './queries/TimetableFragment' ;
24+ import { useConfigContext } from '../../configurations/ConfigContext' ;
2625
2726const mapStopTimes = stoptimesObject =>
2827 stoptimesObject
@@ -135,10 +134,14 @@ const createTimeTableRows = (timetableMap, showRoutes) =>
135134 />
136135 ) ) ;
137136
138- function Timetable (
139- { stop : stopRef , startDate, onDateChange, date, language } ,
140- { router, match, config } ,
141- ) {
137+ export default function Timetable ( {
138+ stop : stopRef ,
139+ startDate,
140+ onDateChange,
141+ date,
142+ } ) {
143+ const { match, router } = useRouter ( ) ;
144+ const config = useConfigContext ( ) ;
142145 const stop = useFragment ( TimetableFragment , stopRef ) ;
143146 const intl = useIntl ( ) ;
144147 if ( ! stop ) {
@@ -259,7 +262,7 @@ function Timetable(
259262 config . URL . STOP_TIMETABLES [ stopIdSplitted [ 0 ] ] ,
260263 stop ,
261264 date ,
262- language ,
265+ config . language ,
263266 )
264267 : null ;
265268 const virtualMonitorUrl =
@@ -477,23 +480,4 @@ Timetable.propTypes = {
477480 startDate : PropTypes . string . isRequired ,
478481 onDateChange : PropTypes . func . isRequired ,
479482 date : PropTypes . string . isRequired ,
480- language : PropTypes . string . isRequired ,
481483} ;
482-
483- Timetable . contextTypes = {
484- router : routerShape . isRequired ,
485- match : matchShape . isRequired ,
486- config : configShape . isRequired ,
487- } ;
488-
489- Timetable . displayName = 'Timetable' ;
490-
491- const connectedComponent = connectToStores (
492- Timetable ,
493- [ 'PreferencesStore' ] ,
494- context => ( {
495- language : context . getStore ( 'PreferencesStore' ) . getLanguage ( ) ,
496- } ) ,
497- ) ;
498-
499- export { connectedComponent as default , Timetable as Component } ;
0 commit comments