-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #192 from UoaWDCC/VPS-75/When-a-scenario-is-being-…
…deleted,-a-pop-up-appears-to-prevent-the-user-from-deleting-a-scenario-by-accident Vps 75/when a scenario is being deleted, a pop up appears to prevent the user from deleting a scenario by accident
- Loading branch information
Showing
5 changed files
with
90 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { useState } from "react"; | ||
import Button from "@mui/material/Button"; | ||
import { Dialog, DialogActions, DialogTitle } from "@mui/material"; | ||
import DeleteButton from "./DeleteButton"; | ||
|
||
function DeleteModal({ onDelete, currentScenario }) { | ||
const [open, setOpen] = useState(false); | ||
|
||
const handleClickOpen = () => { | ||
setOpen(true); | ||
}; | ||
|
||
const handleClose = () => { | ||
setOpen(false); | ||
}; | ||
|
||
const handleDelete = () => { | ||
onDelete(); | ||
handleClose(); | ||
}; | ||
|
||
return ( | ||
<div> | ||
<DeleteButton | ||
className="btn side" | ||
variant="contained" | ||
onClick={handleClickOpen} | ||
disabled={!currentScenario} | ||
> | ||
Delete | ||
</DeleteButton> | ||
<Dialog open={open} onClose={handleClose}> | ||
<DialogTitle>Are you sure you want to delete the scenario?</DialogTitle> | ||
<DialogActions> | ||
<Button onClick={handleClose} color="primary"> | ||
Go Back | ||
</Button> | ||
<DeleteButton onClick={handleDelete}>Delete</DeleteButton> | ||
</DialogActions> | ||
</Dialog> | ||
</div> | ||
); | ||
} | ||
|
||
export default DeleteModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.