Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into update-deps
Browse files Browse the repository at this point in the history
  • Loading branch information
Tristan-WorkGH committed Feb 11, 2025
2 parents 71596b9 + db5654b commit 855047a
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/components/customAGGrid/customAggrid.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import { type Theme } from '@mui/material';
import type { Theme } from '@mui/material';
import type { SystemStyleObject } from '@mui/system';

export const CUSTOM_AGGRID_THEME = 'custom-aggrid-theme';
Expand Down
2 changes: 1 addition & 1 deletion src/components/customAGGrid/customAggrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
*/

import React, { useCallback } from 'react';
import { Box, type SxProps, type Theme, useTheme } from '@mui/material';
import { AgGridReact, AgGridReactProps } from 'ag-grid-react';
import { useIntl } from 'react-intl';
import 'ag-grid-community/styles/ag-grid.css';
import 'ag-grid-community/styles/ag-theme-alpine.css';
import { ColumnResizedEvent, GetLocaleTextParams } from 'ag-grid-community';
import { Box, type SxProps, type Theme, useTheme } from '@mui/material';
import { mergeSx } from '../../utils/styles';
import { CUSTOM_AGGRID_THEME, styles } from './customAggrid.style';

Expand Down
4 changes: 2 additions & 2 deletions src/components/topBar/MessageBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import { type ReactNode, useState } from 'react';
import { ReactNode, useState } from 'react';
import { Box, type Theme } from '@mui/material';
import type { SystemStyleObject } from '@mui/system';
import CloseIcon from '@mui/icons-material/Close';
import WarningAmberIcon from '@mui/icons-material/WarningAmber';
import type { SystemStyleObject } from '@mui/system';

const styles = {
banner: (theme: Theme): SystemStyleObject<Theme> => ({
Expand Down
3 changes: 1 addition & 2 deletions src/components/topBar/TopBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import {
Person as PersonIcon,
WbSunny as WbSunnyIcon,
} from '@mui/icons-material';

import type { User } from 'oidc-client';
import { GridLogo, GridLogoProps } from './GridLogo';
import { AboutDialog, AboutDialogProps } from './AboutDialog';
Expand Down Expand Up @@ -182,7 +181,7 @@ export type TopBarProps = Omit<GridLogoProps, 'onClick'> &
equipmentLabelling?: boolean;
onLanguageClick: (value: GsLang) => void;
language: GsLang;
developerMode: boolean;
developerMode?: boolean;
onDeveloperModeClick?: (value: boolean) => void;
};

Expand Down
47 changes: 30 additions & 17 deletions src/components/topBar/UserSettingsDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,19 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import { SyntheticEvent } from 'react';
import { type ChangeEvent, type SyntheticEvent, useCallback } from 'react';
import { FormattedMessage } from 'react-intl';
import { Alert, Dialog, Switch, Button, DialogActions, DialogContent, DialogTitle, Box, Theme } from '@mui/material';
import {
Alert,
Box,
Button,
Dialog,
DialogActions,
DialogContent,
DialogTitle,
Switch,
type Theme,
} from '@mui/material';

const styles = {
parameterName: (theme: Theme) => ({
Expand All @@ -22,23 +32,26 @@ const styles = {
interface UserSettingsDialogProps {
openDialog: boolean;
onClose: () => void;
developerMode: boolean;
developerMode?: boolean;
onDeveloperModeClick?: (value: boolean) => void;
}

function UserSettingsDialog({ openDialog, onClose, developerMode, onDeveloperModeClick }: UserSettingsDialogProps) {
const handleDeveloperModeClick = (value: boolean) => {
if (onDeveloperModeClick) {
onDeveloperModeClick(value);
}
};
const handleDeveloperModeClick = useCallback(
(event: ChangeEvent<HTMLInputElement>) => onDeveloperModeClick?.(event.target.checked),
[onDeveloperModeClick]
);

const handleClose = (_: SyntheticEvent, reason?: string) => {
if (reason === 'backdropClick') {
return;
}
onClose();
};
// TODO: there is no 2nd argument for button on-click
const handleClose = useCallback(
(_: SyntheticEvent, reason?: string) => {
if (reason === 'backdropClick') {
return;
}
onClose();
},
[onClose]
);

return (
<Dialog fullWidth open={openDialog} onClose={handleClose}>
Expand All @@ -52,9 +65,9 @@ function UserSettingsDialog({ openDialog, onClose, developerMode, onDeveloperMod
</Box>
<Box>
<Switch
checked={developerMode}
onChange={(_event, isChecked) => handleDeveloperModeClick(isChecked)}
value={developerMode}
checked={developerMode ?? false}
disabled={handleDeveloperModeClick === undefined}
onChange={handleDeveloperModeClick}
inputProps={{ 'aria-label': 'developer mode checkbox' }}
/>
</Box>
Expand Down
2 changes: 1 addition & 1 deletion src/components/treeViewFinder/TreeViewFinder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
styled,
Typography,
} from '@mui/material';
import { TreeItem, TreeView, type TreeViewClasses } from '@mui/x-tree-view';
import { TreeItem, TreeView, TreeViewClasses } from '@mui/x-tree-view';
import {
Check as CheckIcon,
ChevronRight as ChevronRightIcon,
Expand Down

0 comments on commit 855047a

Please sign in to comment.