added enter keyboard for devmode

This commit is contained in:
PhilReact 2024-11-10 17:33:01 +02:00
parent 622fa1f98e
commit 89c33fb7bc

View File

@ -123,60 +123,65 @@ export const AppsDevModeHome = ({
</ButtonBase> </ButtonBase>
</AppsContainer> </AppsContainer>
{isShow && ( {isShow && (
<Dialog <Dialog
open={isShow} open={isShow}
aria-labelledby="alert-dialog-title" aria-labelledby="alert-dialog-title"
aria-describedby="alert-dialog-description" aria-describedby="alert-dialog-description"
> onKeyDown={(e) => {
<DialogTitle id="alert-dialog-title"> if (e.key === 'Enter' && domain && port) {
{"Add custom framework"} onOk({ portVal: port, domainVal: domain });
</DialogTitle> }
<DialogContent> }}
<Box >
sx={{ <DialogTitle id="alert-dialog-title">
display: "flex", {"Add custom framework"}
flexDirection: "column", </DialogTitle>
gap: "5px", <DialogContent>
}} <Box
> sx={{
<Label>Domain</Label> display: "flex",
<Input flexDirection: "column",
placeholder="Domain" gap: "5px",
value={domain} }}
onChange={(e) => setDomain(e.target.value)} >
/> <Label>Domain</Label>
</Box> <Input
<Box placeholder="Domain"
sx={{ value={domain}
display: "flex", onChange={(e) => setDomain(e.target.value)}
flexDirection: "column", />
gap: "5px", </Box>
marginTop: '15px' <Box
}} sx={{
> display: "flex",
<Label>Port</Label> flexDirection: "column",
gap: "5px",
<Input marginTop: '15px'
placeholder="Port" }}
value={port} >
onChange={(e) => setPort(e.target.value)} <Label>Port</Label>
/> <Input
</Box> placeholder="Port"
</DialogContent> value={port}
<DialogActions> onChange={(e) => setPort(e.target.value)}
<Button variant="contained" onClick={onCancel}> />
Close </Box>
</Button> </DialogContent>
<Button <DialogActions>
disabled={!domain || !port} <Button variant="contained" onClick={onCancel}>
variant="contained" Close
onClick={()=> onOk({portVal: port, domainVal: domain})} </Button>
autoFocus <Button
> disabled={!domain || !port}
Add variant="contained"
</Button> onClick={() => onOk({ portVal: port, domainVal: domain })}
</DialogActions> autoFocus
</Dialog> >
Add
</Button>
</DialogActions>
</Dialog>
)} )}
</> </>
); );