Implemented simple full-stack logic (unfinished)

This commit is contained in:
aronmal 2023-04-12 22:33:29 +02:00
parent a32b40395e
commit 2862f94f1c
Signed by: aronmal
GPG key ID: 816B7707426FC612
19 changed files with 481 additions and 189 deletions

View file

@ -5,7 +5,7 @@ import { Fragment, useContext, useEffect, useState } from "react"
function LobbyFrame({ openSettings }: { openSettings: () => void }) {
const [gameProps, setGameProps] = useContext(gameContext)
const [enemy, setEnemy] = useState(false)
const { enemy } = gameProps
const [dots, setDots] = useState(1)
useEffect(() => {
@ -28,18 +28,13 @@ function LobbyFrame({ openSettings }: { openSettings: () => void }) {
<div className="flex items-center justify-around">
<Player
src="player_blue.png"
text="Spieler 1 (Du)"
text={gameProps.player?.username ?? "Spieler 1 (Du)"}
primary={true}
edit={true}
/>
<p
className="font-farro m-4 text-6xl font-semibold"
onClick={() => setEnemy((e) => !e)}
>
VS
</p>
<p className="font-farro m-4 text-6xl font-semibold">VS</p>
{enemy ? (
<Player src="player_red.png" text="Spieler 2" />
<Player src="player_red.png" text={enemy.username ?? "Spieler 2"} />
) : (
<p className="font-farro w-96 text-center text-5xl font-medium">
Warte auf Spieler 2 {Array.from(Array(dots), () => ".").join("")}