Skip to content

Commit

Permalink
update printWidth to 120
Browse files Browse the repository at this point in the history
refresh from main

Signed-off-by: Tristan Chuine <[email protected]>
  • Loading branch information
Tristan-WorkGH committed Aug 5, 2024
1 parent 1499dd4 commit 41b2d29
Show file tree
Hide file tree
Showing 56 changed files with 480 additions and 1,458 deletions.
1 change: 1 addition & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"trailingComma": "es5",
"tabWidth": 4,
"printWidth": 120,
"singleQuote": true
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Selectors are the functions called by the Containers to retrieve the data needed
derived data should be obtained from a selector.

A selector has for argument the state of the slice. It is possible to add other arguments to selector by using
`React.useMemo` and `RTK.createSelector` to customise the fetched data. `RTK.createSelector can also be used to combine
`React.useMemo` and `RTK.createSelector` to customise the fetched data. `RTK.createSelector can also be used to combine
reducers to create a more complex one.

_There is no inherent reason to not have Selectors fetching data from separate slices, however, in most cases, it is
Expand Down Expand Up @@ -107,7 +107,7 @@ To check dependencies license compatibility with this project one locally, pleas
npm run licenses-check
```

Notes :
Notes :
* Check [license-checker-config.json](license-checker-config.json) for license white list and exclusion.
If you need to update this list, please inform organization's owners.
* Excluded dependencies :
Expand Down
2 changes: 1 addition & 1 deletion license-checker-config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"onlyAllow" : [
"onlyAllow": [
"MPL-2.0",
"MIT",
"BSD-3-Clause",
Expand Down
4 changes: 1 addition & 3 deletions src/__mocks__/svgrMock.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@

import React from 'react';

const SvgrMock = React.forwardRef((props, ref) => (
<span ref={ref} {...props} />
));
const SvgrMock = React.forwardRef((props, ref) => <span ref={ref} {...props} />);

export const ReactComponent = SvgrMock;
export default SvgrMock;
33 changes: 6 additions & 27 deletions src/components/1-atoms/Autocomplete.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@

import React, { useCallback, useEffect, useMemo, useState } from 'react';
import PropTypes from 'prop-types';
import {
Autocomplete as MuiAutocomplete,
Popper,
TextField,
} from '@mui/material';
import { Autocomplete as MuiAutocomplete, Popper, TextField } from '@mui/material';
import { styles } from './AutocompleteStyles';

const PRECISION = 10e-8;
Expand Down Expand Up @@ -62,9 +58,7 @@ const Autocomplete = (props) => {
},
[options, value, isMultiple, matchMultipleOptions]
);
const [inputValue, setInputValue] = useState(
isMultiple ? '' : value?.toString() ?? ''
);
const [inputValue, setInputValue] = useState(isMultiple ? '' : value?.toString() ?? '');

const sxStyles = styles({
inputLength: fixedWidth ? undefined : inputValue.length,
Expand Down Expand Up @@ -163,31 +157,16 @@ const Autocomplete = (props) => {
autoHighlight={!isFree}
renderOption={renderOption}
sx={sxStyles.inputWidth}
renderInput={(params) => (
<TextField {...params} label={label} error={error} />
)}
isOptionEqualToValue={(option, value) =>
option.value === value.value
}
PopperComponent={(props) => (
<Popper
{...props}
placement="bottom-start"
style={{ width: 'fit-content' }}
/>
)}
renderInput={(params) => <TextField {...params} label={label} error={error} />}
isOptionEqualToValue={(option, value) => option.value === value.value}
PopperComponent={(props) => <Popper {...props} placement="bottom-start" style={{ width: 'fit-content' }} />}
{...rest}
/>
);
};

Autocomplete.propTypes = {
value: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
PropTypes.bool,
PropTypes.array,
]).isRequired,
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool, PropTypes.array]).isRequired,
isFree: PropTypes.bool,
isMultiple: PropTypes.bool,
onChange: PropTypes.func,
Expand Down
4 changes: 1 addition & 3 deletions src/components/1-atoms/AutocompleteStyles.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ const MINIMUM_WIDTH = '150px';
export const styles = ({ inputLength }) => ({
inputWidth: {
minWidth: MINIMUM_WIDTH,
width: inputLength
? `calc(${inputLength} * ${FONT_SIZE} * 16px)`
: 'auto',
width: inputLength ? `calc(${inputLength} * ${FONT_SIZE} * 16px)` : 'auto',
},
});
8 changes: 1 addition & 7 deletions src/components/1-atoms/buttons/NewButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,7 @@ import AddRoundedIcon from '@mui/icons-material/AddRounded';

const NewButton = ({ onClick, sx, disabled, tooltip }) => (
<Tooltip title={tooltip}>
<Button
variant="outlined"
onClick={onClick}
endIcon={<AddRoundedIcon />}
sx={sx}
disabled={disabled}
>
<Button variant="outlined" onClick={onClick} endIcon={<AddRoundedIcon />} sx={sx} disabled={disabled}>
New
</Button>
</Tooltip>
Expand Down
58 changes: 18 additions & 40 deletions src/components/1-atoms/buttons/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,43 +19,21 @@ import DoneIcon from '@mui/icons-material/Done';
import DoneAllIcon from '@mui/icons-material/DoneAll';
import SaveAsIcon from '@mui/icons-material/SaveAs';

export const AddIconButton = (props) => (
<IconButton icon={<AddCircleIcon />} {...props} />
);

export const ConvertButton = (props) => (
<IconButton icon={<PublishOutlinedIcon />} {...props} />
);

export const SaveButton = (props) => (
<IconButton icon={<SaveOutlinedIcon />} {...props} />
);

export const DeleteButton = (props) => (
<IconButton icon={<DeleteIcon />} {...props} />
);

export const CopyButton = (props) => (
<IconButton icon={<FileCopyIcon />} {...props} />
);

export const AttachButton = (props) => (
<IconButton icon={<AttachFileIcon />} {...props} />
);

export const ChangeButton = (props) => (
<IconButton icon={<LoopIcon />} {...props} />
);

export const ResetButton = (props) => (
<IconButton icon={<RestartAltIcon />} {...props} />
);
export const ApplyOneButton = (props) => (
<IconButton icon={<DoneIcon />} {...props} />
);
export const ApplyAllButton = (props) => (
<IconButton icon={<DoneAllIcon />} {...props} />
);
export const EditButton = (props) => (
<IconButton icon={<SaveAsIcon />} {...props} />
);
export const AddIconButton = (props) => <IconButton icon={<AddCircleIcon />} {...props} />;

export const ConvertButton = (props) => <IconButton icon={<PublishOutlinedIcon />} {...props} />;

export const SaveButton = (props) => <IconButton icon={<SaveOutlinedIcon />} {...props} />;

export const DeleteButton = (props) => <IconButton icon={<DeleteIcon />} {...props} />;

export const CopyButton = (props) => <IconButton icon={<FileCopyIcon />} {...props} />;

export const AttachButton = (props) => <IconButton icon={<AttachFileIcon />} {...props} />;

export const ChangeButton = (props) => <IconButton icon={<LoopIcon />} {...props} />;

export const ResetButton = (props) => <IconButton icon={<RestartAltIcon />} {...props} />;
export const ApplyOneButton = (props) => <IconButton icon={<DoneIcon />} {...props} />;
export const ApplyAllButton = (props) => <IconButton icon={<DoneAllIcon />} {...props} />;
export const EditButton = (props) => <IconButton icon={<SaveAsIcon />} {...props} />;
16 changes: 3 additions & 13 deletions src/components/2-molecules/AttachDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,7 @@ const AttachDialog = (props) => {
};

return (
<Dialog
open={open}
onClose={closeDialog}
aria-labelledby="form-dialog-title"
>
<Dialog open={open} onClose={closeDialog} aria-labelledby="form-dialog-title">
<DialogTitle id="form-dialog-title">Attach a Network</DialogTitle>
<Divider />
<DialogContent>
Expand Down Expand Up @@ -83,16 +79,10 @@ const AttachDialog = (props) => {
)}
{attachWithFile && (
<Box>
<Typography>
Attach a new network using the iidm:
</Typography>
<Typography>Attach a new network using the iidm:</Typography>
<Grid container sx={styles.margins}>
<Grid item xs={10}>
<input
type="file"
name="file"
onChange={(e) => onChangeFile(e)}
/>
<input type="file" name="file" onChange={(e) => onChangeFile(e)} />
</Grid>
<Grid item xs={2}>
<Button
Expand Down
23 changes: 5 additions & 18 deletions src/components/2-molecules/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ import PropTypes from 'prop-types';
import { styles } from './HeaderStyles';
import { mergeSx } from 'utils/functions';

const outdatedLabel =
'Generated elements are outdated, re-generate them to delete this warning';
const outdatedLabel = 'Generated elements are outdated, re-generate them to delete this warning';

const Header = (props) => {
const {
Expand Down Expand Up @@ -62,24 +61,12 @@ const Header = (props) => {
{`${currentNetwork?.networkName ?? ''}`}
</Typography>
</Grid>
<Grid
item
xs="auto"
sx={mergeSx(styles.gridButton, styles.buttonIcon)}
>
<Grid item xs="auto" sx={mergeSx(styles.gridButton, styles.buttonIcon)}>
{save !== undefined && (
<SaveButton
onClick={save}
tooltip={saveTooltip}
disabled={!isModified || !isValid}
/>
)}
{attach !== undefined && (
<AttachButton onClick={attach} tooltip={attachTooltip} />
)}
{addElement !== undefined && (
<AddIconButton onClick={addElement} tooltip={addTooltip} />
<SaveButton onClick={save} tooltip={saveTooltip} disabled={!isModified || !isValid} />
)}
{attach !== undefined && <AttachButton onClick={attach} tooltip={attachTooltip} />}
{addElement !== undefined && <AddIconButton onClick={addElement} tooltip={addTooltip} />}
</Grid>
</Grid>
);
Expand Down
7 changes: 1 addition & 6 deletions src/components/2-molecules/ModelSelect.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,7 @@ const ModelSelect = (props) => {
<Typography variant="subtitle1">{`${modelLabel} :`}</Typography>
</Grid>
<Grid item xs sx={styles.titleSelect}>
<Select
options={getModelsOptions(models)}
value={model}
setValue={changeModel}
error={model === ''}
/>
<Select options={getModelsOptions(models)} value={model} setValue={changeModel} error={model === ''} />
</Grid>
</Grid>
);
Expand Down
28 changes: 4 additions & 24 deletions src/components/2-molecules/NavigationMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,7 @@

import React, { useState } from 'react';
import PropTypes from 'prop-types';
import {
IconButton,
List,
ListItem,
ListItemSecondaryAction,
ListItemText,
} from '@mui/material';
import { IconButton, List, ListItem, ListItemSecondaryAction, ListItemText } from '@mui/material';
import MoreVertIcon from '@mui/icons-material/MoreVert';

import ContextMenu from './ContextMenu';
Expand Down Expand Up @@ -81,11 +75,7 @@ const NavigationMenu = (props) => {
>
<ListItemText primary={item.name} />
<ListItemSecondaryAction>
<IconButton
edge="end"
id={item.name}
onClick={setMenu}
>
<IconButton edge="end" id={item.name} onClick={setMenu}>
<MoreVertIcon />
</IconButton>
</ListItemSecondaryAction>
Expand All @@ -94,20 +84,10 @@ const NavigationMenu = (props) => {
})}
</List>
{addItem !== undefined && (
<NewButton
onClick={addItem}
sx={styles.new}
disabled={!canAdd}
tooltip={addTooltip}
/>
<NewButton onClick={addItem} sx={styles.new} disabled={!canAdd} tooltip={addTooltip} />
)}
{anchor !== null && (
<ContextMenu
anchorEl={anchor}
open
onClose={closeContextMenu}
options={buildOptions(anchor.id)}
/>
<ContextMenu anchorEl={anchor} open onClose={closeContextMenu} options={buildOptions(anchor.id)} />
)}
{openDialog !== null && (
<RenameDialog
Expand Down
15 changes: 2 additions & 13 deletions src/components/2-molecules/RenameDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,7 @@
*/

import React, { useState } from 'react';
import {
Button,
Dialog,
DialogActions,
DialogContent,
DialogTitle,
TextField,
} from '@mui/material';
import { Button, Dialog, DialogActions, DialogContent, DialogTitle, TextField } from '@mui/material';
import PropTypes from 'prop-types';

const RenameDialog = (props) => {
Expand All @@ -34,11 +27,7 @@ const RenameDialog = (props) => {
handleClose();
};
return (
<Dialog
open={open}
onClose={handleClose}
aria-labelledby="form-dialog-title"
>
<Dialog open={open} onClose={handleClose} aria-labelledby="form-dialog-title">
<DialogTitle id="form-dialog-title">Rename</DialogTitle>
<DialogContent>
<TextField
Expand Down
Loading

0 comments on commit 41b2d29

Please sign in to comment.