Skip to content

Commit ea3f7f8

Browse files
authored
Update commons-ui to v0.51 #20
Also use the types provided by the lib and clean the deprecated code
2 parents 8496741 + 77cd954 commit ea3f7f8

File tree

8 files changed

+14
-21
lines changed

8 files changed

+14
-21
lines changed

package-lock.json

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

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"dependencies": {
1717
"@emotion/react": "^11.8.2",
1818
"@emotion/styled": "^11.8.1",
19-
"@gridsuite/commons-ui": "0.50.1",
19+
"@gridsuite/commons-ui": "0.51.0",
2020
"@hookform/resolvers": "^3.3.1",
2121
"@mui/icons-material": "^5.5.1",
2222
"@mui/lab": "^5.0.0-alpha.75",
@@ -32,6 +32,7 @@
3232
"ag-grid-react": "^31.1.1",
3333
"core-js": "^3.6.4",
3434
"notistack": "^3.0.0",
35+
"oidc-client": "^1.10.1",
3536
"prop-types": "^15.7.2",
3637
"react": "^18.0.0",
3738
"react-dom": "^18.0.0",

src/components/App/app.test.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import {
1414
ThemeProvider,
1515
} from '@mui/material/styles';
1616
import { SnackbarProvider } from '@gridsuite/commons-ui';
17-
import { UserManagerMock } from '@gridsuite/commons-ui/es/utils/UserManagerMock';
1817
import { CssBaseline } from '@mui/material';
1918
import { appRoutes } from '../../routes';
2019

src/module-commons-ui.d.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/redux/reducer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export type AppState = {
4949
[PARAM_LANGUAGE]: LanguageParameters;
5050

5151
userManager: UserManagerState;
52-
user: User | null; //TODO use true definition when commons-ui passed to typescript
52+
user: User | null; //TODO delete when migrated into commons-ui
5353
signInCallbackError: unknown;
5454
authenticationRouterError: unknown;
5555
showAuthenticationRouterLogin: boolean;

src/routes/router.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export function appRoutes(): RouteObject[] {
7979
}
8080

8181
const AuthRouter: FunctionComponent<{
82-
userManager: (typeof AuthenticationRouter)['userManager'];
82+
userManager: Parameters<typeof AuthenticationRouter>[0]['userManager'];
8383
}> = (props, context) => {
8484
const signInCallbackError = useSelector(
8585
(state: AppState) => state.signInCallbackError

src/services/study.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { APP_NAME } from '../utils/config-params';
1111

1212
const STUDY_URL = `${getRestBase()}/study/v1`;
1313

14-
//TODO delete when commons-ui will be in typescript
14+
//TODO delete when migrated into commons-ui
1515
export type ServerAbout = {
1616
type?: 'app' | 'server' | 'other';
1717
name?: string;

src/utils/language.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@
77

88
import { LANG_ENGLISH, LANG_FRENCH, LANG_SYSTEM } from '@gridsuite/commons-ui';
99

10-
const supportedLanguages = [LANG_FRENCH, LANG_ENGLISH];
11-
//export type SupportedLanguagesType = typeof supportedLanguages[number]; //TODO when commons-ui in typescript
12-
export type SupportedLanguages = 'en' | 'fr';
13-
//export type LanguageParameters = SupportedLanguages | typeof LANG_SYSTEM; //TODO when commons-ui in typescript
14-
export type LanguageParameters = SupportedLanguages | 'sys';
10+
const supportedLanguages: string[] = [LANG_FRENCH, LANG_ENGLISH];
11+
export type SupportedLanguages = (typeof supportedLanguages)[number];
12+
export type LanguageParameters = SupportedLanguages | typeof LANG_SYSTEM;
1513

1614
export function getSystemLanguage(): SupportedLanguages {
1715
const systemLanguage = navigator.language.split(/[-_]/)[0];
@@ -23,8 +21,5 @@ export function getSystemLanguage(): SupportedLanguages {
2321
export function getComputedLanguage(
2422
language: LanguageParameters
2523
): SupportedLanguages {
26-
return language === LANG_SYSTEM
27-
? getSystemLanguage()
28-
: (language as SupportedLanguages);
29-
//TODO remove cast when commons-ui in typescript
24+
return language === LANG_SYSTEM ? getSystemLanguage() : language;
3025
}

0 commit comments

Comments
 (0)