-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathRootPage.tsx
53 lines (51 loc) · 1.69 KB
/
RootPage.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import { appVersion } from 'application/constants/env-variables';
import { Button } from 'components/uikit/buttons/Button';
import React from 'react';
import { Outlet } from 'react-router';
import { DropDownInput } from '../../components/uikit/inputs/dropdown/DropDownInput';
import {
changeLanguage,
getCurrentSupportedLanguage,
} from '../../application/localization/localization';
import { Language, languages } from '../../application/localization/locales';
import { useTranslation } from 'react-i18next';
import { logOut } from 'helpers/auth/auth-interceptor';
import styles from './RootPage.module.scss';
import Logger from 'js-logger';
export const RootPage: React.FC = () => {
const i18n = useTranslation();
return (
<>
<div className={styles.container} data-test-id="main-page-container">
<div className={styles.content}>
<Outlet />
</div>
<div className={styles.bottomNavigation}>
<div>
Version: {appVersion()}, {import.meta.env.TST}
</div>
<div>
<DropDownInput
className={styles.languageSwitcher}
variant={'normal'}
options={languages}
required={true}
value={getCurrentSupportedLanguage(i18n.i18n)}
onValueChanged={(x) => {
changeLanguage(x as Language).catch((e) => Logger.error(e));
}}
/>
</div>
<div className={styles.logOutWrapper}>
<Button
onClick={() => {
logOut().catch((e) => Logger.error(e));
}}
title={'Log Out'}
/>
</div>
</div>
</div>
</>
);
};