Keep improving

This commit is contained in:
aronmal 2023-04-24 18:56:56 +02:00
parent d3e8a43b34
commit da53662d6e
Signed by: aronmal
GPG key ID: 816B7707426FC612
8 changed files with 165 additions and 60 deletions

View file

@ -79,7 +79,6 @@ export default function Home({ q }: Props) {
},
})
console.log(res)
setGameProps(res)
await toast.promise(router.push("/lobby"), {
@ -101,14 +100,12 @@ export default function Home({ q }: Props) {
useEffect(() => {
if (otp.length !== 4) return
if (!isInputOnlyNumbers(otp)) {
if (!isInputOnlyNumbers(otp))
toast("Der Code darf nur Zahlen beinhalten!", {
type: "warning",
theme: "dark",
})
return
}
gameFetch(otp)
else gameFetch(otp)
}, [otp, gameFetch])
return (
@ -121,11 +118,7 @@ export default function Home({ q }: Props) {
className="-mt-2 w-20 self-start rounded-xl border-b-4 border-shield-gray bg-voidDark text-2xl text-grayish duration-100 active:border-b-0 active:border-t-4 sm:-mt-6 sm:w-40 sm:px-2 sm:text-5xl"
onClick={() =>
setTimeout(() => {
// Navigate to the same page with the `start` query parameter set to `false`
router.push({
pathname: router.pathname,
query: null,
})
router.push("/")
}, 200)
}
>
@ -149,9 +142,7 @@ export default function Home({ q }: Props) {
icon={faUserPlus}
disabled={!session}
>
{q === "join" ? (
"Raum beitreten"
) : (
{q === "join" && session?.user ? (
<OtpInput
shouldAutoFocus
containerStyle={{ color: "initial" }}
@ -162,6 +153,8 @@ export default function Home({ q }: Props) {
renderSeparator={<span>-</span>}
renderInput={(props) => <input {...props} />}
/>
) : (
"Raum beitreten"
)}
</OptionButton>
<OptionButton icon={faEye}>Zuschauen</OptionButton>