fix(striker-ui): disable add network when limit(s) reached

main
Tsu-ba-me 2 years ago
parent 7a66b1417c
commit a02e1a76fb
  1. 6
      striker-ui/components/IconButton/IconButton.tsx
  2. 10
      striker-ui/components/NetworkInitForm.tsx

@ -2,11 +2,13 @@ import { FC } from 'react';
import {
IconButton as MUIIconButton,
IconButtonProps as MUIIconButtonProps,
inputClasses as muiInputClasses,
} from '@mui/material';
import {
BLACK,
BORDER_RADIUS,
DISABLED,
GREY,
TEXT,
} from '../../lib/consts/DEFAULT_THEME';
@ -30,6 +32,10 @@ const IconButton: FC<IconButtonProps> = ({
backgroundColor: TEXT,
},
[`&.${muiInputClasses.disabled}`]: {
backgroundColor: DISABLED,
},
...sx,
},
}}

@ -410,7 +410,15 @@ const NetworkInitForm: FC = () => {
justifyContent: 'center',
}}
>
<IconButton onClick={createNetwork}>
<IconButton
disabled={
networkInputs.length >= networkInterfaces.length ||
Object.values(networkInterfaceInputMap).every(
({ isApplied }) => isApplied,
)
}
onClick={createNetwork}
>
<MUIAddIcon />
</IconButton>
</MUIBox>

Loading…
Cancel
Save