Skip to content

Commit 6fd8ecc

Browse files
committed
Update digitransit-autosuggest, typescript, i18next, react-i18next and fixed typing
1 parent 679ac24 commit 6fd8ecc

21 files changed

Lines changed: 813 additions & 17006 deletions

package-lock.json

Lines changed: 249 additions & 16458 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"private": true,
1010
"dependencies": {
1111
"@apollo/client": "^3.5.5",
12-
"@digitransit-component/digitransit-component-autosuggest": "2.0.8",
12+
"@digitransit-component/digitransit-component-autosuggest": "6.0.0",
1313
"@habx/apollo-multi-endpoint-link": "^2.5.0",
1414
"@hsl-fi/modal": "^0.3.2",
1515
"@hsl-fi/site-header": "4.5.0",
@@ -27,22 +27,24 @@
2727
"graphql": "^16.8.1",
2828
"graphql-tag": "^2.12.6",
2929
"http-proxy-middleware": "^2.0.7",
30-
"i18next": "^19.9.2",
30+
"i18next": "^22.5.1",
3131
"leaflet": "^1.9.3",
3232
"lodash": "4.17.21",
3333
"lodash-es": "4.17.21",
34-
"luxon": "^1.28.1",
34+
"luxon": "^3.6.1",
3535
"mqtt": "^4.3.7",
3636
"node-fetch": "^3.3.2",
37+
"nth-check": "^2.1.1",
3738
"object-hash": "^2.2.0",
3839
"patch-package": "^6.5.0",
3940
"pbf": "^3.2.1",
4041
"react": "^16.14.0",
42+
"react-animate-height": "^3.2.3",
4143
"react-autosuggest": "^10.0.0",
4244
"react-burger-menu": "^3.0.6",
4345
"react-dom": "^16.14.0",
4446
"react-helmet": "^6.1.0",
45-
"react-i18next": "^11.17.0",
47+
"react-i18next": "^12.3.1",
4648
"react-modal": "^3.11.2",
4749
"react-promise": "^2.1.0",
4850
"react-router-dom": "^5.2.0",
@@ -52,9 +54,7 @@
5254
"sass": "^1.49.9",
5355
"suncalc": "1.8.0",
5456
"url": "^0.11.0",
55-
"uuid": "^8.3.2",
56-
"nth-check": "^2.1.1",
57-
"react-animate-height": "^3.2.3"
57+
"uuid": "^8.3.2"
5858
},
5959
"scripts": {
6060
"start-prod": "cd server && npm start",
@@ -71,8 +71,6 @@
7171
"lint-scss-test": "stylelint src/**/*.{scss,sass} --quiet"
7272
},
7373
"devDependencies": {
74-
"prettier": "^2.3.0",
75-
"husky": "^7.0.0",
7674
"@babel/core": "^7.21.3",
7775
"@graphql-codegen/cli": "^5.0.2",
7876
"@graphql-codegen/typed-document-node": "^2.3.3",
@@ -96,10 +94,12 @@
9694
"eslint-plugin-prettier": "^4.2.1",
9795
"eslint-plugin-react": "^7.30.1",
9896
"eslint-plugin-sonarjs": "^0.14.0",
97+
"husky": "^7.0.0",
9998
"npm-run-all": "^4.1.5",
99+
"prettier": "^2.3.0",
100100
"stylelint": "^16.0.2",
101101
"stylelint-config-standard-scss": "12.0.0",
102-
"typescript": "^3.9.9"
102+
"typescript": "^4.9.5"
103103
},
104104
"jest": {
105105
"moduleNameMapper": {

src/i18n.ts

Lines changed: 515 additions & 509 deletions
Large diffs are not rendered by default.

src/ui/BurgerMenu.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Link } from 'react-router-dom';
44
import Icon from './Icon';
55
import Modal from 'react-modal';
66
import { ConfigContext, UserContext } from '../contexts';
7+
import { SupportedLanguage } from '../i18n';
78

89
if (process.env.NODE_ENV !== 'test') Modal.setAppElement('#root');
910
interface Props {
@@ -23,7 +24,7 @@ const BurgerMenu: FC<Props> = ({ createStatic, isOpen, onClose }) => {
2324
}
2425
};
2526

26-
const languageCodes = ['fi', 'sv', 'en'];
27+
const languageCodes: Array<SupportedLanguage> = ['fi', 'sv', 'en'];
2728

2829
const languageElements = () => {
2930
const retValue = [];

src/ui/CreateViewPage.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { getParams } from '../util/queryUtils';
1111
import Modal from '@hsl-fi/modal';
1212
import { useTranslation } from 'react-i18next';
1313
import { IMonitor } from '../util/Interfaces';
14+
import { SupportedLanguage } from '../i18n';
1415

1516
interface Location {
1617
pathname: string;
@@ -28,7 +29,7 @@ const CreateViewPage = () => {
2829
const [stopCardList, setStopCardList] = useState(
2930
location?.state?.view ? location.state.view.cards : null,
3031
);
31-
const [languages, setLanguages] = useState(['fi']);
32+
const [languages, setLanguages] = useState<SupportedLanguage[]>(['fi']);
3233
const [staticMonitorProperties, setStaticMonitorProperties] = useState(null);
3334
const [loading, setLoading] = useState(true);
3435
const [noMonitorFound, setNoMonitorFound] = useState(false);

src/ui/DisplaySettings.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import cx from 'classnames';
55
import Checkbox from './CheckBox';
66
import { ConfigContext } from '../contexts';
77
import Toggle from './Toggle';
8+
import { SupportedLanguage } from '../i18n';
89

910
interface IProps {
1011
languages: Array<string>;
@@ -27,7 +28,7 @@ const DisplaySettings: FC<IProps> = ({
2728
}) => {
2829
const config = useContext(ConfigContext);
2930
const [t] = useTranslation();
30-
const options = ['fi', 'sv', 'en'];
31+
const options: Array<SupportedLanguage> = ['fi', 'sv', 'en'];
3132
const isChecked = (option: string) => {
3233
return languages.includes(option);
3334
};

src/ui/Dropdown.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ const Dropdown: FC<IProps> = ({
6868
inputId={uuid()}
6969
name={name}
7070
options={options}
71-
placeholder={placeholder ? placeholder : t('dropdownPlaceHolder')}
71+
placeholder={placeholder ? placeholder : '--'}
7272
tabIndex="0"
7373
onChange={handleChange}
7474
/>

src/ui/InputWithEditIcon.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const InputWithEditIcon: FC<IProps> = ({
3636
/>
3737
{!focus && (
3838
<button
39-
aria-label={ariaLabelEdit || t('edit')}
39+
aria-label={ariaLabelEdit || 'edit'}
4040
onClick={() => focusToInput(id)}
4141
>
4242
<Icon img="edit" color={config.colors.primary} />

src/ui/LargeModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { ConfigContext } from '../contexts';
66

77
interface IProps {
88
onRequestClose: () => void;
9-
header: string;
9+
header: 'import-monitor' | 'layoutModalHeader';
1010
isOpen?: boolean;
1111
portalClassName?: string;
1212
ariaHideApp?: boolean;

src/ui/LayoutAndTimeContainer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ const LayoutAndTimeContainer: FC<IProps> = ({
9494
</div>
9595
<LayoutModal
9696
allowInformationDisplay={allowInformationDisplay}
97-
orientation={orientation}
97+
orientation={orientation as 'vertical' | 'horizontal'}
9898
option={layout}
9999
open={open}
100100
onClose={() => setOpen(false)}

0 commit comments

Comments
 (0)