diff --git a/leaky-ships/pages/dev/lobby.tsx b/leaky-ships/pages/dev/lobby.tsx index f9e3d41..6789d0e 100644 --- a/leaky-ships/pages/dev/lobby.tsx +++ b/leaky-ships/pages/dev/lobby.tsx @@ -1,12 +1,27 @@ +import { + faToggleLargeOff, + faToggleLargeOn, + faXmark, +} from "@fortawesome/pro-solid-svg-icons" +import { faRotateLeft } from "@fortawesome/pro-regular-svg-icons" import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" import { faCaretDown } from "@fortawesome/sharp-solid-svg-icons" import classNames from "classnames" import Head from "next/head" -import { useEffect, useState } from "react" +import { Dispatch, SetStateAction, useEffect, useState } from "react" + +const settingOptionsInit: { [key: string]: boolean } = { + allowSpectators: false, + allowSpecials: false, + allowChat: false, + allowMarkDraw: false, +} export default function Home() { const [enemy, setEnemy] = useState(false) + const [settings, setSettings] = useState(false) const [dots, setDots] = useState(0) + const [settingOptions, setSettingOptions] = useState(settingOptionsInit) useEffect(() => { if (enemy) return @@ -44,7 +59,11 @@ export default function Home() {

Game-PIN: 3169

- + setSettings(true)} + />
+ {settings ? ( + setSettings(false), + }} + /> + ) : ( + <> + )} ) } -function Icon({ src, text }: { src: string; text: string }) { +function Icon({ + src, + text, + onClick, +}: { + src: string + text: string + onClick?: () => void +}) { return ( - +
+ +
+ {Object.keys(settingOptions).map((key) => { + const state = settingOptions[key] + const onClick = () => + setSettingOptions((e) => ({ ...e, [key]: !e[key] })) + return + })} +
+
+ + + ) +} +function Setting({ + props: { key, state, onClick }, +}: { + props: { + key: string + state: boolean + onClick: () => void + } +}) { + return ( + <> + + + + + ) +}