Skip to content

Commit 089ead2

Browse files
authored
Merge pull request #5802 from HSLdevcom/AB#565
AB#565 stop page fixes
2 parents 0387553 + 5d1453e commit 089ead2

8 files changed

Lines changed: 20 additions & 40 deletions

File tree

app/component/stop/Timetable.js

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@ import sortBy from 'lodash/sortBy';
66
import groupBy from 'lodash/groupBy';
77
import padStart from 'lodash/padStart';
88
import { FormattedMessage, useIntl } from 'react-intl';
9-
import { matchShape, routerShape } from 'found';
109
import { useFragment } from 'react-relay';
11-
import { connectToStores } from 'fluxible-addons-react';
1210
import cx from 'classnames';
13-
import { configShape } from '../../util/shapes';
11+
import { useRouter } from 'found';
1412
import Icon from '../Icon';
1513
import FilterTimeTableModal from './FilterTimeTableModal';
1614
import TimeTableOptionsPanel from './TimeTableOptionsPanel';
@@ -23,6 +21,7 @@ import ScrollableWrapper from '../ScrollableWrapper';
2321
import { replaceQueryParams } from '../../util/queryUtils';
2422
import { PREFIX_STOPS } from '../../util/path';
2523
import { TimetableFragment } from './queries/TimetableFragment';
24+
import { useConfigContext } from '../../configurations/ConfigContext';
2625

2726
const 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 };

app/configurations/config.default.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ export default {
755755
itinerary: false,
756756
},
757757

758-
viaPointsEnabled: false,
758+
viaPointsEnabled: true,
759759
viaPointsMax: 1,
760760

761761
// Toggling this off shows the alert bodytext instead of the header

app/configurations/config.hsl.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -818,5 +818,4 @@ export default {
818818

819819
showRouteDescNotification: IS_DEV,
820820
personalization: false,
821-
viaPointsEnabled: true,
822821
};

app/configurations/config.matka.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,5 +474,4 @@ export default {
474474

475475
showStopStatusMarkers: true,
476476
showRouteDescNotification: IS_DEV,
477-
viaPointsEnabled: true,
478477
};

app/configurations/config.varely.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ export default configMerger(walttiConfig, {
122122

123123
/* Enable real-time map layer for vehicle positions */
124124
vehicles: false,
125-
viaPointsEnabled: false,
126125

127126
aboutThisService: {
128127
fi: [

app/configurations/config.waltti.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,6 @@ export default {
286286
},
287287
analyticsClass: 'plausible-event-name=Ticket+Purchase+Link',
288288

289-
viaPointsEnabled: false,
290289
hideNaviTickets: true, // TODO: temporary force switch
291290
navigation: true,
292291

sass/base/_base.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ body {
5555
font-family: $font-family;
5656
font-weight: $font-weight-medium;
5757
letter-spacing: $letter-spacing;
58+
width: 100%;
5859
height: 100%;
5960
margin: 0;
6061
color: $black !important;
@@ -68,6 +69,7 @@ body {
6869
}
6970

7071
#app {
72+
width: 100%;
7173
height: 100%;
7274
display: flex;
7375
flex-direction: column;

test/unit/component/Timetable.test.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { expect } from 'chai';
22
import { describe, it } from 'mocha';
33
import React from 'react';
44
import { mockContext } from '../helpers/mock-context';
5-
import { Component as Timetable } from '../../../app/component/stop/Timetable';
5+
import Timetable from '../../../app/component/stop/Timetable';
66
import TimetableRow from '../../../app/component/stop/TimetableRow';
77
import SecondaryButton from '../../../app/component/SecondaryButton';
88
import { shallowWithIntl } from '../helpers/mock-intl-enzyme';
@@ -70,13 +70,11 @@ describe('<Timetable />', () => {
7070
it('should set valid stopPDFURL for StopPageActionBar', () => {
7171
const baseTimetableURL = 'https://timetabletest.com/stops/';
7272
const wrapper = shallowWithIntl(<Timetable {...props} />, {
73-
context: {
74-
...mockContext,
75-
config: {
76-
CONFIG: 'default',
77-
URL: { STOP_TIMETABLES: { HSL: baseTimetableURL } },
78-
timetables: { HSL: timetables.default.HSL },
79-
},
73+
context: { ...mockContext },
74+
config: {
75+
CONFIG: 'default',
76+
URL: { STOP_TIMETABLES: { HSL: baseTimetableURL } },
77+
timetables: { HSL: timetables.default.HSL },
8078
},
8179
});
8280
expect(wrapper.find(SecondaryButton)).to.have.lengthOf(2);

0 commit comments

Comments
 (0)