From 5431f9496c2be03099057341642d4d321b8bd5dd Mon Sep 17 00:00:00 2001 From: Kristoffer Juelsen Date: Fri, 22 Apr 2022 10:12:42 +0200 Subject: [PATCH] Created delete dialog --- src/client/src/TournamentManager.js | 65 ++++++++++++++++++++++++++--- 1 file changed, 60 insertions(+), 5 deletions(-) diff --git a/src/client/src/TournamentManager.js b/src/client/src/TournamentManager.js index 87db5eb..1f64abb 100644 --- a/src/client/src/TournamentManager.js +++ b/src/client/src/TournamentManager.js @@ -11,6 +11,7 @@ import DeleteIcon from '@mui/icons-material/Delete'; import DateTimePicker from '@mui/lab/DateTimePicker'; import AdapterDateFns from '@mui/lab/AdapterDateFns'; import LocalizationProvider from '@mui/lab/LocalizationProvider'; +import PropTypes from 'prop-types' let submitChanges = curryTournamentId => event => { event.preventDefault(); @@ -77,6 +78,7 @@ let submitChanges = curryTournamentId => event => { .catch((error) => showError(error)); } let deleteTournament = tournamentId => event => { + console.log(tournamentId); event.preventDefault(); //TODO: https://mui.com/components/dialogs/ @@ -172,13 +174,59 @@ function showError(error) { console.error(error); } +function ConfirmationDialogRaw(props) { + const { tournamentId } = useParams(); + const { onClose, value: valueProp, open, ...other } = props; + const [value, setValue] = React.useState(valueProp); + const radioGroupRef = React.useRef(null); + + React.useEffect(() => { + if (!open) { + setValue(valueProp); + } + }, [valueProp, open]); + + const handleCancel = () => { + onClose(); + }; + + return ( + + Yes or No + + Test + + + + + + + ); +} + +ConfirmationDialogRaw.propTypes = { + onClose: PropTypes.func.isRequired, + open: PropTypes.bool.isRequired, + value: PropTypes.string.isRequired, +}; + export default function TournamentManager(props) { const { tournamentId } = useParams(); const [open, setOpen] = React.useState(false); - const handleConfirm = () => { - return true; + const [value, setValue] = React.useState(""); + + const handleClickListItem = () => { + setOpen(true); }; + const handleClose = () => { setOpen(false); }; @@ -191,13 +239,20 @@ export default function TournamentManager(props) { {/* */} - + - - + */} );