Skip to content

Commit 6935bd9

Browse files
authored
Merge pull request #5762 from HSLdevcom/misc-fixes-april
Miscellaneous minor fixes
2 parents f3d1c3f + 5154d85 commit 6935bd9

18 files changed

Lines changed: 62 additions & 116 deletions

File tree

app/component/LangSelect.js

Lines changed: 17 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
import PropTypes from 'prop-types';
21
import React from 'react';
3-
import { matchShape, routerShape } from 'found';
2+
import PropTypes from 'prop-types';
3+
import { matchShape } from 'found';
44
import { useIntl } from 'react-intl';
5-
import connectToStores from 'fluxible-addons-react/connectToStores';
6-
import { configShape } from '../util/shapes';
5+
import { useConfigContext } from '../configurations/ConfigContext';
6+
7+
const Language = ({ lang }, { match }) => {
8+
const { language } = useConfigContext();
9+
const intl = useIntl();
10+
const highlight = lang === language;
711

8-
const language = (lang, highlight, match, intl) => {
912
const aria = highlight
1013
? intl.formatMessage(
1114
{ id: 'search-current-suggestion' },
@@ -25,36 +28,18 @@ const language = (lang, highlight, match, intl) => {
2528
);
2629
};
2730

28-
const LangSelect = ({ currentLanguage }, { config, match }) => {
29-
const intl = useIntl();
31+
Language.contextTypes = { match: matchShape.isRequired };
32+
Language.propTypes = { lang: PropTypes.string.isRequired };
33+
34+
const LanguageSelect = ({}, { match }) => { // eslint-disable-line
35+
const { availableLanguages } = useConfigContext();
3036
return (
3137
<div key="lang-select" id="lang-select">
32-
{config.availableLanguages.map(lang =>
33-
language(lang, lang === currentLanguage, match, intl),
34-
)}
38+
{availableLanguages.map(lang => (
39+
<Language key={lang} lang={lang} />
40+
))}
3541
</div>
3642
);
3743
};
3844

39-
LangSelect.displayName = 'LangSelect';
40-
41-
LangSelect.propTypes = {
42-
currentLanguage: PropTypes.string.isRequired,
43-
};
44-
45-
LangSelect.contextTypes = {
46-
executeAction: PropTypes.func.isRequired,
47-
config: configShape.isRequired,
48-
router: routerShape.isRequired,
49-
match: matchShape.isRequired,
50-
};
51-
52-
const connected = connectToStores(
53-
LangSelect,
54-
['PreferencesStore'],
55-
context => ({
56-
currentLanguage: context.getStore('PreferencesStore').getLanguage(),
57-
}),
58-
);
59-
60-
export { connected as default, LangSelect as Component };
45+
export default LanguageSelect;

app/configurations/config.default.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -213,19 +213,8 @@ export default {
213213
// if you enable car suggestions but the linear distance between all points is less than this, then a car route will
214214
// not be computed
215215
suggestCarMinDistance: 2000,
216-
availableLanguages: [
217-
'fi',
218-
'sv',
219-
'en',
220-
'fr',
221-
'nb',
222-
'de',
223-
'da',
224-
'es',
225-
'ro',
226-
'pl',
227-
],
228-
defaultLanguage: 'en',
216+
availableLanguages: ['fi', 'sv', 'en'],
217+
defaultLanguage: 'fi',
229218
timeZone: 'Europe/Helsinki',
230219
allowLogin: false,
231220
allowFavouritesFromLocalstorage: true,

app/configurations/config.hsl.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,9 @@ export default {
9191

9292
title: 'Reittiopas',
9393

94-
availableLanguages: ['fi', 'sv', 'en'],
9594
availableTickets: {
9695
Sipoo: true,
9796
},
98-
defaultLanguage: 'fi',
9997
passLanguageToRootLink: true,
10098

10199
favicon: './app/configurations/images/hsl/hsl-favicon.png',

app/configurations/config.kela.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,6 @@ export default {
9393
countrySelection: [],
9494
},
9595

96-
availableLanguages: ['fi', 'sv', 'en'],
97-
defaultLanguage: 'fi',
98-
9996
socialMedia: {
10097
title: APP_TITLE,
10198
description: APP_DESCRIPTION,

app/configurations/config.matka.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ export default {
3333
countrySelection: ['estonia'],
3434
},
3535

36-
availableLanguages: ['fi', 'sv', 'en'],
37-
defaultLanguage: 'fi',
38-
3936
socialMedia: {
4037
title: APP_TITLE,
4138
description: APP_DESCRIPTION,

app/configurations/config.waltti.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@ export default {
5656
description: APP_DESCRIPTION,
5757
},
5858

59-
availableLanguages: ['fi', 'sv', 'en'],
60-
defaultLanguage: 'fi',
61-
6259
vehicles: true,
6360
showVehiclesOnStopPage: true,
6461
showVehiclesOnItineraryPage: true,

app/translations/en.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,7 @@ export default {
525525
'Please note that you need to use the app of the operator in question in order to use and pay for the taxis or scooters.',
526526
'payment-info-taxi':
527527
'Please note that you need to use the app of the operator in question in order to use and pay for the taxis.',
528+
'personal-itineraries': 'Personal itineraries',
528529
personalisation: 'Personalisation',
529530
'personalisation-beta':
530531
'Personalization is still in the testing phase, meaning we are trying out the service. We would love to hear about your experience. The survey will open in a new tab.',

app/translations/fi.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,7 @@ export default {
513513
'Huomaathan, että potkulautojen ja taksin käyttö ja maksaminen tapahtuu toimijoiden omilla sovelluksilla.',
514514
'payment-info-taxi':
515515
'Huomaathan, että taksien ja kyytipalveluiden käyttö ja maksaminen tapahtuu toimijoiden omilla sovelluksilla.',
516+
'personal-itineraries': 'Yksilölliset reittiehdotukset',
516517
personalisation: 'Personointi',
517518
'personalisation-beta':
518519
'Personointi on vielä testausvaiheessa, eli kokeilemme palvelua. Haluaisimme kuulla kokemuksestasi. Kysely avautuu uuteen välilehteen.',

app/translations/sv.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,7 @@ export default {
519519
'Vänligen observera att användning och betalning av elsparkcyklar och taxi görs via operatörernas egna appar.',
520520
'payment-info-taxi':
521521
'Vänligen observera att användning och betalning av taxi görs via operatörernas egna appar.',
522+
'personal-itineraries': 'Individuella ruttförslag',
522523
personalisation: 'Personalisering',
523524
'personalisation-beta':
524525
'Personaliseringen är fortfarande i testfasen, vilket innebär att vi testar tjänsten. Vi vill gärna höra om din upplevelse. Undersökningen öppnas i en ny flik.',

digitransit-component/packages/digitransit-component-autosuggest-panel/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@digitransit-component/digitransit-component-autosuggest-panel",
3-
"version": "8.3.0",
3+
"version": "8.3.1",
44
"description": "digitransit-component autosuggest-panel module",
55
"main": "index.js",
66
"files": [
@@ -28,7 +28,7 @@
2828
"author": "Digitransit Authors",
2929
"license": "(AGPL-3.0 OR EUPL-1.2)",
3030
"peerDependencies": {
31-
"@digitransit-component/digitransit-component-autosuggest": "^7.1.5",
31+
"@digitransit-component/digitransit-component-autosuggest": "^7.1.6",
3232
"@digitransit-component/digitransit-component-icon": "^2.0.1",
3333
"@hsl-fi/sass": "1.0.0",
3434
"classnames": "2.5.1",

0 commit comments

Comments
 (0)