5
5
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
6
*/
7
7
8
- import {
9
- forwardRef ,
10
- FunctionComponent ,
11
- ReactElement ,
12
- useCallback ,
13
- useEffect ,
14
- useMemo ,
15
- useState ,
16
- } from 'react' ;
8
+ import { forwardRef , FunctionComponent , ReactElement , useCallback , useEffect , useMemo , useState } from 'react' ;
17
9
import { capitalize , Tab , Tabs , useTheme } from '@mui/material' ;
18
10
import { ManageAccounts , PeopleAlt } from '@mui/icons-material' ;
19
- import {
20
- AppMetadataCommon ,
21
- logout ,
22
- PARAM_LANGUAGE ,
23
- PARAM_THEME ,
24
- TopBar ,
25
- } from '@gridsuite/commons-ui' ;
11
+ import { AppMetadataCommon , logout , PARAM_LANGUAGE , PARAM_THEME , TopBar } from '@gridsuite/commons-ui' ;
26
12
import { useParameterState } from '../parameters' ;
27
13
import { APP_NAME } from '../../utils/config-params' ;
28
14
import { NavLink , useMatches , useNavigate } from 'react-router-dom' ;
@@ -71,9 +57,7 @@ const AppTopBar: FunctionComponent = () => {
71
57
const theme = useTheme ( ) ;
72
58
const dispatch = useDispatch < AppDispatch > ( ) ;
73
59
const user = useSelector ( ( state : AppState ) => state . user ?? null ) ;
74
- const userManagerInstance = useSelector (
75
- ( state : AppState ) => state . userManager ?. instance
76
- ) ;
60
+ const userManagerInstance = useSelector ( ( state : AppState ) => state . userManager ?. instance ) ;
77
61
78
62
const navigate = useNavigate ( ) ;
79
63
const matches = useMatches ( ) ;
@@ -87,8 +71,7 @@ const AppTopBar: FunctionComponent = () => {
87
71
} , [ matches ] ) ;
88
72
89
73
const [ themeLocal , handleChangeTheme ] = useParameterState ( PARAM_THEME ) ;
90
- const [ languageLocal , handleChangeLanguage ] =
91
- useParameterState ( PARAM_LANGUAGE ) ;
74
+ const [ languageLocal , handleChangeLanguage ] = useParameterState ( PARAM_LANGUAGE ) ;
92
75
93
76
const [ appsAndUrls , setAppsAndUrls ] = useState < AppMetadataCommon [ ] > ( [ ] ) ;
94
77
useEffect ( ( ) => {
@@ -98,33 +81,20 @@ const AppTopBar: FunctionComponent = () => {
98
81
} ) ;
99
82
}
100
83
} , [ user ] ) ;
101
- const additionalModulesFetcher = useCallback (
102
- ( ) => studySrv . getServersInfos ( APP_NAME ) ,
103
- [ ]
104
- ) ;
84
+ const additionalModulesFetcher = useCallback ( ( ) => studySrv . getServersInfos ( APP_NAME ) , [ ] ) ;
105
85
106
86
return (
107
87
< TopBar
108
88
appName = { capitalize ( APP_NAME ) }
109
89
appColor = "#FD3745"
110
- appLogo = {
111
- theme . palette . mode === 'light' ? (
112
- < GridAdminLogoLight />
113
- ) : (
114
- < GridAdminLogoDark />
115
- )
116
- }
90
+ appLogo = { theme . palette . mode === 'light' ? < GridAdminLogoLight /> : < GridAdminLogoDark /> }
117
91
appVersion = { AppPackage . version }
118
92
appLicense = { AppPackage . license }
119
93
onLogoutClick = { ( ) => logout ( dispatch , userManagerInstance ) }
120
94
onLogoClick = { ( ) => navigate ( '/' , { replace : true } ) }
121
95
user = { user ?? undefined }
122
96
appsAndUrls = { appsAndUrls }
123
- globalVersionPromise = { ( ) =>
124
- appsMetadataSrv
125
- . fetchVersion ( )
126
- . then ( ( res ) => res ?. deployVersion ?? 'unknown' )
127
- }
97
+ globalVersionPromise = { ( ) => appsMetadataSrv . fetchVersion ( ) . then ( ( res ) => res ?. deployVersion ?? 'unknown' ) }
128
98
additionalModulesPromise = { additionalModulesFetcher }
129
99
onThemeClick = { handleChangeTheme }
130
100
theme = { themeLocal }
0 commit comments