Skip to content

Commit 548e235

Browse files
ui changes around the limit set switch (#3413)
Signed-off-by: Mathieu DEHARBE <[email protected]>
1 parent 319893c commit 548e235

File tree

1 file changed

+40
-28
lines changed

1 file changed

+40
-28
lines changed

src/components/dialogs/limits/limits-pane.tsx

Lines changed: 40 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
66
*/
77

8-
import { Grid } from '@mui/material';
8+
import { Box, Grid } from '@mui/material';
99
import {
1010
CURRENT_LIMITS,
1111
ENABLE_OLG_MODIFICATION,
@@ -24,7 +24,6 @@ import { tabStyles } from 'components/utils/tab-utils';
2424
import IconButton from '@mui/material/IconButton';
2525
import { CurrentTreeNode } from '../../graph/tree-node.type';
2626
import GridSection from '../commons/grid-section';
27-
import { styles } from '../dialog-utils';
2827
import AddIcon from '@mui/icons-material/ControlPoint';
2928
import { APPLICABILITY } from '../../network/constants';
3029
import { OperationalLimitsGroupFormInfos } from '../network-modifications/line/modification/line-modification-type';
@@ -138,8 +137,31 @@ export function LimitsPane({
138137
return (
139138
<>
140139
{/* active limit sets */}
141-
<GridSection title="SelectedOperationalLimitGroups" />
142-
<Grid container item xs={8} columns={10.25} spacing={0}>
140+
<Grid container columns={6} item spacing={1} sx={{ maxWidth: '600px' }}>
141+
<Grid item xs={3}>
142+
<GridSection title="SelectedOperationalLimitGroups" />
143+
</Grid>
144+
<Grid
145+
item
146+
xs={3}
147+
sx={{
148+
display: 'flex',
149+
alignItems: 'center',
150+
}}
151+
>
152+
{/* if the user wants to switch off the modification a modal asks him to confirm */}
153+
{isAModification && (
154+
<InputWithPopupConfirmation
155+
Input={SwitchInput}
156+
name={`${id}.${ENABLE_OLG_MODIFICATION}`}
157+
label={olgEditable ? 'Edit' : 'View'}
158+
shouldOpenPopup={() => olgEditable}
159+
resetOnConfirmation={handlePopupConfirmation}
160+
message="disableOLGedition"
161+
validateButtonLabel="validate"
162+
/>
163+
)}
164+
</Grid>
143165
<Grid item xs={3}>
144166
<SelectedOperationalLimitGroup
145167
selectedFormName={`${id}.${SELECTED_LIMITS_GROUP_1}`}
@@ -160,34 +182,24 @@ export function LimitsPane({
160182
isABranchModif={!!equipmentToModify}
161183
/>
162184
</Grid>
163-
<Grid item xs={3}>
164-
{/* if the user wants to switch off the modification a modal asks him to confirm */}
165-
{isAModification && (
166-
<InputWithPopupConfirmation
167-
Input={SwitchInput}
168-
name={`${id}.${ENABLE_OLG_MODIFICATION}`}
169-
label={olgEditable ? 'Edit' : 'View'}
170-
shouldOpenPopup={() => olgEditable}
171-
resetOnConfirmation={handlePopupConfirmation}
172-
message="disableOLGedition"
173-
validateButtonLabel="button.changeType"
174-
/>
175-
)}
176-
</Grid>
177185
</Grid>
178186

179187
{/* limits */}
180-
<Grid container item xs={4.9} display="flex" flexDirection="row">
181-
<Grid container item xs={3}>
182-
<GridSection title="LimitSets" />
183-
</Grid>
184-
<Grid container item xs={0.5}>
185-
<IconButton color="primary" sx={styles.button} onClick={onAddClick} disabled={!olgEditable}>
186-
<AddIcon />
187-
</IconButton>
188-
</Grid>
189-
</Grid>
190188
<Grid container item xs={12} columns={10.25}>
189+
<Grid item xs={4}>
190+
<Box
191+
sx={{
192+
display: 'flex',
193+
justifyContent: 'space-between',
194+
}}
195+
>
196+
<GridSection title="LimitSets" />
197+
<IconButton color="primary" onClick={onAddClick} disabled={!olgEditable}>
198+
<AddIcon />
199+
</IconButton>
200+
</Box>
201+
</Grid>
202+
<Grid container item xs={6.25} />
191203
<Grid item xs={4}>
192204
<OperationalLimitsGroupsTabs
193205
ref={myRef}

0 commit comments

Comments
 (0)