Skip to content

Commit

Permalink
cl-647-disable-upload-csv-button-multiclick
Browse files Browse the repository at this point in the history
  • Loading branch information
Chetan-Gudagamanal committed Mar 13, 2024
1 parent 7c5ba2f commit 7e73e18
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 7e73e18

Please sign in to comment.