import { CSSProperties, Component } from 'react'; import axios from 'axios'; import { userInfo } from '../api/api'; import { NavBar } from '../components/navbar'; import { CenteredPage, PageTitle } from '../components/page'; import { Vierkant, Button } from '../components/ui'; import { AccountAvatar } from '../components/account'; import RecentGames from '../components/recentGames'; import VideogameAssetIcon from '@material-ui/icons/VideogameAsset'; import ExtensionIcon from '@material-ui/icons/Extension'; import Icon from '@mdi/react'; import { mdiRobotExcited } from '@mdi/js'; var GameModeIconStyle: CSSProperties = { fontSize: 64, width: 64, height: 64, display: "inline-block", position: "absolute", top: 24, left: "50%", transform: "translateX(-50%)" } var GameModeTextStyle: CSSProperties = { whiteSpace: "nowrap", display: "inline-block", position: "absolute", bottom: 24, left: "50%", transform: "translateX(-50%)", userSelect: "none", fontWeight: 500 } var SquareSize: CSSProperties = { width: 90, height: 90 } export default class HomePage extends Component { state: { info: userInfo, loggedIn: boolean } = { info: {}, loggedIn: false } constructor(props: {}) { super(props); if (typeof window === "undefined") return; // return if run on server this.state.loggedIn = document.cookie.includes("token"); if (this.state.loggedIn == false) return; // don't request user info if not logged in axios.request({ method: "get", url: `/api/user/info`, headers: {"content-type": "application/json"} }) .then(request => this.setState({ info: request.data })) .catch(() => {}); } render () { return
4 op een rij Nieuw spel
Puzzels
Tegen computer
Log in of maak een account aan om je scores op te slaan en toegang te krijgen tot meer functies

{this.state.info.username}

Score: 400

0 W / 0 V / 0 G

Nieuws ofzo

Chess.com heeft heel veel troep waar niemand naar kijkt

} }