Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"dependencies": {
"@emotion/react": "^11.8.2",
"@emotion/styled": "^11.8.1",
"@gridsuite/commons-ui": "0.50.1",
"@gridsuite/commons-ui": "0.51.0",
"@hookform/resolvers": "^3.3.1",
"@mui/icons-material": "^5.5.1",
"@mui/lab": "^5.0.0-alpha.75",
Expand All @@ -32,6 +32,7 @@
"ag-grid-react": "^31.1.1",
"core-js": "^3.6.4",
"notistack": "^3.0.0",
"oidc-client": "^1.10.1",
"prop-types": "^15.7.2",
"react": "^18.0.0",
"react-dom": "^18.0.0",
Expand Down
1 change: 0 additions & 1 deletion src/components/App/app.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
ThemeProvider,
} from '@mui/material/styles';
import { SnackbarProvider } from '@gridsuite/commons-ui';
import { UserManagerMock } from '@gridsuite/commons-ui/es/utils/UserManagerMock';
import { CssBaseline } from '@mui/material';
import { appRoutes } from '../../routes';

Expand Down
3 changes: 0 additions & 3 deletions src/module-commons-ui.d.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/redux/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export type AppState = {
[PARAM_LANGUAGE]: LanguageParameters;

userManager: UserManagerState;
user: User | null; //TODO use true definition when commons-ui passed to typescript
user: User | null; //TODO delete when migrated into commons-ui
signInCallbackError: unknown;
authenticationRouterError: unknown;
showAuthenticationRouterLogin: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/routes/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export function appRoutes(): RouteObject[] {
}

const AuthRouter: FunctionComponent<{
userManager: (typeof AuthenticationRouter)['userManager'];
userManager: Parameters<typeof AuthenticationRouter>[0]['userManager'];
}> = (props, context) => {
const signInCallbackError = useSelector(
(state: AppState) => state.signInCallbackError
Expand Down
2 changes: 1 addition & 1 deletion src/services/study.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { APP_NAME } from '../utils/config-params';

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

//TODO delete when commons-ui will be in typescript
//TODO delete when migrated into commons-ui
export type ServerAbout = {
type?: 'app' | 'server' | 'other';
name?: string;
Expand Down
13 changes: 4 additions & 9 deletions src/utils/language.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@

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

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

export function getSystemLanguage(): SupportedLanguages {
const systemLanguage = navigator.language.split(/[-_]/)[0];
Expand All @@ -23,8 +21,5 @@ export function getSystemLanguage(): SupportedLanguages {
export function getComputedLanguage(
language: LanguageParameters
): SupportedLanguages {
return language === LANG_SYSTEM
? getSystemLanguage()
: (language as SupportedLanguages);
//TODO remove cast when commons-ui in typescript
return language === LANG_SYSTEM ? getSystemLanguage() : language;
}