11import React from 'react' ;
22import PropTypes from 'prop-types' ;
33import { useIntl } from 'react-intl' ;
4- import connectToStores from 'fluxible-addons-react/connectToStores' ;
5- import { legShape , configShape } from '../../util/shapes' ;
4+ import { legShape } from '../../util/shapes' ;
65import TransitLeg from './TransitLeg' ;
76import CallAgencyDisclaimer from './CallAgencyDisclaimer' ;
87import RouteNumberContainer from '../RouteNumber' ;
98import withBreakpoint from '../../util/withBreakpoint' ;
109import { isLocalCallAgency } from '../../util/legUtils' ;
10+ import { useConfigContext } from '../../configurations/ConfigContext' ;
1111
12- const CallAgencyLeg = (
13- { leg, currentLanguage, breakpoint, ...props } ,
14- { config } ,
15- ) => {
12+ const CallAgencyLeg = ( { leg, breakpoint, ...props } ) => {
1613 const intl = useIntl ( ) ;
14+ const config = useConfigContext ( ) ;
1715 const modeClassName = 'call' ;
1816 const { route } = leg ;
1917 const mobile = breakpoint === 'small' || breakpoint === 'medium' ;
2018 const notification =
2119 config . showRouteDescNotification &&
2220 route . desc ?. length &&
23- config . flex . infoLanguage === currentLanguage // No translations available in the data at the moment
21+ config . flex . infoLanguage === config . language // No translations available in the data at the moment
2422 ? { content : route . desc , link : route . url }
2523 : {
2624 content : intl . formatMessage ( { id : 'call-agency-disclaimer' } ) ,
@@ -67,7 +65,6 @@ CallAgencyLeg.propTypes = {
6765 leg : legShape . isRequired ,
6866 index : PropTypes . number . isRequired ,
6967 showRouteDescNotification : PropTypes . bool ,
70- currentLanguage : PropTypes . string . isRequired ,
7168 breakpoint : PropTypes . string ,
7269} ;
7370
@@ -76,18 +73,5 @@ CallAgencyLeg.defaultProps = {
7673 breakpoint : undefined ,
7774} ;
7875
79- CallAgencyLeg . contextTypes = {
80- config : configShape . isRequired ,
81- } ;
82-
83- const CallAgencyLegWithBreakpoint = withBreakpoint ( CallAgencyLeg ) ;
84-
85- const connectedComponent = connectToStores (
86- CallAgencyLegWithBreakpoint ,
87- [ 'PreferencesStore' ] ,
88- context => ( {
89- currentLanguage : context . getStore ( 'PreferencesStore' ) . getLanguage ( ) ,
90- } ) ,
91- ) ;
92-
93- export { CallAgencyLeg as Component , connectedComponent as default } ;
76+ export { CallAgencyLeg as Component } ;
77+ export default withBreakpoint ( CallAgencyLeg ) ;
0 commit comments