@gridsuite/commons-ui 0.80.0 → 0.82.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/assets/ExpertFilterForm.css +8 -1
  2. package/dist/components/authentication/AuthenticationRouterErrorDisplay.js +1 -0
  3. package/dist/components/authentication/utils/authService.d.ts +6 -1
  4. package/dist/components/authentication/utils/userManagerMock.d.ts +18 -17
  5. package/dist/components/authentication/utils/userManagerMock.js +80 -92
  6. package/dist/components/cardErrorBoundary/CardErrorBoundary.d.ts +6 -9
  7. package/dist/components/cardErrorBoundary/CardErrorBoundary.js +1 -3
  8. package/dist/components/filter/expert/expertFilterConstants.js +2 -2
  9. package/dist/components/flatParameters/FlatParameters.js +13 -14
  10. package/dist/components/inputs/reactHookForm/DirectoryItemsInput.js +1 -1
  11. package/dist/components/inputs/reactHookForm/agGridTable/cellEditors/numericEditor.d.ts +6 -7
  12. package/dist/components/inputs/reactHookForm/agGridTable/cellEditors/numericEditor.js +7 -13
  13. package/dist/components/inputs/reactHookForm/selectInputs/MuiSelectInput.d.ts +1 -1
  14. package/dist/components/inputs/reactHookForm/selectInputs/MuiSelectInput.js +7 -1
  15. package/dist/components/inputs/reactQueryBuilder/CombinatorSelector.js +4 -2
  16. package/dist/components/inputs/reactQueryBuilder/FieldSelector.js +3 -1
  17. package/dist/components/inputs/reactQueryBuilder/PropertyValueEditor.js +18 -6
  18. package/dist/components/inputs/reactQueryBuilder/TextValueEditor.js +14 -2
  19. package/dist/components/inputs/reactQueryBuilder/ValueSelector.js +3 -1
  20. package/dist/components/topBar/MessageBanner.d.ts +7 -0
  21. package/dist/components/topBar/MessageBanner.js +55 -0
  22. package/dist/components/topBar/TopBar.d.ts +3 -2
  23. package/dist/components/topBar/TopBar.js +325 -312
  24. package/dist/components/topBar/UserSettingsDialog.d.ts +8 -0
  25. package/dist/components/topBar/UserSettingsDialog.js +48 -0
  26. package/dist/hooks/index.d.ts +1 -0
  27. package/dist/hooks/index.js +2 -0
  28. package/dist/hooks/useCustomFilterOptions.d.ts +6 -0
  29. package/dist/hooks/useCustomFilterOptions.js +20 -0
  30. package/dist/hooks/useSelectAppearance.d.ts +29 -0
  31. package/dist/hooks/useSelectAppearance.js +22 -0
  32. package/dist/index.js +4 -1
  33. package/dist/module-localized-countries.d.js +1 -0
  34. package/dist/translations/en/filterEn.d.ts +2 -2
  35. package/dist/translations/en/filterEn.js +5 -5
  36. package/dist/translations/en/filterExpertEn.d.ts +1 -0
  37. package/dist/translations/en/filterExpertEn.js +3 -2
  38. package/dist/translations/en/topBarEn.d.ts +7 -2
  39. package/dist/translations/en/topBarEn.js +8 -3
  40. package/dist/translations/fr/filterExpertFr.d.ts +1 -0
  41. package/dist/translations/fr/filterExpertFr.js +3 -2
  42. package/dist/translations/fr/filterFr.d.ts +2 -2
  43. package/dist/translations/fr/filterFr.js +5 -5
  44. package/dist/translations/fr/topBarFr.d.ts +6 -1
  45. package/dist/translations/fr/topBarFr.js +7 -2
  46. package/dist/utils/index.js +2 -1
  47. package/dist/utils/mapper/getFileIcon.js +0 -1
  48. package/dist/utils/types/elementType.d.ts +0 -1
  49. package/dist/utils/types/elementType.js +0 -1
  50. package/dist/utils/types/equipmentType.d.ts +4 -0
  51. package/dist/utils/types/equipmentType.js +6 -0
  52. package/dist/utils/types/index.js +2 -1
  53. package/dist/utils/types/metadata.d.ts +0 -2
  54. package/package.json +1 -2
@@ -2,13 +2,15 @@ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useState, useMemo } from "react";
3
3
  import { FormattedMessage } from "react-intl";
4
4
  import { Menu, MenuItem, ListItemIcon, AppBar, Toolbar, Box, IconButton, ListItemText, Button, Popper, Paper, ClickAwayListener, MenuList, Typography, ToggleButtonGroup, ToggleButton, darken } from "@mui/material";
