This commit is contained in:
qt-coder 2021-06-22 08:19:52 +08:00
parent df436e9832
commit 8d750fd31c
2 changed files with 37 additions and 26 deletions

View file

@ -8,6 +8,7 @@ import IconButton from '@material-ui/core/IconButton';
import MenuIcon from '@material-ui/icons/Menu'; import MenuIcon from '@material-ui/icons/Menu';
import Link from 'next/link' import Link from 'next/link'
import AuthButton from './AuthButton' import AuthButton from './AuthButton'
import { useSession } from 'next-auth/client'
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
root: { root: {
@ -22,6 +23,7 @@ const useStyles = makeStyles((theme) => ({
})); }));
export default function ButtonAppBar() { export default function ButtonAppBar() {
const [session, loading] = useSession()
const classes = useStyles(); const classes = useStyles();
return ( return (
@ -38,9 +40,9 @@ export default function ButtonAppBar() {
Cath.exe Cath.exe
</Link> </Link>
</Typography> </Typography>
<Button color="inherit">Stats</Button> {session && <Button color="inherit">Stats</Button>}
<AuthButton/> <AuthButton/>
<Link href='/controlpanel'><Button color="inherit">Control Panel</Button></Link> {session && <Link href='/controlpanel'><Button color="inherit">Control Panel</Button></Link>}
</Toolbar> </Toolbar>
</AppBar> </AppBar>
</div> </div>

View file

@ -8,6 +8,7 @@ import TableHead from '@material-ui/core/TableHead';
import TableRow from '@material-ui/core/TableRow'; import TableRow from '@material-ui/core/TableRow';
import Paper from '@material-ui/core/Paper'; import Paper from '@material-ui/core/Paper';
import Head from 'next/head' import Head from 'next/head'
import { useSession } from 'next-auth/client'
const useStyles = makeStyles({ const useStyles = makeStyles({
table: { table: {
@ -27,35 +28,43 @@ const rows = [
]; ];
function Commands() { function Commands() {
const [session, loading] = useSession()
const classes = useStyles(); const classes = useStyles();
return ( return (
<> <>
<Head> {session &&
<title>Cath Commands</title> <>
</Head> <Head>
<TableContainer component={Paper} style={{ background: '#1F1B24' }}> <title>Cath Commands</title>
<Table className={classes.table} aria-label="simple table"> </Head>
<TableHead> <TableContainer component={Paper} style={{ background: '#1F1B24' }}>
<TableRow> <Table className={classes.table} aria-label="simple table">
<TableCell style={{ color: '#fff' }}>Commands</TableCell> <TableHead>
<TableCell align="right" style={{ color: '#fff' }}>Description</TableCell> <TableRow>
<TableCell align="right" style={{ color: '#fff' }}>Status</TableCell> <TableCell style={{ color: '#fff' }}>Commands</TableCell>
</TableRow> <TableCell align="right" style={{ color: '#fff' }}>Description</TableCell>
</TableHead> <TableCell align="right" style={{ color: '#fff' }}>Status</TableCell>
<TableBody>
{rows.map((row) => (
<TableRow key={row.name}>
<TableCell component="th" scope="row" style={{ color: '#fff' }}>
{row.name}
</TableCell>
<TableCell align="right" style={{ color: '#fff' }}>{row.description}</TableCell>
<TableCell align="right" style={{ color: '#fff' }}>{row.status ? 'Online' : 'Offline'}</TableCell>
</TableRow> </TableRow>
))} </TableHead>
</TableBody> <TableBody>
</Table> {rows.map((row) => (
</TableContainer> <TableRow key={row.name}>
<TableCell component="th" scope="row" style={{ color: '#fff' }}>
{row.name}
</TableCell>
<TableCell align="right" style={{ color: '#fff' }}>{row.description}</TableCell>
<TableCell align="right" style={{ color: '#fff' }}>{row.status ? 'Online' : 'Offline'}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</TableContainer>
</>
} {!session && <>
<h1>Seems like you&apos;re not logged in. Log in to get started!</h1>
</>
}
</> </>
); );
} }