From 72628e06a64fce90e649ef9b00c7633e844658a7 Mon Sep 17 00:00:00 2001 From: Kristoffer Juelsen Date: Wed, 20 Apr 2022 15:40:39 +0200 Subject: [PATCH] Added some pages --- src/client/src/AdminsOverview.js | 62 +++++++++++++++++++++++++++++ src/client/src/LoginPage.js | 8 ++++ src/client/src/TournamentManager.js | 2 +- 3 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 src/client/src/AdminsOverview.js create mode 100644 src/client/src/LoginPage.js diff --git a/src/client/src/AdminsOverview.js b/src/client/src/AdminsOverview.js new file mode 100644 index 0000000..5484b19 --- /dev/null +++ b/src/client/src/AdminsOverview.js @@ -0,0 +1,62 @@ +import * as React from "react"; +import { BrowserRouter as Router, Link, Route, Routes } from "react-router-dom"; +import AppBar from "./components/AsuraBar"; +import ErrorSnackbar from "./components/ErrorSnackbar"; + +import {Button, Textfield, Stack, InputLabel, Paper, Typography} from '@mui/material'; +import DeleteIcon from '@mui/icons/Delete'; + +function showError(error) { + alert("Something went wrong. \n" + error); + console.error(error); +} + +function AdminCreator(props){ + function postCreate(){ + let adminEmail = document.getElementById("adminEmailInput").value; + if (!adminName) { + showError("Admin email is required"); + return; + } + + + let formData = new FormData(); + formData.append("name", teamName) + let body = new URLSearchParams(formData) + + fetch(process.env.REACT_APP_API_URL + `/admins/create`, { + method: "POST", + body: body + }) + .then(res => res.json()) + .then(data => { + if (data.status !== "OK") { + showError(data.data); + return; + } + document.getElementById("adminEmailInput").value = ""; + props.onAdminCreated(); + } + ) + } + + return ( + +
+ + {/* */} + +
+
+ ) +} + +function AdminList(props){ + const deleteAdmin = adminId => { + fetch(process.env.REACT_APP_API_URL) +} \ No newline at end of file diff --git a/src/client/src/LoginPage.js b/src/client/src/LoginPage.js new file mode 100644 index 0000000..09205fe --- /dev/null +++ b/src/client/src/LoginPage.js @@ -0,0 +1,8 @@ +import * as React from "react"; +import { BrowserRouter as Router, Link, Route, Routes } from "react-router-dom"; +import AppBar from "./components/AsuraBar"; +import ErrorSnackbar from "./components/ErrorSnackbar"; + +import {Button, Textfield, Stack, InputLabel, Paper, Typography} from '@mui/material'; + + diff --git a/src/client/src/TournamentManager.js b/src/client/src/TournamentManager.js index 0420b0f..87db5eb 100644 --- a/src/client/src/TournamentManager.js +++ b/src/client/src/TournamentManager.js @@ -5,7 +5,7 @@ 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 { Snackbar, IconButton, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle } from "@mui/material"; +import { Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle } from "@mui/material"; import CloseIcon from '@mui/icons-material/Close'; import DeleteIcon from '@mui/icons-material/Delete'; import DateTimePicker from '@mui/lab/DateTimePicker';