Skip to content

Commit

Permalink
wrap the fields inside form element and replace button type to submit…
Browse files Browse the repository at this point in the history
… to handle submit on enter
  • Loading branch information
jomarmontuya committed Feb 5, 2024
1 parent d79731b commit 48d9fd1
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/apps/schema/src/app/components/CreateModelDialogue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@ import {
Checkbox,
ThemeProvider,
} from "@mui/material";
import { useEffect, useReducer, useState, useMemo } from "react";
import {
useEffect,
useReducer,
useState,
useMemo,
useCallback,
useRef,
} from "react";
import CloseRoundedIcon from "@mui/icons-material/CloseRounded";
import MenuBookRoundedIcon from "@mui/icons-material/MenuBookRounded";
import InfoRoundedIcon from "@mui/icons-material/InfoRounded";
Expand All @@ -41,6 +48,7 @@ import { withCursorPosition } from "../../../../../shell/components/withCursorPo
import { formatPathPart } from "../../../../../utility/formatPathPart";
import { AppState } from "../../../../../shell/store/types";
import { SelectModelParentInput } from "./SelectModelParentInput";
import { FormControl } from "@mui/base";

interface Props {
onClose: () => void;
Expand Down Expand Up @@ -274,7 +282,7 @@ export const CreateModelDialogue = ({ onClose, modelType = "" }: Props) => {
);
} else {
return (
<>
<Box component="form">
<DialogTitle component="div">
<Stack
direction="row"
Expand Down Expand Up @@ -424,6 +432,7 @@ export const CreateModelDialogue = ({ onClose, modelType = "" }: Props) => {
Cancel
</Button>
<LoadingButton
type="submit"
variant="contained"
disabled={!model.name || !model.label}
loading={!!isCreatingModel || !!isCreatingContentItem}
Expand All @@ -436,7 +445,7 @@ export const CreateModelDialogue = ({ onClose, modelType = "" }: Props) => {
Create Model
</LoadingButton>
</DialogActions>
</>
</Box>
);
}
};
Expand Down

0 comments on commit 48d9fd1

Please sign in to comment.