Skip to content

Commit

Permalink
Merge pull request #572 from AI4Bharat/cl-647-disable-upload-button
Browse files Browse the repository at this point in the history
Cl 647 disable upload button
  • Loading branch information
Chetan-Gudagamanal authored Mar 13, 2024
2 parents 3837fc2 + 7e73e18 commit 5837acb
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/common/UploadFileDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { DropzoneArea } from "react-mui-dropzone";

const UploadFileDialog = ({ openDialog, handleClose, title, handleSubmit }) => {
const [uploadedFile, setUploadedFile] = useState();
const [disableMultiClick, setDisableMultiClick] = useState(false);

return (
<Dialog
Expand Down Expand Up @@ -50,10 +51,16 @@ const UploadFileDialog = ({ openDialog, handleClose, title, handleSubmit }) => {

<Button
variant="contained"
onClick={() => handleSubmit(uploadedFile)}
onClick={() => {
setDisableMultiClick(true);
setTimeout(() => {
setDisableMultiClick(false);
}, 5000);
handleSubmit(uploadedFile);
}}
autoFocus
sx={{ lineHeight: "1", borderRadius: "8px" }}
disabled={false}
disabled={disableMultiClick}
>
Upload
</Button>
Expand Down

0 comments on commit 5837acb

Please sign in to comment.