import * as React from 'react'; import { useState, useEffect } from 'react'; import { useRouter } from 'next/router'; import { withPageAuthRequired } from '@auth0/nextjs-auth0/client' import { Alert, Card, CardContent, Grid, IconButton, TextField, Typography } from '@mui/material'; import { ArrowBack, ArrowLeft, Block, Close } from '@mui/icons-material'; import Button from '@mui/material/Button'; import { OpenInNew } from 'mdi-material-ui'; import Tooltip from '@mui/material/Tooltip'; const AdminArtist = () => { const router = useRouter(); const [artist, setArtist] = useState(null); const getData = async () => { if(router.query.artistId!=null){ const response = await fetch("/api/admin/artists/"+router.query.artistId); const data = await response.json(); setArtist(data); } } useEffect(() => { getData() }, [router.query.artistId]); return ( <> Artist Information router.push("/dashboard/admin/artists")} color="primary"> Display Name: {artist?.user?.displayName} Email: {artist?.user?.email} 0 ? "error" : "success"}>{artist?.numberOfBans > 0 ? "This user has been banned "+artist?.numberOfBans+" times." : "This user has not been banned before."} 0 ? "error" : "success"}>{artist?.numberOfBans > 0 ? "This user has been suspended "+artist?.numberOfSuspensions+" times." : "This user has not been suspended before."} This artist has made ${artist?.amountMade}, and we have made ${artist?.feesCollected} in fees. 0 ? "success" : "warning"}>This artist has accepted {artist?.numberOfRequests} requests. 0 ? "success" : "warning"}>This artist has completed {artist?.numberOfCompleted} requests. ); }; // Protected route, checking user authentication client-side.(CSR) export default withPageAuthRequired(AdminArtist);