5
- import { Apps, ArrowDropUp, ArrowDropDown, Person, WbSunny, Brightness3, Computer, Settings, ManageAccounts, HelpOutline, ExitToApp } from "@mui/icons-material";
5
+ import { Apps, ArrowDropUp, ArrowDropDown, Person, Badge, ManageAccounts, HelpOutline, WbSunny, Brightness3, Computer, ExitToApp } from "@mui/icons-material";
6
6
  import { styled } from "@mui/system";
7
7
  import { GridLogo } from "./GridLogo.js";
8
8
  import { AboutDialog } from "./AboutDialog.js";
9
9
  import { useStateBoolean } from "../../hooks/customStates/useStateBoolean.js";
10
10
  import UserInformationDialog from "./UserInformationDialog.js";
11
+ import UserSettingsDialog from "./UserSettingsDialog.js";
11
12
  import { LIGHT_THEME, DARK_THEME, LANG_SYSTEM, LANG_ENGLISH, LANG_FRENCH } from "../../utils/constants/browserConstants.js";
13
+ import MessageBanner from "./MessageBanner.js";
12
14
  const styles = {
13
15
  grow: {
14
16
  flexGrow: 1,
@@ -102,8 +104,13 @@ const CustomListItemIcon = styled(ListItemIcon)({
102
104
  paddingRight: "15px",
103
105
  borderRadius: "25px"
104
106
  });
105
- const EN = "EN";
106
- const FR = "FR";
107
+ function abbreviationFromUserName(name) {
108
+ const tab = name.split(" ").map((x) => x.charAt(0));
109
+ if (tab.length === 1) {
110
+ return tab[0];
111
+ }
112
+ return tab[0] + tab[tab.length - 1];
113
+ }
107
114
  function TopBar({
108
115
  appName,
109
116
  appColor,
@@ -111,7 +118,6 @@ function TopBar({
111
118
  appVersion,
112
119
  appLicense,
113
120
  logoAboutDialog,
114
- onParametersClick,
115
121
  onLogoutClick,
116
122
  onLogoClick,
117
123
  user,
@@ -122,6 +128,8 @@ function TopBar({
122
128
  additionalModulesPromise,
123
129
  onThemeClick,
124
130
  theme,
131
+ developerMode,
132
+ onDeveloperModeClick,
125
133
  onEquipmentLabellingClick,
126
134
  equipmentLabelling,
127
135
  onLanguageClick,
@@ -134,6 +142,11 @@ function TopBar({
134
142
  setFalse: closeUserInformationDialog,
135
143
  setTrue: openUserInformationDialog
136
144
  } = useStateBoolean(false);
145
+ const {
146
+ value: userSettingsDialogOpen,
147
+ setFalse: closeUserSettingsDialog,
148
+ setTrue: openUserSettingsDialog
149
+ } = useStateBoolean(false);
137
150
  const handleToggleSettingsMenu = (event) => {
138
151
  setAnchorElSettingsMenu(event.currentTarget);
139
152
  };
@@ -146,19 +159,6 @@ function TopBar({
146
159
  const handleCloseAppsMenu = () => {
147
160
  setAnchorElAppsMenu(null);
148
161
  };
149
- const onParametersClicked = () => {
150
- setAnchorElSettingsMenu(null);
151
- if (onParametersClick) {
152
- onParametersClick();
153
- }
154
- };
155
- const abbreviationFromUserName = (name) => {
156
- const tab = name.split(" ").map((x) => x.charAt(0));
157
- if (tab.length === 1) {
158
- return tab[0];
159
- }
160
- return tab[0] + tab[tab.length - 1];
161
- };
162
162
  const changeTheme = (_, value) => {
163
163
  if (onThemeClick && value !== null) {
164
164
  onThemeClick(value);
@@ -176,7 +176,7 @@ function TopBar({
176
176
  };
177
177
  const [isAboutDialogOpen, setAboutDialogOpen] = useState(false);
178
178
  const onAboutClicked = () => {
179
- setAnchorElSettingsMenu(false);
179
+ setAnchorElSettingsMenu(null);
180
180
  if (onAboutClick) {
181
181
  onAboutClick();
182
182
  } else {
@@ -194,317 +194,330 @@ function TopBar({
194
194
  setAnchorElSettingsMenu(null);
195
195
  openUserInformationDialog();
196
196
  };
197
+ const onUserSettingsDialogClicked = () => {
198
+ setAnchorElSettingsMenu(null);
199
+ openUserSettingsDialog();
200
+ };
197
201
  const logoClickable = useMemo(
198
202
  () => /* @__PURE__ */ jsx(GridLogo, { onClick: onLogoClick, appLogo, appName, appColor }),
199
203
  [onLogoClick, appLogo, appName, appColor]
200
204
  );
201
205
  return (
202
- // @ts-ignore appBar style is not defined
203
- /* @__PURE__ */ jsx(AppBar, { position: "static", color: "default", sx: styles.appBar, children: /* @__PURE__ */ jsxs(Toolbar, { children: [
204
- logoClickable,
205
- /* @__PURE__ */ jsx(Box, { sx: styles.grow, children }),
206
- user && /* @__PURE__ */ jsxs(Box, { children: [
206
+ // @ts-expect-error appBar style is not defined
207
+ /* @__PURE__ */ jsxs(AppBar, { position: "static", color: "default", sx: styles.appBar, children: [
208
+ user && developerMode && /* @__PURE__ */ jsx(MessageBanner, { children: /* @__PURE__ */ jsx(FormattedMessage, { id: "top-bar/developerModeWarning", defaultMessage: "Developer mode" }) }),
209
+ /* @__PURE__ */ jsxs(Toolbar, { children: [
210
+ logoClickable,
211
+ /* @__PURE__ */ jsx(Box, { sx: styles.grow, children }),
212
+ user && /* @__PURE__ */ jsxs(Box, { children: [
213
+ /* @__PURE__ */ jsx(
214
+ IconButton,
215
+ {
216
+ "aria-label": "apps",
217
+ "aria-controls": "apps-menu",
218
+ "aria-haspopup": "true",
219
+ onClick: handleClickAppsMenu,
220
+ color: "inherit",
221
+ children: /* @__PURE__ */ jsx(Apps, {})
222
+ }
223
+ ),
224
+ /* @__PURE__ */ jsx(
225
+ StyledMenu,
226
+ {
227
+ id: "apps-menu",
228
+ anchorEl: anchorElAppsMenu,
229
+ keepMounted: true,
230
+ open: Boolean(anchorElAppsMenu),
231
+ onClose: handleCloseAppsMenu,
232
+ children: appsAndUrls && appsAndUrls.filter((item) => !item.hiddenInAppsMenu).map((item) => {
233
+ var _a;
234
+ return /* @__PURE__ */ jsx(
235
+ Box,
236
+ {
237
+ component: "a",
238
+ href: (_a = item.url) == null ? void 0 : _a.toString(),
239
+ sx: styles.link,
240
+ target: "_blank",
241
+ rel: "noopener noreferrer",
242
+ children: /* @__PURE__ */ jsx(StyledMenuItem, { onClick: handleCloseAppsMenu, children: /* @__PURE__ */ jsxs(ListItemText, { children: [
243
+ /* @__PURE__ */ jsx(
244
+ "span",
245
+ {
246
+ style: {
247
+ fontWeight: "bold"
248
+ },
249
+ children: "Grid"
250
+ }
251
+ ),
252
+ /* @__PURE__ */ jsx(
253
+ "span",
254
+ {
255
+ style: {
256
+ color: item.appColor === void 0 ? "grey" : item.appColor,
257
+ fontWeight: "bold"
258
+ },
259
+ children: item.name
260
+ }
261
+ )
262
+ ] }) })
263
+ },
264
+ item.name
265
+ );
266
+ })
267
+ }
268
+ )
269
+ ] }),
270
+ user && /* @__PURE__ */ jsxs(Box, { sx: styles.menuContainer, children: [
271
+ /* @__PURE__ */ jsxs(
272
+ Button,
273
+ {
274
+ "aria-controls": "settings-menu",
275
+ "aria-haspopup": "true",
276
+ sx: styles.showHideMenu,
277
+ onClick: handleToggleSettingsMenu,
278
+ color: "inherit",
279
+ style: anchorElSettingsMenu ? { cursor: "initial" } : { cursor: "pointer" },
280
+ children: [
281
+ /* @__PURE__ */ jsx(Box, { component: "span", sx: styles.name, children: user.profile.name !== void 0 ? abbreviationFromUserName(user.profile.name) : "" }),
282
+ anchorElSettingsMenu ? /* @__PURE__ */ jsx(ArrowDropUp, { sx: styles.arrowIcon }) : /* @__PURE__ */ jsx(ArrowDropDown, { sx: styles.arrowIcon })
283
+ ]
284
+ }
285
+ ),
286
+ /* @__PURE__ */ jsx(
287
+ Popper,
288
+ {
289
+ sx: styles.settingsMenu,
290
+ open: Boolean(anchorElSettingsMenu),
291
+ anchorEl: anchorElSettingsMenu,
292
+ children: /* @__PURE__ */ jsx(Paper, { children: /* @__PURE__ */ jsx(ClickAwayListener, { onClickAway: handleCloseSettingsMenu, children: /* @__PURE__ */ jsxs(MenuList, { id: "settings-menu", children: [
293
+ /* @__PURE__ */ jsxs(StyledMenuItem, { sx: styles.borderBottom, disabled: true, style: { opacity: "1" }, children: [
294
+ /* @__PURE__ */ jsx(CustomListItemIcon, { children: /* @__PURE__ */ jsx(Person, { fontSize: "small" }) }),
295
+ /* @__PURE__ */ jsx(ListItemText, { children: user !== null && /* @__PURE__ */ jsxs(Box, { component: "span", sx: styles.sizeLabel, children: [
296
+ user.profile.name,
297
+ " ",
298
+ /* @__PURE__ */ jsx("br", {}),
299
+ /* @__PURE__ */ jsx(Box, { component: "span", sx: styles.userMail, children: user.profile.email })
300
+ ] }) })
301
+ ] }),
302
+ !isHiddenUserInformation() && /* @__PURE__ */ jsxs(
303
+ StyledMenuItem,
304
+ {
305
+ style: { opacity: "1" },
306
+ onClick: onUserInformationDialogClicked,
307
+ children: [
308
+ /* @__PURE__ */ jsx(CustomListItemIcon, { children: /* @__PURE__ */ jsx(Badge, { fontSize: "small" }) }),
309
+ /* @__PURE__ */ jsx(ListItemText, { children: /* @__PURE__ */ jsx(Typography, { sx: styles.sizeLabel, children: /* @__PURE__ */ jsx(
310
+ FormattedMessage,
311
+ {
312
+ id: "top-bar/userInformation",
313
+ defaultMessage: "User information"
314
+ }
315
+ ) }) })
316
+ ]
317
+ }
318
+ ),
319
+ /* @__PURE__ */ jsxs(StyledMenuItem, { onClick: onUserSettingsDialogClicked, sx: styles.borderBottom, children: [
320
+ /* @__PURE__ */ jsx(CustomListItemIcon, { children: /* @__PURE__ */ jsx(ManageAccounts, { fontSize: "small" }) }),
321
+ /* @__PURE__ */ jsx(ListItemText, { children: /* @__PURE__ */ jsx(Typography, { sx: styles.sizeLabel, children: /* @__PURE__ */ jsx(
322
+ FormattedMessage,
323
+ {
324
+ id: "top-bar/userSettings",
325
+ defaultMessage: "Settings"
326
+ }
327
+ ) }) })
328
+ ] }),
329
+ /* @__PURE__ */ jsxs(
330
+ StyledMenuItem,
331
+ {
332
+ sx: styles.borderBottom,
333
+ style: { opacity: "1" },
334
+ onClick: onAboutClicked,
335
+ children: [
336
+ /* @__PURE__ */ jsx(CustomListItemIcon, { children: /* @__PURE__ */ jsx(HelpOutline, { fontSize: "small" }) }),
337
+ /* @__PURE__ */ jsx(ListItemText, { children: /* @__PURE__ */ jsx(Typography, { sx: styles.sizeLabel, children: /* @__PURE__ */ jsx(FormattedMessage, { id: "top-bar/about", defaultMessage: "About" }) }) })
338
+ ]
339
+ }
340
+ ),
341
+ /* @__PURE__ */ jsxs(
342
+ StyledMenuItem,
343
+ {
344
+ disabled: true,
345
+ style: {
346
+ opacity: "1",
347
+ paddingTop: "10px",
348
+ paddingBottom: "10px",
349
+ backgroundColor: "transparent"
350
+ },
351
+ children: [
352
+ /* @__PURE__ */ jsx(ListItemText, { children: /* @__PURE__ */ jsx(Typography, { sx: styles.sizeLabel, children: /* @__PURE__ */ jsx(
353
+ FormattedMessage,
354
+ {
355
+ id: "top-bar/displayMode",
356
+ defaultMessage: "Display mode"
357
+ }
358
+ ) }) }),
359
+ /* @__PURE__ */ jsxs(
360
+ ToggleButtonGroup,
361
+ {
362
+ exclusive: true,
363
+ value: theme,
364
+ size: "large",
365
+ sx: styles.toggleButtonGroup,
366
+ onChange: changeTheme,
367
+ children: [
368
+ /* @__PURE__ */ jsx(
369
+ ToggleButton,
370
+ {
371
+ value: LIGHT_THEME,
372
+ "aria-label": LIGHT_THEME,
373
+ sx: styles.toggleButton,
374
+ children: /* @__PURE__ */ jsx(WbSunny, { fontSize: "small" })
375
+ }
376
+ ),
377
+ /* @__PURE__ */ jsx(
378
+ ToggleButton,
379
+ {
380
+ value: DARK_THEME,
381
+ "aria-label": DARK_THEME,
382
+ sx: styles.toggleButton,
383
+ children: /* @__PURE__ */ jsx(Brightness3, { fontSize: "small" })
384
+ }
385
+ )
386
+ ]
387
+ }
388
+ )
389
+ ]
390
+ }
391
+ ),
392
+ onEquipmentLabellingClick && /* @__PURE__ */ jsxs(
393
+ StyledMenuItem,
394
+ {
395
+ disabled: true,
396
+ style: {
397
+ opacity: "1",
398
+ // padding: '0',
399
+ paddingTop: "10px",
400
+ paddingBottom: "10px",
401
+ backgroundColor: "transparent"
402
+ },
403
+ children: [
404
+ /* @__PURE__ */ jsx(ListItemText, { children: /* @__PURE__ */ jsx(Typography, { sx: styles.sizeLabel, children: /* @__PURE__ */ jsx(
405
+ FormattedMessage,
406
+ {
407
+ id: "top-bar/equipmentLabel",
408
+ defaultMessage: "Equipment label"
409
+ }
410
+ ) }) }),
411
+ /* @__PURE__ */ jsxs(
412
+ ToggleButtonGroup,
413
+ {
414
+ exclusive: true,
415
+ value: equipmentLabelling,
416
+ sx: styles.toggleButtonGroup,
417
+ onChange: changeEquipmentLabelling,
418
+ children: [
419
+ /* @__PURE__ */ jsx(ToggleButton, { value: false, sx: styles.toggleButton, children: /* @__PURE__ */ jsx(FormattedMessage, { id: "top-bar/id", defaultMessage: "Id" }) }),
420
+ /* @__PURE__ */ jsx(ToggleButton, { value: true, sx: styles.toggleButton, children: /* @__PURE__ */ jsx(FormattedMessage, { id: "top-bar/name", defaultMessage: "Name" }) })
421
+ ]
422
+ }
423
+ )
424
+ ]
425
+ }
426
+ ),
427
+ /* @__PURE__ */ jsxs(
428
+ StyledMenuItem,
429
+ {
430
+ disabled: true,
431
+ sx: styles.borderBottom,
432
+ style: {
433
+ opacity: "1",
434
+ paddingTop: "10px",
435
+ paddingBottom: "10px",
436
+ backgroundColor: "transparent"
437
+ },
438
+ children: [
439
+ /* @__PURE__ */ jsx(ListItemText, { children: /* @__PURE__ */ jsx(Typography, { sx: styles.sizeLabel, children: /* @__PURE__ */ jsx(FormattedMessage, { id: "top-bar/language", defaultMessage: "Language" }) }) }),
440
+ /* @__PURE__ */ jsxs(
441
+ ToggleButtonGroup,
442
+ {
443
+ exclusive: true,
444
+ value: language,
445
+ sx: styles.toggleButtonGroup,
446
+ onChange: changeLanguage,
447
+ children: [
448
+ /* @__PURE__ */ jsx(
449
+ ToggleButton,
450
+ {
451
+ value: LANG_SYSTEM,
452
+ "aria-label": LANG_SYSTEM,
453
+ sx: styles.languageToggleButton,
454
+ children: /* @__PURE__ */ jsx(Computer, {})
455
+ }
456
+ ),
457
+ /* @__PURE__ */ jsx(
458
+ ToggleButton,
459
+ {
460
+ value: LANG_ENGLISH,
461
+ "aria-label": LANG_ENGLISH,
462
+ sx: styles.languageToggleButton,
463
+ children: "EN"
464
+ }
465
+ ),
466
+ /* @__PURE__ */ jsx(
467
+ ToggleButton,
468
+ {
469
+ value: LANG_FRENCH,
470
+ "aria-label": LANG_FRENCH,
471
+ sx: styles.toggleButton,
472
+ children: "FR"
473
+ }
474
+ )
475
+ ]
476
+ }
477
+ )
478
+ ]
479
+ }
480
+ ),
481
+ /* @__PURE__ */ jsxs(StyledMenuItem, { onClick: onLogoutClick, children: [
482
+ /* @__PURE__ */ jsx(CustomListItemIcon, { children: /* @__PURE__ */ jsx(ExitToApp, { fontSize: "small" }) }),
483
+ /* @__PURE__ */ jsx(ListItemText, { children: /* @__PURE__ */ jsx(Typography, { sx: styles.sizeLabel, children: /* @__PURE__ */ jsx(FormattedMessage, { id: "top-bar/logout", defaultMessage: "Logout" }) }) })
484
+ ] })
485
+ ] }) }) })
486
+ }
487
+ )
488
+ ] }),
207
489
  /* @__PURE__ */ jsx(
208
- IconButton,
490
+ UserInformationDialog,
209
491
  {
210
- "aria-label": "apps",
211
- "aria-controls": "apps-menu",
212
- "aria-haspopup": "true",
213
- onClick: handleClickAppsMenu,
214
- color: "inherit",
215
- children: /* @__PURE__ */ jsx(Apps, {})
492
+ openDialog: userInformationDialogOpen && !!user,
493
+ user,
494
+ onClose: closeUserInformationDialog
216
495
  }
217
496
  ),
218
497
  /* @__PURE__ */ jsx(
219
- StyledMenu,
498
+ UserSettingsDialog,
220
499
  {
221
- id: "apps-menu",
222
- anchorEl: anchorElAppsMenu,
223
- keepMounted: true,
224
- open: Boolean(anchorElAppsMenu),
225
- onClose: handleCloseAppsMenu,
226
- children: appsAndUrls && appsAndUrls.filter((item) => !item.hiddenInAppsMenu).map((item) => {
227
- var _a;
228
- return /* @__PURE__ */ jsx(
229
- Box,
230
- {
231
- component: "a",
232
- href: (_a = item.url) == null ? void 0 : _a.toString(),
233
- sx: styles.link,
234
- target: "_blank",
235
- rel: "noopener noreferrer",
236
- children: /* @__PURE__ */ jsx(StyledMenuItem, { onClick: handleCloseAppsMenu, children: /* @__PURE__ */ jsxs(ListItemText, { children: [
237
- /* @__PURE__ */ jsx(
238
- "span",
239
- {
240
- style: {
241
- fontWeight: "bold"
242
- },
243
- children: "Grid"
244
- }
245
- ),
246
- /* @__PURE__ */ jsx(
247
- "span",
248
- {
249
- style: {
250
- color: item.appColor === void 0 ? "grey" : item.appColor,
251
- fontWeight: "bold"
252
- },
253
- children: item.name
254
- }
255
- )
256
- ] }) })
257
- },
258
- item.name
259
- );
260
- })
261
- }
262
- )
263
- ] }),
264
- user && /* @__PURE__ */ jsxs(Box, { sx: styles.menuContainer, children: [
265
- /* @__PURE__ */ jsxs(
266
- Button,
267
- {
268
- "aria-controls": "settings-menu",
269
- "aria-haspopup": "true",
270
- sx: styles.showHideMenu,
271
- onClick: handleToggleSettingsMenu,
272
- color: "inherit",
273
- style: anchorElSettingsMenu ? { cursor: "initial" } : { cursor: "pointer" },
274
- children: [
275
- /* @__PURE__ */ jsx(Box, { component: "span", sx: styles.name, children: user !== null ? abbreviationFromUserName(
276
- // @ts-ignore name could be undefined, how to handle this case ?
277
- user.profile.name
278
- ) : "" }),
279
- anchorElSettingsMenu ? /* @__PURE__ */ jsx(ArrowDropUp, { sx: styles.arrowIcon }) : /* @__PURE__ */ jsx(ArrowDropDown, { sx: styles.arrowIcon })
280
- ]
500
+ openDialog: userSettingsDialogOpen && !!user,
501
+ onClose: closeUserSettingsDialog,
502
+ developerMode,
503
+ onDeveloperModeClick
281
504
  }
282
505
  ),
283
506
  /* @__PURE__ */ jsx(
284
- Popper,
507
+ AboutDialog,
285
508
  {
286
- sx: styles.settingsMenu,
287
- open: Boolean(anchorElSettingsMenu),
288
- anchorEl: anchorElSettingsMenu,
289
- children: /* @__PURE__ */ jsx(Paper, { children: /* @__PURE__ */ jsx(ClickAwayListener, { onClickAway: handleCloseSettingsMenu, children: /* @__PURE__ */ jsxs(MenuList, { id: "settings-menu", children: [
290
- /* @__PURE__ */ jsxs(StyledMenuItem, { sx: styles.borderBottom, disabled: true, style: { opacity: "1" }, children: [
291
- /* @__PURE__ */ jsx(CustomListItemIcon, { children: /* @__PURE__ */ jsx(Person, { fontSize: "small" }) }),
292
- /* @__PURE__ */ jsx(ListItemText, { children: user !== null && /* @__PURE__ */ jsxs(Box, { component: "span", sx: styles.sizeLabel, children: [
293
- user.profile.name,
294
- " ",
295
- /* @__PURE__ */ jsx("br", {}),
296
- /* @__PURE__ */ jsx(Box, { component: "span", sx: styles.userMail, children: user.profile.email })
297
- ] }) })
298
- ] }),
299
- /* @__PURE__ */ jsxs(
300
- StyledMenuItem,
301
- {
302
- disabled: true,
303
- style: {
304
- opacity: "1",
305
- paddingTop: "10px",
306
- paddingBottom: "10px",
307
- backgroundColor: "transparent"
308
- },
309
- children: [
310
- /* @__PURE__ */ jsx(ListItemText, { children: /* @__PURE__ */ jsx(Typography, { sx: styles.sizeLabel, children: /* @__PURE__ */ jsx(
311
- FormattedMessage,
312
- {
313
- id: "top-bar/displayMode",
314
- defaultMessage: "Display mode"
315
- }
316
- ) }) }),
317
- /* @__PURE__ */ jsxs(
318
- ToggleButtonGroup,
319
- {
320
- exclusive: true,
321
- value: theme,
322
- size: "large",
323
- sx: styles.toggleButtonGroup,
324
- onChange: changeTheme,
325
- children: [
326
- /* @__PURE__ */ jsx(
327
- ToggleButton,
328
- {
329
- value: LIGHT_THEME,
330
- "aria-label": LIGHT_THEME,
331
- sx: styles.toggleButton,
332
- children: /* @__PURE__ */ jsx(WbSunny, { fontSize: "small" })
333
- }
334
- ),
335
- /* @__PURE__ */ jsx(
336
- ToggleButton,
337
- {
338
- value: DARK_THEME,
339
- "aria-label": DARK_THEME,
340
- sx: styles.toggleButton,
341
- children: /* @__PURE__ */ jsx(Brightness3, { fontSize: "small" })
342
- }
343
- )
344
- ]
345
- }
346
- )
347
- ]
348
- }
349
- ),
350
- onEquipmentLabellingClick && /* @__PURE__ */ jsxs(
351
- StyledMenuItem,
352
- {
353
- disabled: true,
354
- style: {
355
- opacity: "1",
356
- // padding: '0',
357
- paddingTop: "10px",
358
- paddingBottom: "10px",
359
- backgroundColor: "transparent"
360
- },
361
- children: [
362
- /* @__PURE__ */ jsx(ListItemText, { children: /* @__PURE__ */ jsx(Typography, { sx: styles.sizeLabel, children: /* @__PURE__ */ jsx(
363
- FormattedMessage,
364
- {
365
- id: "top-bar/equipmentLabel",
366
- defaultMessage: "Equipment label"
367
- }
368
- ) }) }),
369
- /* @__PURE__ */ jsxs(
370
- ToggleButtonGroup,
371
- {
372
- exclusive: true,
373
- value: equipmentLabelling,
374
- sx: styles.toggleButtonGroup,
375
- onChange: changeEquipmentLabelling,
376
- children: [
377
- /* @__PURE__ */ jsx(ToggleButton, { value: false, sx: styles.toggleButton, children: /* @__PURE__ */ jsx(FormattedMessage, { id: "top-bar/id", defaultMessage: "Id" }) }),
378
- /* @__PURE__ */ jsx(ToggleButton, { value: true, sx: styles.toggleButton, children: /* @__PURE__ */ jsx(FormattedMessage, { id: "top-bar/name", defaultMessage: "Name" }) })
379
- ]
380
- }
381
- )
382
- ]
383
- }
384
- ),
385
- /* @__PURE__ */ jsxs(
386
- StyledMenuItem,
387
- {
388
- disabled: true,
389
- style: {
390
- opacity: "1",
391
- paddingTop: "10px",
392
- paddingBottom: "10px",
393
- backgroundColor: "transparent"
394
- },
395
- children: [
396
- /* @__PURE__ */ jsx(ListItemText, { children: /* @__PURE__ */ jsx(Typography, { sx: styles.sizeLabel, children: /* @__PURE__ */ jsx(FormattedMessage, { id: "top-bar/language", defaultMessage: "Language" }) }) }),
397
- /* @__PURE__ */ jsxs(
398
- ToggleButtonGroup,
399
- {
400
- exclusive: true,
401
- value: language,
402
- sx: styles.toggleButtonGroup,
403
- onChange: changeLanguage,
404
- children: [
405
- /* @__PURE__ */ jsx(
406
- ToggleButton,
407
- {
408
- value: LANG_SYSTEM,
409
- "aria-label": LANG_SYSTEM,
410
- sx: styles.languageToggleButton,
411
- children: /* @__PURE__ */ jsx(Computer, {})
412
- }
413
- ),
414
- /* @__PURE__ */ jsx(
415
- ToggleButton,
416
- {
417
- value: LANG_ENGLISH,
418
- "aria-label": LANG_ENGLISH,
419
- sx: styles.languageToggleButton,
420
- children: EN
421
- }
422
- ),
423
- /* @__PURE__ */ jsx(
424
- ToggleButton,
425
- {
426
- value: LANG_FRENCH,
427
- "aria-label": LANG_FRENCH,
428
- sx: styles.toggleButton,
429
- children: FR
430
- }
431
- )
432
- ]
433
- }
434
- )
435
- ]
436
- }
437
- ),
438
- onParametersClick && /* @__PURE__ */ jsxs(StyledMenuItem, { onClick: onParametersClicked, sx: styles.borderTop, children: [
439
- /* @__PURE__ */ jsx(CustomListItemIcon, { children: /* @__PURE__ */ jsx(Settings, { fontSize: "small" }) }),
440
- /* @__PURE__ */ jsx(ListItemText, { children: /* @__PURE__ */ jsx(Typography, { sx: styles.sizeLabel, children: /* @__PURE__ */ jsx(
441
- FormattedMessage,
442
- {
443
- id: "top-bar/settings",
444
- defaultMessage: "Settings"
445
- }
446
- ) }) })
447
- ] }),
448
- !isHiddenUserInformation() && /* @__PURE__ */ jsxs(
449
- StyledMenuItem,
450
- {
451
- sx: styles.borderBottom,
452
- style: { opacity: "1" },
453
- onClick: onUserInformationDialogClicked,
454
- children: [
455
- /* @__PURE__ */ jsx(CustomListItemIcon, { children: /* @__PURE__ */ jsx(ManageAccounts, { fontSize: "small" }) }),
456
- /* @__PURE__ */ jsx(ListItemText, { children: /* @__PURE__ */ jsx(Typography, { sx: styles.sizeLabel, children: /* @__PURE__ */ jsx(
457
- FormattedMessage,
458
- {
459
- id: "top-bar/userInformation",
460
- defaultMessage: "User information"
461
- }
462
- ) }) })
463
- ]
464
- }
465
- ),
466
- /* @__PURE__ */ jsxs(
467
- StyledMenuItem,
468
- {
469
- sx: styles.borderBottom,
470
- style: { opacity: "1" },
471
- onClick: onAboutClicked,
472
- children: [
473
- /* @__PURE__ */ jsx(CustomListItemIcon, { children: /* @__PURE__ */ jsx(HelpOutline, { fontSize: "small" }) }),
474
- /* @__PURE__ */ jsx(ListItemText, { children: /* @__PURE__ */ jsx(Typography, { sx: styles.sizeLabel, children: /* @__PURE__ */ jsx(FormattedMessage, { id: "top-bar/about", defaultMessage: "About" }) }) })
475
- ]
476
- }
477
- ),
478
- /* @__PURE__ */ jsxs(StyledMenuItem, { onClick: onLogoutClick, children: [
479
- /* @__PURE__ */ jsx(CustomListItemIcon, { children: /* @__PURE__ */ jsx(ExitToApp, { fontSize: "small" }) }),
480
- /* @__PURE__ */ jsx(ListItemText, { children: /* @__PURE__ */ jsx(Typography, { sx: styles.sizeLabel, children: /* @__PURE__ */ jsx(FormattedMessage, { id: "top-bar/logout", defaultMessage: "Logout" }) }) })
481
- ] })
482
- ] }) }) })
509
+ open: isAboutDialogOpen && !!user,
510
+ onClose: () => setAboutDialogOpen(false),
511
+ appName,
512
+ appVersion,
513
+ appLicense,
514
+ globalVersionPromise,
515
+ additionalModulesPromise,
516
+ logo: logoAboutDialog
483
517
  }
484
518
  )
485
- ] }),
486
- userInformationDialogOpen && /* @__PURE__ */ jsx(
487
- UserInformationDialog,
488
- {
489
- openDialog: userInformationDialogOpen,
490
- user,
491
- onClose: closeUserInformationDialog
492
- }
493
- ),
494
- /* @__PURE__ */ jsx(
495
- AboutDialog,
496
- {
497
- open: isAboutDialogOpen && !!user,
498
- onClose: () => setAboutDialogOpen(false),
499
- appName,
500
- appVersion,
501
- appLicense,
502
- globalVersionPromise,
503
- additionalModulesPromise,
504
- logo: logoAboutDialog
505
- }
506
- )
507
- ] }) })
519
+ ] })
520
+ ] })
508
521
  );
509
522
  }
510
523
  export {