import * as React from 'react' import { PJ } from '@lastres/pj' import LoginPage from '@lastres/components/login-page' import Game from '@lastres/components/game' import { checkLogin } from '@lastres/login' import RegistrationPage from '@lastres/components/registration-page' // import Game from '@lastres/components/game' export default function Page (): JSX.Element { const [isLoggedIn, setIsLoggedIn] = React.useState(false) const [userWantsToCreatePJ, setUserWantsToCreatePJ] = React.useState(false) const [isAskingForRegistration, setIsAskingForRegistration] = React.useState(false) const [error, setError] = React.useState(null) const [selectedPJ, setSelectedPJ] = React.useState(null) const [websocket, setWebsocket] = React.useState(null) checkLogin(setError, setIsLoggedIn) if (!isLoggedIn) { return notLoggedRender(setIsLoggedIn, isAskingForRegistration, setIsAskingForRegistration, error, setError) } return ( ) } function notLoggedRender (setIsLoggedIn: (a: boolean) => void, isAskingForRegistration: boolean, setIsAskingForRegistration: (a: boolean) => void, error: string | null, setError: (a: string | null) => void): JSX.Element { if (isAskingForRegistration) { return ( <> ) } return ( <> ) }