Added some pages

This commit is contained in:
Kristoffer Juelsenn 2022-04-20 15:40:39 +02:00
parent 4bae1b3e20
commit 72628e06a6
3 changed files with 71 additions and 1 deletions

View File

@ -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 (
<Paper sx={{width: "90vw", margin: "10px auto", padding: "15px"}} component={Stack} direction="column">
<div align="center">
<TextField id="adminEmailInput" sx={{ width: "70%" }} label="Admin Email" variant="outlined" />
{/* <Button variant="contained" color="primary" onClick={postCreate}>Create Team</Button> */}
<Button variant="contained" color="success" onClick={postCreate} sx={{width: "20%", marginLeft: "5px"}}>
<Box sx={{padding: "10px"}}>
Create Admin
</Box>
<AddCircleIcon />
</Button>
</div>
</Paper>
)
}
function AdminList(props){
const deleteAdmin = adminId => {
fetch(process.env.REACT_APP_API_URL)
}

View File

@ -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';

View File

@ -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';