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
4 changes: 3 additions & 1 deletion src/components/App/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@ import {
getPreLoginPath,
initializeAuthenticationProd,
NotificationsUrlKeys,
PARAM_LANGUAGE,
PARAM_THEME,
useNotificationsListener,
UserManagerState,
useSnackMessage,
} from '@gridsuite/commons-ui';
import { selectComputedLanguage, selectLanguage, selectTheme } from '../../redux/actions';
import { AppState } from '../../redux/reducer';
import { AppsMetadataSrv, ConfigParameters } from '../../services';
import { APP_NAME, COMMON_APP_NAME, PARAM_LANGUAGE, PARAM_THEME } from '../../utils/config-params';
import { APP_NAME, COMMON_APP_NAME } from '../../utils/config-params';
import AppTopBar from './AppTopBar';
import { useDebugRender } from '../../utils/hooks';
import { AppDispatch } from '../../redux/store';
Expand Down
12 changes: 10 additions & 2 deletions src/components/App/AppTopBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,17 @@
import { type AnchorHTMLAttributes, forwardRef, type ReactElement, SyntheticEvent, useEffect, useState } from 'react';
import { capitalize, Tab, Tabs, TabsProps, useTheme } from '@mui/material';
import { Groups, ManageAccounts, NotificationImportant, PeopleAlt } from '@mui/icons-material';
import { fetchAppsMetadata, logout, Metadata, TopBar, UserManagerState } from '@gridsuite/commons-ui';
import {
fetchAppsMetadata,
logout,
Metadata,
PARAM_LANGUAGE,
PARAM_THEME,
TopBar,
UserManagerState,
} from '@gridsuite/commons-ui';
import { useParameterState } from '../parameters';
import { APP_NAME, PARAM_LANGUAGE, PARAM_THEME } from '../../utils/config-params';
import { APP_NAME } from '../../utils/config-params';
import { NavLink, type To, useNavigate } from 'react-router';
import { useDispatch, useSelector } from 'react-redux';
import { FormattedMessage } from 'react-intl';
Expand Down
2 changes: 1 addition & 1 deletion src/components/App/AppWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ import {
topBarFr,
errorsEn,
errorsFr,
PARAM_THEME,
} from '@gridsuite/commons-ui';
import { type IntlConfig, IntlProvider } from 'react-intl';
import { Provider, useSelector } from 'react-redux';
import messages_en from '../../translations/en.json';
import messages_fr from '../../translations/fr.json';
import { store } from '../../redux/store';
import { PARAM_THEME } from '../../utils/config-params';
import { AppState } from '../../redux/reducer';
import { useNotificationsUrlGenerator } from '../../utils/notifications-provider';
import { AllCommunityModule, ModuleRegistry, provideGlobalGridOptions } from 'ag-grid-community';
Expand Down
4 changes: 2 additions & 2 deletions src/pages/common/use-csv-export.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { useMemo, RefObject } from 'react';
import { CsvExport, GsLang } from '@gridsuite/commons-ui';
import { CsvExport, GsLangUser } from '@gridsuite/commons-ui';
import { IntlShape } from 'react-intl';
import { GridTableRef } from '../../components/Grid';
import { ColDef } from 'ag-grid-community';
Expand All @@ -22,7 +22,7 @@ export function useCsvExport<TData>({
columns: ColDef[];
tableNameId: string;
intl: IntlShape;
language: GsLang;
language: GsLangUser;
}) {
return useMemo(
() => (
Expand Down
3 changes: 1 addition & 2 deletions src/redux/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { GsTheme, UserManagerState } from '@gridsuite/commons-ui';
import { PARAM_LANGUAGE } from '../utils/config-params';
import { GsTheme, PARAM_LANGUAGE, UserManagerState } from '@gridsuite/commons-ui';
import { Action } from 'redux';
import type { AppState } from './reducer';

Expand Down
3 changes: 2 additions & 1 deletion src/redux/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ import {
GsTheme,
LOGOUT_ERROR,
LogoutErrorAction,
PARAM_LANGUAGE,
PARAM_THEME,
RESET_AUTHENTICATION_ROUTER_ERROR,
SHOW_AUTH_INFO_LOGIN,
ShowAuthenticationRouterLoginAction,
Expand All @@ -47,7 +49,6 @@ import {
UserManagerState,
UserValidationErrorAction,
} from '@gridsuite/commons-ui';
import { PARAM_LANGUAGE, PARAM_THEME } from '../utils/config-params';

export type AppState = CommonStoreState & {
computedLanguage: GsLangUser;
Expand Down
3 changes: 1 addition & 2 deletions src/services/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { GsLang, GsTheme } from '@gridsuite/commons-ui';
import { PARAM_LANGUAGE, PARAM_THEME } from '../utils/config-params';
import { GsLang, GsTheme, PARAM_LANGUAGE, PARAM_THEME } from '@gridsuite/commons-ui';

// https://github.com/gridsuite/config-server/blob/main/src/main/java/org/gridsuite/config/server/dto/ParameterInfos.java
export type ConfigParameter =
Expand Down
4 changes: 1 addition & 3 deletions src/utils/config-params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@
*/

import type { LiteralUnion } from 'type-fest';
import { PARAM_LANGUAGE, PARAM_THEME } from '@gridsuite/commons-ui';

export const COMMON_APP_NAME = 'common';
export const APP_NAME = 'admin';

export const PARAM_THEME = 'theme';
export const PARAM_LANGUAGE = 'language';

const COMMON_CONFIG_PARAMS_NAMES = new Set([PARAM_THEME, PARAM_LANGUAGE]);

export type AppConfigParameter = LiteralUnion<typeof PARAM_THEME | typeof PARAM_LANGUAGE, string>;
Expand Down
Loading