diff --git a/dashboard/src/states/Dashboard/pages/Home/components/ProjectCreationDialog/ProjectCreationDialog.jsx b/dashboard/src/states/Dashboard/pages/Home/components/ProjectCreationDialog/ProjectCreationDialog.jsx
index 3ef4573..2e5e64d 100644
--- a/dashboard/src/states/Dashboard/pages/Home/components/ProjectCreationDialog/ProjectCreationDialog.jsx
+++ b/dashboard/src/states/Dashboard/pages/Home/components/ProjectCreationDialog/ProjectCreationDialog.jsx
@@ -10,23 +10,28 @@ import {
import {putRequest} from "@/common/utils/RequestUtil.js";
import {useContext, useEffect, useState} from "react";
import {ProjectContext} from "@/states/Dashboard/contexts/Project";
-import {DriveFileRenameOutline} from "@mui/icons-material";
+import {AutoMode, DriveFileRenameOutline} from "@mui/icons-material";
export const ProjectCreationDialog = ({open, onClose}) => {
const {updateProjects} = useContext(ProjectContext);
+ const [loading, setLoading] = useState(false);
+
const [name, setName] = useState("");
const [creationError, setCreationError] = useState(null);
const createProject = () => {
if (name.length === 0) return setCreationError("Name cannot be empty.");
+ setLoading(true);
putRequest("/project", {name}).then(() => {
+ setLoading(false);
updateProjects();
onClose();
}).catch((e) => {
setCreationError(e.message);
+ setLoading(false);
});
}
@@ -47,14 +52,18 @@ export const ProjectCreationDialog = ({open, onClose}) => {
Create a new project
{creationError && {creationError}}
- setName(e.target.value)}
+ setName(e.target.value)}
placeholder="Name"
- InputProps={{startAdornment: }}
- onKeyUp={onKeyUp} sx={{mt: 1}} />
+ InputProps={{startAdornment: }}
+ onKeyUp={loading ? null : onKeyUp} sx={{mt: 1}}/>
-
-
+ {loading && }
+ {!loading && <>
+
+
+ >}
)