import RootLayout from "@rollem/ui/components/layouts/RootLayout"; import { Card, Grid, CardContent, CardHeader, Theme, Avatar, Accordion, AccordionSummary, Typography, AccordionDetails, Tooltip, CardActions, Button, } from "@mui/material"; import makeStyles from '@mui/styles/makeStyles'; import fetch from 'isomorphic-unfetch'; import useSWR from "swr"; import { RollemSessionData } from "@rollem/ui/lib/api/old.withSession"; import { Cloud, ExpandMore, Web } from '@mui/icons-material'; import React from "react"; const API_URL = '/api/auth/discord/getData'; async function fetcher(url) { const res = await fetch(url); const json = await res.json(); return json; } const useStyles = makeStyles((theme: Theme) => ({ icon: { paddingRight: "0.25em", }, homeWrapper: { display: "flex", flexFlow: "row nowrap", alignItems: "center", }, profileImage: { maxHeight: "48px", marginRight: ".25em", }, discrimator: { opacity: ".5", }, gridWrapper: { marginTop: "2em", marginBottom: "2em", }, cardContent: { textAlign: "center", }, heading: { fontSize: theme.typography.pxToRem(15), flexBasis: '33.33%', flexShrink: 0, display: "flex", flexFlow: "row nowrap", alignItems: "center", }, secondaryHeading: { fontSize: theme.typography.pxToRem(15), color: theme.palette.text.secondary, }, accordionDetails: { display: "block", "& pre": { maxHeight: "80vh", overflow: "auto", backgroundColor: theme.palette.getContrastText(theme.palette.grey[400]), color: theme.palette.grey[400], } }, index: { listStyle: "none", margin: "0", padding: "0", display: "flex", flexFlow: "row", "& > li": { padding: "0.5em", display: "flex", flexFlow: "row nowrap", alignItems: "center", "&:first-child": { paddingLeft: "0", }, } } }), ); export default function AccountSummary() { const classes = useStyles(); const { data, error } = useSWR(API_URL, fetcher); const avatar = data?.discord?.user?.avatar; const userId = data?.discord?.user?.id; const username = data?.discord?.user?.username; const discriminator = data?.discord?.user?.discriminator; const guildCount = data?.discord?.guilds?.length; const [expanded, setExpanded] = React.useState(false); const [expanded2, setExpanded2] = React.useState(false); const handleChange = (panel: string) => (event: React.ChangeEvent<{}>, isExpanded: boolean) => { setExpanded(isExpanded ? panel : false); setExpanded2(false); }; const handleChange2 = (panel: string) => (event: React.ChangeEvent<{}>, isExpanded: boolean) => { setExpanded2(isExpanded ? panel : false); }; return ( ( } title={ <>{username}#{discriminator} } subheader={`In ${guildCount} Guilds`}/>

You are now logged in.

  • Here's what we know about you.
  • browser session
  • database
  • } /> } aria-controls="panel1bh-content" id="panel1bh-header" > Auth Object Authorization and Identity secrets

    This information is stored in the browser and on the server in your session. It is not stored to a database.

    This value is used to verify that you are indeed yourself, and perform actions against your account.

    These values are secret and will allow any imposters the same access as rollem.rocks, so do not share them.

    } aria-controls="panel1abh-content" id="panel1abh-header" > Click to reveal
                            { JSON.stringify(data?.discord?.auth, null, 2) }
                          
    } aria-controls="panel2bh-content" id="panel2bh-header" > Guilds Guilds for listing on the Settings page

    This information is stored in the browser and on the server in your session. It is not stored to a database.

    This value is used to populate the settings list for the guilds you're in.

                        { JSON.stringify(data?.discord?.guilds, null, 2) }
                      
    } aria-controls="panel3bh-content" id="panel3bh-header" > User Information Who you are

    This information is stored in the browser and on the server in your session. It is not stored to a database.

    This value is used to display your avatar and username, so you are sure you are on the right account.

                        { JSON.stringify(data?.discord?.user, null, 2) }
                      
    } aria-controls="panel4bh-content" id="panel4bh-header" > User Information Your internal and discord ID, and some dates

    This information is stored on the database.

    This is how we keep track of your user when interacting with Rollem

                        { JSON.stringify(data?.data?.user, null, 2) }
                      
    {data?.errors && } aria-controls="panel5bh-content" id="panel5bh-header" > Errors Any errors encountered retrieving your data
                          { JSON.stringify(data?.errors, null, 2) }
                        
    }
    ) ); }