Previous commit extended
This commit is contained in:
parent
2c06a8adb2
commit
4f229ff642
|
@ -2,7 +2,7 @@ import * as React from "react";
|
||||||
import { BrowserRouter as Router, Link, Route, Routes, useParams } from "react-router-dom";
|
import { BrowserRouter as Router, Link, Route, Routes, useParams } from "react-router-dom";
|
||||||
import Appbar from "./components/AsuraBar";
|
import Appbar from "./components/AsuraBar";
|
||||||
import ErrorSnackbar from "./components/ErrorSnackbar";
|
import ErrorSnackbar from "./components/ErrorSnackbar";
|
||||||
|
import LoginPage from "./LoginPage";
|
||||||
import {Button, Box, TextField, Stack, InputLabel, Paper, TableContainer, Table, TableBody, TableHead, TableCell, TableRow, Typography} from '@mui/material';
|
import {Button, Box, TextField, Stack, InputLabel, Paper, TableContainer, Table, TableBody, TableHead, TableCell, TableRow, Typography} from '@mui/material';
|
||||||
import AddCircleIcon from '@mui/icons-material/AddCircle';
|
import AddCircleIcon from '@mui/icons-material/AddCircle';
|
||||||
import DeleteIcon from '@mui/icons-material/Delete';
|
import DeleteIcon from '@mui/icons-material/Delete';
|
||||||
|
@ -124,18 +124,29 @@ export default function Users(props) {
|
||||||
setUsers(data.data);
|
setUsers(data.data);
|
||||||
})
|
})
|
||||||
.catch((err) => showError(err));
|
.catch((err) => showError(err));
|
||||||
}
|
}
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
getUsers()
|
getUsers()
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
if (!props.user.isLoggedIn) { return <LoginPage user={props.user} />; }
|
||||||
<>
|
if (!props.user.isManager) {
|
||||||
|
return (<>
|
||||||
<Appbar user={props.user} pageTitle="Admins" />
|
<Appbar user={props.user} pageTitle="Admins" />
|
||||||
<div className="admins">
|
<Paper sx={{minHeight: "30vh", width:"90vw", margin:"10px auto", padding: "25px"}} component={Stack} direction="column" justifycontent="center">
|
||||||
<AdminCreator />
|
<div align="center">
|
||||||
<UserList users={users}/>
|
<Typography variant="h4">You do not have permission to view this page. If you believe this is incorrect, please contact a manager.</Typography>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</Paper>
|
||||||
);
|
</>);
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Appbar user={props.user} pageTitle="Admins" />
|
||||||
|
<div className="admins">
|
||||||
|
<AdminCreator />
|
||||||
|
<UserList users={users}/>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
}
|
}
|
|
@ -15,11 +15,11 @@ export default function LoginPage(props) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Appbar user={props.user} pageTitle="Login" />
|
<Appbar user={props.user} pageTitle="Login" />
|
||||||
<Paper sx={{width: "70vw", margin: "1.5% auto"}} component={Stack} direction="column" justifyContent="center" alignItems="center">
|
<Paper sx={{width: "70vw", margin: "1.5% auto", padding: "25px"}} component={Stack} direction="column" justifyContent="center" alignItems="center">
|
||||||
<Typography variant="h4" component="h4">
|
<Stack direction="column" paddingTop={'0.5%'} alignItems={'center'} textAlign={"center"} >
|
||||||
You must be logged in to access administrator features.
|
<Typography variant="h4" component="h4">
|
||||||
</Typography>
|
You must be logged in to access administrator features.
|
||||||
<Stack direction="column" paddingTop={'0.5%'} alignItems={'center'}>
|
</Typography>
|
||||||
<a href={process.env.REACT_APP_LOGIN_URL}>
|
<a href={process.env.REACT_APP_LOGIN_URL}>
|
||||||
<img src="/btn_google_signing_dark.png" alt="Sign in with google" />
|
<img src="/btn_google_signing_dark.png" alt="Sign in with google" />
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -2,7 +2,7 @@ import * as React from "react";
|
||||||
import { BrowserRouter as Router, Link, Route, Routes } from "react-router-dom";
|
import { BrowserRouter as Router, Link, Route, Routes } from "react-router-dom";
|
||||||
import Appbar from "./components/AsuraBar";
|
import Appbar from "./components/AsuraBar";
|
||||||
import ErrorSnackbar from "./components/ErrorSnackbar";
|
import ErrorSnackbar from "./components/ErrorSnackbar";
|
||||||
|
import LoginPage from "./LoginPage";
|
||||||
import { Button, TextField, Stack, InputLabel, Select, Container, Slider, Paper, Box, Grid, Typography } from '@mui/material';
|
import { Button, TextField, Stack, InputLabel, Select, Container, Slider, Paper, Box, Grid, Typography } from '@mui/material';
|
||||||
import DateTimePicker from '@mui/lab/DateTimePicker';
|
import DateTimePicker from '@mui/lab/DateTimePicker';
|
||||||
import AdapterDateFns from '@mui/lab/AdapterDateFns';
|
import AdapterDateFns from '@mui/lab/AdapterDateFns';
|
||||||
|
@ -168,6 +168,8 @@ export default function TournamentCreator(props) {
|
||||||
setOpenError(true);
|
setOpenError(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!props.user.isLoggedIn) { return <LoginPage user={props.user} />; }
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Appbar user={props.user} pageTitle="New tournament" />
|
<Appbar user={props.user} pageTitle="New tournament" />
|
||||||
|
|
|
@ -9,7 +9,7 @@ function MatchHistory() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function TournamentMatches() {
|
export default function TournamentMatches(props) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Appbar user={props.user} />
|
<Appbar user={props.user} />
|
||||||
|
|
|
@ -9,7 +9,7 @@ import LogoutIcon from '@mui/icons-material/Logout';
|
||||||
import LoginIcon from '@mui/icons-material/Login';
|
import LoginIcon from '@mui/icons-material/Login';
|
||||||
import logo from "./../Asura2222.png";
|
import logo from "./../Asura2222.png";
|
||||||
|
|
||||||
function LoggedInMenu() {
|
function LoggedInMenu(props) {
|
||||||
const [anchorEl, setAnchorEl] = React.useState(null);
|
const [anchorEl, setAnchorEl] = React.useState(null);
|
||||||
const open = Boolean(anchorEl);
|
const open = Boolean(anchorEl);
|
||||||
const handleClick = (event) => {
|
const handleClick = (event) => {
|
||||||
|
@ -32,7 +32,9 @@ function LoggedInMenu() {
|
||||||
<Link to="/" style={{color:"black"}}><MenuItem onClick={handleClose}><Button endIcon={<AccountCircleIcon />}>Profile</Button></MenuItem></Link>
|
<Link to="/" style={{color:"black"}}><MenuItem onClick={handleClose}><Button endIcon={<AccountCircleIcon />}>Profile</Button></MenuItem></Link>
|
||||||
<Link to="/history" style={{color:"black"}}><MenuItem onClick={handleClose}><Button endIcon={<HistoryIcon />}>History</Button></MenuItem></Link>
|
<Link to="/history" style={{color:"black"}}><MenuItem onClick={handleClose}><Button endIcon={<HistoryIcon />}>History</Button></MenuItem></Link>
|
||||||
<Link to="/api/logout" style={{color:"black"}}><MenuItem onClick={logout}><Button endIcon={<LogoutIcon />} >Logout</Button></MenuItem></Link>
|
<Link to="/api/logout" style={{color:"black"}}><MenuItem onClick={logout}><Button endIcon={<LogoutIcon />} >Logout</Button></MenuItem></Link>
|
||||||
|
{ props.user.isManager &&
|
||||||
<Link to="/admins" style={{color:"black"}}><MenuItem onClick={handleClose}><Button endIcon={<EditIcon />} >Admins</Button></MenuItem></Link>
|
<Link to="/admins" style={{color:"black"}}><MenuItem onClick={handleClose}><Button endIcon={<EditIcon />} >Admins</Button></MenuItem></Link>
|
||||||
|
}
|
||||||
</Menu>
|
</Menu>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
@ -83,7 +85,7 @@ export default function Appbar(props) {
|
||||||
</Grid>
|
</Grid>
|
||||||
{ props.pageTitle !== "Login" ?
|
{ props.pageTitle !== "Login" ?
|
||||||
<Grid item xs={2}>
|
<Grid item xs={2}>
|
||||||
{ props.user.isLogggedIn ? <LoggedInMenu /> : <NotLoggedInButton /> }
|
{ props.user.isLoggedIn ? <LoggedInMenu user={props.user} /> : <NotLoggedInButton /> }
|
||||||
</Grid> :
|
</Grid> :
|
||||||
<Grid item xs={2}>
|
<Grid item xs={2}>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
Loading…
Reference in New Issue