diff --git a/src/client/src/TournamentManager.js b/src/client/src/TournamentManager.js index 3ed5e11..6390955 100644 --- a/src/client/src/TournamentManager.js +++ b/src/client/src/TournamentManager.js @@ -1,15 +1,12 @@ import * as React from "react"; import { BrowserRouter as Router, Link, Route, Routes } from "react-router-dom"; // import { AlertContainer, alert } from "react-custom-alert"; -import AppBar from "./components/Appbar"; +import AppBar from "./components/AsuraBar"; import TournamentBar from "./components/TournamentBar"; import { useParams } from "react-router-dom"; -import { Button, TextField, Grid, Box, Container, Paper, Stack} from "@mui/material"; +import { Button, TextField, Grid, Box, Container, Paper, Stack } from "@mui/material"; +import { Snackbar, IconButton, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle } from "@mui/material"; import FileUploadIcon from '@mui/icons-material/FileUpload'; - -//Dependency for snackbar/popup -import Snackbar from '@mui/material/Snackbar'; -import IconButton from '@mui/material/IconButton'; import CloseIcon from '@mui/icons-material/Close'; let submitChanges = curryTournamentId => event => { @@ -21,7 +18,7 @@ let submitChanges = curryTournamentId => event => { // let tournamentImageFile = document.getElementById("editImage").files[0]; let tournamentStartDate = document.getElementById("editStartDate").value; let tournamentEndDate = document.getElementById("editEndDate").value; - + if (!tournamentName || tournamentName === "") { alert("Tournament name cannot be empty"); return; @@ -49,6 +46,10 @@ let submitChanges = curryTournamentId => event => { return; } + tournamentStartDate = new Date(tournamentStartDate).toUTCString(); + tournamentEndDate = new Date(tournamentEndDate).toUTCString(); + + let formData = new FormData(); formData.append("name", tournamentName); formData.append("description", tournamentDescription); @@ -76,10 +77,11 @@ let submitChanges = curryTournamentId => event => { let deleteTournament = tournamentId => event => { event.preventDefault(); //TODO: https://mui.com/components/dialogs/ - let certain = window.confirm("Are you sure? Click OK to delete tournament"); - if (!certain) { - return; - } + + // let certain = window.confirm("Are you sure? Click OK to delete tournament"); + // if (!certain) { + // return; + // } fetch(process.env.REACT_APP_API_URL + `/tournament/${tournamentId}`, { method: "DELETE", @@ -87,6 +89,7 @@ let deleteTournament = tournamentId => event => { .then((response) => response.json()) .then((data) => { if (data.status === "OK") { + // TODO: Replace alert with Snackbar alert("Tournament Deleted successfully"); window.location.href = "/"; } else { @@ -117,28 +120,9 @@ function ManageTournament(props) { <>