Format all files
This commit is contained in:
parent
4cb29470c8
commit
eb3dbdd008
51 changed files with 267 additions and 266 deletions
|
@ -77,7 +77,7 @@ function Bluetooth() {
|
|||
gattCharacteristic = characteristic
|
||||
characteristic.addEventListener(
|
||||
"characteristicvaluechanged",
|
||||
handleChangedValue
|
||||
handleChangedValue,
|
||||
)
|
||||
|
||||
setStartDisabled(false)
|
||||
|
@ -94,7 +94,7 @@ function Bluetooth() {
|
|||
const now = new Date()
|
||||
// Output the UV Index
|
||||
console.log(
|
||||
`> ${now.getHours()}:${now.getMinutes()}:${now.getSeconds()} UV Index is ${value}`
|
||||
`> ${now.getHours()}:${now.getMinutes()}:${now.getSeconds()} UV Index is ${value}`,
|
||||
)
|
||||
|
||||
// Output the Battery percentage
|
||||
|
@ -159,7 +159,7 @@ function Bluetooth() {
|
|||
className="App-link"
|
||||
onClick={() => {
|
||||
navigator.clipboard.writeText(
|
||||
"chrome://flags/#enable-experimental-web-platform-features"
|
||||
"chrome://flags/#enable-experimental-web-platform-features",
|
||||
)
|
||||
}}
|
||||
// target="_blank"
|
||||
|
@ -172,7 +172,7 @@ function Bluetooth() {
|
|||
className="App-link"
|
||||
onClick={() => {
|
||||
navigator.clipboard.writeText(
|
||||
"chrome://flags/#enable-web-bluetooth-new-permissions-backend"
|
||||
"chrome://flags/#enable-web-bluetooth-new-permissions-backend",
|
||||
)
|
||||
}}
|
||||
// target="_blank"
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import classNames from "classnames"
|
||||
import React from "react"
|
||||
|
||||
function BurgerMenu({
|
||||
onClick,
|
||||
|
@ -13,7 +12,7 @@ function BurgerMenu({
|
|||
id="menu"
|
||||
className={classNames(
|
||||
"absolute left-4 top-4 flex h-16 w-16 items-center justify-center rounded-lg border-b-2 border-shield-gray bg-grayish shadow-lg duration-100 active:border-b-0 active:border-t-2 md:left-6 md:top-6 md:h-20 md:w-20 md:rounded-xl md:border-b-4 md:active:border-t-4 lg:left-8 lg:top-8 xl:left-12 xl:top-12 xl:h-24 xl:w-24",
|
||||
{ "blur-sm": blur }
|
||||
{ "blur-sm": blur },
|
||||
)}
|
||||
onClick={() => onClick && setTimeout(onClick, 200)}
|
||||
>
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { count } from "./Gamefield"
|
||||
import { useGameProps } from "@hooks/useGameProps"
|
||||
import useIndex from "@hooks/useIndex"
|
||||
import useShips from "@hooks/useShips"
|
||||
|
@ -13,6 +12,7 @@ import {
|
|||
targetList,
|
||||
} from "@lib/utils/helpers"
|
||||
import { CSSProperties, useCallback } from "react"
|
||||
import { count } from "./Gamefield"
|
||||
|
||||
type TilesType = {
|
||||
key: number
|
||||
|
@ -41,7 +41,7 @@ function BorderTiles() {
|
|||
if (
|
||||
!isGameTile ||
|
||||
!list.filter(
|
||||
({ x, y }) => !isAlreadyHit(x, y, activeUser?.hits ?? [])
|
||||
({ x, y }) => !isAlreadyHit(x, y, activeUser?.hits ?? []),
|
||||
).length
|
||||
)
|
||||
return
|
||||
|
@ -70,7 +70,7 @@ function BorderTiles() {
|
|||
setTarget,
|
||||
ships,
|
||||
targetPreview,
|
||||
]
|
||||
],
|
||||
)
|
||||
let tilesProperties: TilesType[] = []
|
||||
|
||||
|
@ -136,7 +136,7 @@ function BorderTiles() {
|
|||
y,
|
||||
orientation: targetPreview.orientation,
|
||||
}),
|
||||
true
|
||||
true,
|
||||
).score < 2
|
||||
: true),
|
||||
})
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import { EventBarModes } from "../../interfaces/frontend"
|
||||
import Item from "./Item"
|
||||
import { GameSettings } from "@components/Lobby/SettingsFrame/Setting"
|
||||
import {
|
||||
faSquare2,
|
||||
|
@ -34,11 +32,13 @@ import { GamePropsSchema } from "@lib/zodSchemas"
|
|||
import { useRouter } from "next/router"
|
||||
import { useCallback, useEffect, useMemo } from "react"
|
||||
import { Icons, toast } from "react-toastify"
|
||||
import { EventBarModes } from "../../interfaces/frontend"
|
||||
import Item from "./Item"
|
||||
|
||||
export function setGameSetting(
|
||||
payload: GameSettings,
|
||||
setSetting: (settings: GameSettings) => string | null,
|
||||
full: (payload: GamePropsSchema) => void
|
||||
full: (payload: GamePropsSchema) => void,
|
||||
) {
|
||||
return () => {
|
||||
const hash = setSetting(payload)
|
||||
|
@ -70,7 +70,7 @@ function EventBar({ clear }: { clear: () => void }) {
|
|||
} = useGameProps()
|
||||
const gameSetting = useCallback(
|
||||
(payload: GameSettings) => setGameSetting(payload, setSetting, full),
|
||||
[full, setSetting]
|
||||
[full, setSetting],
|
||||
)
|
||||
|
||||
const items = useMemo<EventBarModes>(
|
||||
|
@ -142,7 +142,7 @@ function EventBar({ clear }: { clear: () => void }) {
|
|||
amount:
|
||||
2 -
|
||||
((selfUser?.moves ?? []).filter(
|
||||
(e) => e.type === "htorpedo" || e.type === "vtorpedo"
|
||||
(e) => e.type === "htorpedo" || e.type === "vtorpedo",
|
||||
).length ?? 0),
|
||||
callback: () => {
|
||||
useGameProps.setState({ mode: 1 })
|
||||
|
@ -283,7 +283,7 @@ function EventBar({ clear }: { clear: () => void }) {
|
|||
setTargetPreview,
|
||||
router,
|
||||
reset,
|
||||
]
|
||||
],
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
// import Bluetooth from "./Bluetooth"
|
||||
// import FogImages from "./FogImages"
|
||||
import Labeling from "./Labeling"
|
||||
import Ships from "./Ships"
|
||||
import BorderTiles from "@components/Gamefield/BorderTiles"
|
||||
import EventBar from "@components/Gamefield/EventBar"
|
||||
import HitElems from "@components/Gamefield/HitElems"
|
||||
|
@ -14,9 +12,10 @@ import useSocket from "@hooks/useSocket"
|
|||
import { socket } from "@lib/socket"
|
||||
import { overlapsWithAnyBorder } from "@lib/utils/helpers"
|
||||
import { useRouter } from "next/router"
|
||||
import { CSSProperties } from "react"
|
||||
import { useEffect } from "react"
|
||||
import { CSSProperties, useEffect } from "react"
|
||||
import { toast } from "react-toastify"
|
||||
import Labeling from "./Labeling"
|
||||
import Ships from "./Ships"
|
||||
|
||||
export const count = 12
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { PointerProps } from "../../interfaces/frontend"
|
||||
import { faCrosshairs } from "@fortawesome/pro-solid-svg-icons"
|
||||
import { faRadar } from "@fortawesome/pro-thin-svg-icons"
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
|
||||
import classNames from "classnames"
|
||||
import { CSSProperties } from "react"
|
||||
import { PointerProps } from "../../interfaces/frontend"
|
||||
|
||||
function GamefieldPointer({
|
||||
props: { x, y, show, type, edges, imply },
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { Hit } from "../../interfaces/frontend"
|
||||
import { faBurst, faXmark } from "@fortawesome/pro-solid-svg-icons"
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
|
||||
import useIndex from "@hooks/useIndex"
|
||||
import { CSSProperties } from "react"
|
||||
import { Hit } from "../../interfaces/frontend"
|
||||
|
||||
function HitElems({
|
||||
props,
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
import { ItemProps } from "../../interfaces/frontend"
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
|
||||
import { useDrawProps } from "@hooks/useDrawProps"
|
||||
import classNames from "classnames"
|
||||
import { enable } from "colors"
|
||||
import React, { CSSProperties, useEffect, useRef, useState } from "react"
|
||||
import { CSSProperties, useEffect, useRef, useState } from "react"
|
||||
import { HexColorPicker } from "react-colorful"
|
||||
import { ItemProps } from "../../interfaces/frontend"
|
||||
|
||||
function Item({
|
||||
props: { icon, text, amount, iconColor, disabled, enabled, callback },
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { Field } from "../../interfaces/frontend"
|
||||
import { count } from "./Gamefield"
|
||||
import { fieldIndex } from "@lib/utils/helpers"
|
||||
import classNames from "classnames"
|
||||
import { CSSProperties } from "react"
|
||||
import { Field } from "../../interfaces/frontend"
|
||||
import { count } from "./Gamefield"
|
||||
|
||||
function Labeling() {
|
||||
let elems: (Field & {
|
||||
|
@ -27,11 +27,11 @@ function Labeling() {
|
|||
x: count + 2,
|
||||
y: x + 2,
|
||||
orientation: "right",
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
elems = elems.sort(
|
||||
(a, b) => fieldIndex(count, a.x, a.y) - fieldIndex(count, b.x, b.y)
|
||||
(a, b) => fieldIndex(count, a.x, a.y) - fieldIndex(count, b.x, b.y),
|
||||
)
|
||||
return (
|
||||
<>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { ShipProps } from "../../interfaces/frontend"
|
||||
import classNames from "classnames"
|
||||
import React, { CSSProperties, useEffect, useRef } from "react"
|
||||
import { CSSProperties, useEffect, useRef } from "react"
|
||||
import { ShipProps } from "../../interfaces/frontend"
|
||||
|
||||
const sizes: { [n: number]: number } = {
|
||||
2: 96,
|
||||
|
|
|
@ -1,15 +1,11 @@
|
|||
import Ship from "./Ship"
|
||||
import useIndex from "@hooks/useIndex"
|
||||
import Ship from "./Ship"
|
||||
|
||||
function Ships() {
|
||||
const { selfUser } = useIndex()
|
||||
|
||||
return (
|
||||
<>
|
||||
{selfUser?.ships.map((props, i) => (
|
||||
<Ship key={i} props={props} />
|
||||
))}
|
||||
</>
|
||||
<>{selfUser?.ships.map((props, i) => <Ship key={i} props={props} />)}</>
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
import GamefieldPointer from "./GamefieldPointer"
|
||||
import HitElems from "./HitElems"
|
||||
import Ship from "./Ship"
|
||||
import { useGameProps } from "@hooks/useGameProps"
|
||||
import useIndex from "@hooks/useIndex"
|
||||
import useShips from "@hooks/useShips"
|
||||
|
@ -9,6 +6,9 @@ import {
|
|||
intersectingShip,
|
||||
shipProps,
|
||||
} from "@lib/utils/helpers"
|
||||
import GamefieldPointer from "./GamefieldPointer"
|
||||
import HitElems from "./HitElems"
|
||||
import Ship from "./Ship"
|
||||
|
||||
function Targets() {
|
||||
const { activeUser } = useIndex()
|
||||
|
@ -20,12 +20,12 @@ function Targets() {
|
|||
<>
|
||||
{[
|
||||
...composeTargetTiles(target, mode, activeUser?.hits ?? []).map(
|
||||
(props, i) => <GamefieldPointer key={"t" + i} props={props} />
|
||||
(props, i) => <GamefieldPointer key={"t" + i} props={props} />,
|
||||
),
|
||||
...composeTargetTiles(
|
||||
targetPreview,
|
||||
mode,
|
||||
activeUser?.hits ?? []
|
||||
activeUser?.hits ?? [],
|
||||
).map((props, i) => (
|
||||
<GamefieldPointer key={"p" + i} props={props} preview />
|
||||
)),
|
||||
|
|
|
@ -71,10 +71,13 @@ function Grid() {
|
|||
pos(params.columns, params.rows),
|
||||
]
|
||||
|
||||
setTimeout(() => {
|
||||
setTimeout(
|
||||
() => {
|
||||
setActve(false)
|
||||
setCount((e) => e + 1)
|
||||
}, Math.max(...diagonals) * 1000 + 300)
|
||||
},
|
||||
Math.max(...diagonals) * 1000 + 300,
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
|
@ -100,7 +103,7 @@ function Grid() {
|
|||
}
|
||||
>
|
||||
{Array.from(Array(params.quantity), (_tile, index) =>
|
||||
createTile(index)
|
||||
createTile(index),
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
|
|
|
@ -72,10 +72,13 @@ function Grid2() {
|
|||
pos(params.columns, params.rows),
|
||||
]
|
||||
|
||||
setTimeout(() => {
|
||||
setTimeout(
|
||||
() => {
|
||||
setAction(false)
|
||||
if (active) setCount((e) => e + 1)
|
||||
}, Math.max(...diagonals) * 1000 + 1000)
|
||||
},
|
||||
Math.max(...diagonals) * 1000 + 1000,
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
|
@ -106,7 +109,7 @@ function Grid2() {
|
|||
</h1>
|
||||
</div>
|
||||
{Array.from(Array(params.quantity), (_tile, index) =>
|
||||
createTile(index)
|
||||
createTile(index),
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import classNames from "classnames"
|
||||
import React from "react"
|
||||
import { ReactNode } from "react"
|
||||
|
||||
function Button({
|
||||
|
@ -34,7 +33,7 @@ function Button({
|
|||
"border-orange-400 bg-warn": type === "orange",
|
||||
"border-green-600 bg-green-500": type === "green",
|
||||
"border-gray-600 bg-gray-500": type === "gray",
|
||||
}
|
||||
},
|
||||
)}
|
||||
onClick={onClick}
|
||||
>
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
import Button from "./Button"
|
||||
import Icon from "./Icon"
|
||||
import Player from "./Player"
|
||||
import {
|
||||
faRightFromBracket,
|
||||
faSpinnerThird,
|
||||
|
@ -12,6 +9,9 @@ import { socket } from "@lib/socket"
|
|||
import { useSession } from "next-auth/react"
|
||||
import { useRouter } from "next/router"
|
||||
import { Fragment, ReactNode, useEffect, useMemo, useState } from "react"
|
||||
import Button from "./Button"
|
||||
import Icon from "./Icon"
|
||||
import Player from "./Player"
|
||||
|
||||
function WithDots({ children }: { children: ReactNode }) {
|
||||
const [dots, setDots] = useState(1)
|
||||
|
@ -43,7 +43,7 @@ function LobbyFrame({ openSettings }: { openSettings: () => void }) {
|
|||
() =>
|
||||
payload?.users.length === 2 &&
|
||||
!userStates.filter((user) => !user.isReady).length,
|
||||
[payload?.users.length, userStates]
|
||||
[payload?.users.length, userStates],
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import Button from "./Button"
|
||||
import {
|
||||
faCheck,
|
||||
faHandPointer,
|
||||
|
@ -13,6 +12,7 @@ import { useGameProps } from "@hooks/useGameProps"
|
|||
import { socket } from "@lib/socket"
|
||||
import classNames from "classnames"
|
||||
import { CSSProperties, useEffect, useMemo, useState } from "react"
|
||||
import Button from "./Button"
|
||||
|
||||
function HourGlass() {
|
||||
const [count, setCount] = useState(3)
|
||||
|
@ -56,7 +56,7 @@ function Player({
|
|||
const { isReady, isConnected } = useMemo(() => userStates[i], [i, userStates])
|
||||
const primary = useMemo(
|
||||
() => userId && userId === payload?.users[i]?.id,
|
||||
[i, payload?.users, userId]
|
||||
[i, payload?.users, userId],
|
||||
)
|
||||
|
||||
return (
|
||||
|
@ -64,7 +64,7 @@ function Player({
|
|||
<p
|
||||
className={classNames(
|
||||
"font-farro w-max text-5xl",
|
||||
primary ? "font-semibold" : "font-normal"
|
||||
primary ? "font-semibold" : "font-normal",
|
||||
)}
|
||||
>
|
||||
{player?.name ?? "Spieler " + (player?.index === 2 ? "2" : "1")}
|
||||
|
|
|
@ -37,7 +37,7 @@ function Setting({
|
|||
state ? "text-blue-500" : "text-gray-800",
|
||||
{
|
||||
"bg-gray-300 ": state,
|
||||
}
|
||||
},
|
||||
)}
|
||||
size="3x"
|
||||
icon={state ? faToggleLargeOn : faToggleLargeOff}
|
||||
|
@ -53,7 +53,7 @@ function Setting({
|
|||
[prop]: !state,
|
||||
},
|
||||
setSetting,
|
||||
full
|
||||
full,
|
||||
)
|
||||
}
|
||||
hidden={true}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import Setting, { GameSettings } from "./Setting"
|
||||
import { faRotateLeft } from "@fortawesome/pro-regular-svg-icons"
|
||||
import { faXmark } from "@fortawesome/pro-solid-svg-icons"
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
|
||||
import { useGameProps } from "@hooks/useGameProps"
|
||||
import { socket } from "@lib/socket"
|
||||
import { useCallback } from "react"
|
||||
import Setting, { GameSettings } from "./Setting"
|
||||
|
||||
function Settings({ closeSettings }: { closeSettings: () => void }) {
|
||||
const { setSetting, full } = useGameProps()
|
||||
|
@ -18,7 +18,7 @@ function Settings({ closeSettings }: { closeSettings: () => void }) {
|
|||
socket.emit("update", full)
|
||||
})
|
||||
},
|
||||
[full, setSetting]
|
||||
[full, setSetting],
|
||||
)
|
||||
|
||||
return (
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import classNames from "classnames"
|
||||
import React from "react"
|
||||
|
||||
function Logo({ small }: { small?: boolean }) {
|
||||
return (
|
||||
|
@ -7,7 +6,7 @@ function Logo({ small }: { small?: boolean }) {
|
|||
<h1
|
||||
className={classNames(
|
||||
"font-checkpoint mx-16 my-2 flex flex-col gap-2 border-y-2 border-slate-700 text-center text-2xl leading-tight tracking-widest sm:mx-24 sm:my-3 sm:gap-3 sm:border-y-[3px] sm:text-4xl md:mx-36 md:my-4 md:gap-4 md:border-y-4 md:text-5xl",
|
||||
{ "xl:gap-6 xl:py-2 xl:text-6xl": !small }
|
||||
{ "xl:gap-6 xl:py-2 xl:text-6xl": !small },
|
||||
)}
|
||||
>
|
||||
<span>Leaky</span>
|
||||
|
@ -67,14 +66,14 @@ function Screw({
|
|||
className={classNames(
|
||||
"absolute flex h-3 w-3 flex-col items-center justify-center rounded-full border-[1px] border-neutral-700 bg-neutral-400 sm:h-5 sm:w-5 sm:border-2 md:h-6 md:w-6",
|
||||
{ "xl:h-8 xl:w-8": !small },
|
||||
orientation
|
||||
orientation,
|
||||
)}
|
||||
>
|
||||
<hr
|
||||
className={classNames(
|
||||
"color w-full border-neutral-500 sm:border-t-2",
|
||||
{ "xl:border-t-4": !small },
|
||||
rotation
|
||||
rotation,
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
|
|
|
@ -23,7 +23,7 @@ function OptionButton({
|
|||
"flex w-full flex-row items-center justify-between rounded-xl py-2 pl-8 pr-4 text-lg text-grayish duration-100 first:mt-4 last:mt-4 sm:py-4 sm:pl-16 sm:pr-8 sm:text-4xl sm:first:mt-8 sm:last:mt-8",
|
||||
!disabled
|
||||
? "border-b-4 border-shield-gray bg-voidDark active:border-b-0 active:border-t-4"
|
||||
: "border-4 border-dashed border-slate-600 bg-red-950"
|
||||
: "border-4 border-dashed border-slate-600 bg-red-950",
|
||||
)}
|
||||
onClick={() => callback && setTimeout(callback, 200)}
|
||||
disabled={disabled}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import React from "react"
|
||||
|
||||
function profileImg(src: string) {
|
||||
return (
|
||||
<img
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Draw, Point } from "../interfaces/frontend"
|
||||
import { useDrawProps } from "./useDrawProps"
|
||||
import { socket } from "@lib/socket"
|
||||
import { useEffect, useRef, useState } from "react"
|
||||
import { Draw, Point } from "../interfaces/frontend"
|
||||
import { useDrawProps } from "./useDrawProps"
|
||||
|
||||
function drawLine({ prevPoint, currentPoint, ctx, color }: Draw) {
|
||||
const { x: currX, y: currY } = currentPoint
|
||||
|
|
|
@ -27,7 +27,7 @@ export const useDrawProps = create<State & Action>()(
|
|||
set(
|
||||
produce((state) => {
|
||||
state.color = color
|
||||
})
|
||||
}),
|
||||
),
|
||||
reset: () => {
|
||||
set(initialState)
|
||||
|
@ -35,6 +35,6 @@ export const useDrawProps = create<State & Action>()(
|
|||
}),
|
||||
{
|
||||
name: "gameState",
|
||||
}
|
||||
)
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
@ -1,11 +1,3 @@
|
|||
import {
|
||||
MoveDispatchProps,
|
||||
EventBarModes,
|
||||
MouseCursor,
|
||||
ShipProps,
|
||||
Target,
|
||||
TargetPreview,
|
||||
} from "../interfaces/frontend"
|
||||
import { GameSettings } from "@components/Lobby/SettingsFrame/Setting"
|
||||
import { getPayloadwithChecksum } from "@lib/getPayloadwithChecksum"
|
||||
import { socket } from "@lib/socket"
|
||||
|
@ -27,6 +19,14 @@ import { SetStateAction } from "react"
|
|||
import { toast } from "react-toastify"
|
||||
import { create } from "zustand"
|
||||
import { devtools } from "zustand/middleware"
|
||||
import {
|
||||
EventBarModes,
|
||||
MouseCursor,
|
||||
MoveDispatchProps,
|
||||
ShipProps,
|
||||
Target,
|
||||
TargetPreview,
|
||||
} from "../interfaces/frontend"
|
||||
|
||||
const initialState: optionalGamePropsSchema & {
|
||||
userStates: {
|
||||
|
@ -88,7 +88,7 @@ export const useGameProps = create<State & Action>()(
|
|||
state.menu = "main"
|
||||
state.mode = -1
|
||||
}
|
||||
})
|
||||
}),
|
||||
),
|
||||
DispatchMove: (move, i) =>
|
||||
set(
|
||||
|
@ -108,12 +108,12 @@ export const useGameProps = create<State & Action>()(
|
|||
}).fields.length,
|
||||
x,
|
||||
y,
|
||||
}))
|
||||
})),
|
||||
)
|
||||
|
||||
return e
|
||||
})
|
||||
})
|
||||
}),
|
||||
),
|
||||
setTarget: (dispatch) =>
|
||||
set(
|
||||
|
@ -121,7 +121,7 @@ export const useGameProps = create<State & Action>()(
|
|||
if (typeof dispatch === "function")
|
||||
state.target = dispatch(state.target)
|
||||
else state.target = dispatch
|
||||
})
|
||||
}),
|
||||
),
|
||||
setTargetPreview: (dispatch) =>
|
||||
set(
|
||||
|
@ -129,7 +129,7 @@ export const useGameProps = create<State & Action>()(
|
|||
if (typeof dispatch === "function")
|
||||
state.targetPreview = dispatch(state.targetPreview)
|
||||
else state.targetPreview = dispatch
|
||||
})
|
||||
}),
|
||||
),
|
||||
setMouseCursor: (dispatch) =>
|
||||
set(
|
||||
|
@ -137,7 +137,7 @@ export const useGameProps = create<State & Action>()(
|
|||
if (typeof dispatch === "function")
|
||||
state.mouseCursor = dispatch(state.mouseCursor)
|
||||
else state.mouseCursor = dispatch
|
||||
})
|
||||
}),
|
||||
),
|
||||
setShips: (ships, index) =>
|
||||
set(
|
||||
|
@ -148,7 +148,7 @@ export const useGameProps = create<State & Action>()(
|
|||
e.ships = ships
|
||||
return e
|
||||
})
|
||||
})
|
||||
}),
|
||||
),
|
||||
removeShip: ({ size, variant, x, y }, index) =>
|
||||
set(
|
||||
|
@ -160,12 +160,12 @@ export const useGameProps = create<State & Action>()(
|
|||
ship.size === size &&
|
||||
ship.variant === variant &&
|
||||
ship.x === x &&
|
||||
ship.y === y
|
||||
ship.y === y,
|
||||
)
|
||||
e.ships.splice(indexToRemove, 1)
|
||||
return e
|
||||
})
|
||||
})
|
||||
}),
|
||||
),
|
||||
setPlayer: (payload) => {
|
||||
let hash: string | null = null
|
||||
|
@ -183,7 +183,7 @@ export const useGameProps = create<State & Action>()(
|
|||
}
|
||||
hash = body.hash
|
||||
state.hash = hash
|
||||
})
|
||||
}),
|
||||
)
|
||||
return hash
|
||||
},
|
||||
|
@ -203,7 +203,7 @@ export const useGameProps = create<State & Action>()(
|
|||
}
|
||||
hash = body.hash
|
||||
state.hash = hash
|
||||
})
|
||||
}),
|
||||
)
|
||||
return hash
|
||||
},
|
||||
|
@ -221,7 +221,7 @@ export const useGameProps = create<State & Action>()(
|
|||
console.warn(
|
||||
"Different gameId detected on update: ",
|
||||
state.payload?.game?.id,
|
||||
newGameProps.payload?.game?.id
|
||||
newGameProps.payload?.game?.id,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -242,7 +242,7 @@ export const useGameProps = create<State & Action>()(
|
|||
produce((state: State) => {
|
||||
state.userStates[i].isReady = isReady
|
||||
state.userStates[i].isConnected = true
|
||||
})
|
||||
}),
|
||||
),
|
||||
gameState: (newState: GameState) =>
|
||||
set(
|
||||
|
@ -253,7 +253,7 @@ export const useGameProps = create<State & Action>()(
|
|||
...e,
|
||||
isReady: false,
|
||||
}))
|
||||
})
|
||||
}),
|
||||
),
|
||||
setIsConnected: ({ i, isConnected }) =>
|
||||
set(
|
||||
|
@ -261,7 +261,7 @@ export const useGameProps = create<State & Action>()(
|
|||
state.userStates[i].isConnected = isConnected
|
||||
if (isConnected) return
|
||||
state.userStates[i].isReady = false
|
||||
})
|
||||
}),
|
||||
),
|
||||
reset: () => {
|
||||
set(initialState)
|
||||
|
@ -269,6 +269,6 @@ export const useGameProps = create<State & Action>()(
|
|||
}),
|
||||
{
|
||||
name: "gameState",
|
||||
}
|
||||
)
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { useGameProps } from "./useGameProps"
|
||||
import { useSession } from "next-auth/react"
|
||||
import { useGameProps } from "./useGameProps"
|
||||
|
||||
function useIndex() {
|
||||
const { payload } = useGameProps()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { useCallback, useMemo } from "react"
|
||||
import { ShipProps } from "../interfaces/frontend"
|
||||
import { useGameProps } from "./useGameProps"
|
||||
import useIndex from "./useIndex"
|
||||
import { useCallback, useMemo } from "react"
|
||||
|
||||
function useShips() {
|
||||
const gameProps = useGameProps()
|
||||
|
@ -10,15 +10,15 @@ function useShips() {
|
|||
const ships = useMemo(
|
||||
() =>
|
||||
gameProps.payload?.users.find((e) => e?.index === selfIndex)?.ships ?? [],
|
||||
[gameProps.payload?.users, selfIndex]
|
||||
[gameProps.payload?.users, selfIndex],
|
||||
)
|
||||
const setShips = useCallback(
|
||||
(ships: ShipProps[]) => gameProps.setShips(ships, selfIndex),
|
||||
[gameProps, selfIndex]
|
||||
[gameProps, selfIndex],
|
||||
)
|
||||
const removeShip = useCallback(
|
||||
(ship: ShipProps) => gameProps.removeShip(ship, selfIndex),
|
||||
[gameProps, selfIndex]
|
||||
[gameProps, selfIndex],
|
||||
)
|
||||
|
||||
return { ships, setShips, removeShip }
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import { isAuthenticated } from "../pages/start"
|
||||
import { useGameProps } from "./useGameProps"
|
||||
import useIndex from "./useIndex"
|
||||
import { socket } from "@lib/socket"
|
||||
import { GamePropsSchema } from "@lib/zodSchemas"
|
||||
import status from "http-status"
|
||||
import { useRouter } from "next/router"
|
||||
import { useEffect, useMemo, useState } from "react"
|
||||
import { toast } from "react-toastify"
|
||||
import { isAuthenticated } from "../pages/start"
|
||||
import { useGameProps } from "./useGameProps"
|
||||
import useIndex from "./useIndex"
|
||||
|
||||
/** This function should only be called once per page, otherwise there will be multiple socket connections and duplicate event listeners. */
|
||||
function useSocket() {
|
||||
|
@ -30,7 +30,7 @@ function useSocket() {
|
|||
const isConnected = useMemo(
|
||||
() =>
|
||||
selfIndex >= 0 ? userStates[selfIndex].isConnected : isConnectedState,
|
||||
[selfIndex, isConnectedState, userStates]
|
||||
[selfIndex, isConnectedState, userStates],
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { MoveDispatchProps, DrawLineProps, ShipProps } from "./frontend"
|
||||
import { GameSettings } from "@components/Lobby/SettingsFrame/Setting"
|
||||
import { GamePropsSchema, PlayerSchema } from "@lib/zodSchemas"
|
||||
import { GameState } from "@prisma/client"
|
||||
|
@ -12,6 +11,7 @@ import type {
|
|||
Socket as SocketforServer,
|
||||
} from "socket.io"
|
||||
import type { Socket as SocketforClient } from "socket.io-client"
|
||||
import { DrawLineProps, MoveDispatchProps, ShipProps } from "./frontend"
|
||||
|
||||
interface SocketServer extends HTTPServer {
|
||||
io?: IOServer
|
||||
|
@ -41,7 +41,7 @@ export interface ServerToClientEvents {
|
|||
| {
|
||||
type: "disconnect"
|
||||
i: number
|
||||
}
|
||||
},
|
||||
) => void
|
||||
isReady: (payload: { i: number; isReady: boolean }) => void
|
||||
isConnected: (payload: { i: number; isConnected: boolean }) => void
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import sendError from "./sendError"
|
||||
import { NextApiRequest, NextApiResponse } from "next"
|
||||
import { z } from "zod"
|
||||
import sendError from "./sendError"
|
||||
|
||||
const pinBodySchema = z.object({
|
||||
pin: z.string(),
|
||||
|
|
|
@ -39,7 +39,7 @@ async function logStartup() {
|
|||
async function logging(
|
||||
message: string,
|
||||
types: Logging[],
|
||||
req?: NextApiRequest | IncomingMessage
|
||||
req?: NextApiRequest | IncomingMessage,
|
||||
) {
|
||||
if (!started) await logStartup()
|
||||
const messages = { console: message, file: message }
|
||||
|
@ -60,7 +60,7 @@ async function logging(
|
|||
const ip = (forwardedFor || "127.0.0.1, 192.168.178.1").split(",")
|
||||
const route = req.url
|
||||
messages.console = [ip[0].yellow, route?.green, messages.console].join(
|
||||
" - "
|
||||
" - ",
|
||||
)
|
||||
messages.file = [ip[0], route, messages.file].join(" - ")
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import type { NextApiRequest, NextApiResponse } from "next"
|
||||
import { rejectionError } from "./errors"
|
||||
import logging from "./logging"
|
||||
import type { NextApiRequest, NextApiResponse } from "next"
|
||||
|
||||
export default function sendError<T>(
|
||||
req: NextApiRequest,
|
||||
res: NextApiResponse<T>,
|
||||
err: rejectionError | Error
|
||||
err: rejectionError | Error,
|
||||
) {
|
||||
// If something went wrong, let the client know with status 500
|
||||
res.status("statusCode" in err ? err.statusCode : 500).end()
|
||||
|
@ -14,7 +14,7 @@ export default function sendError<T>(
|
|||
"type" in err && err.type
|
||||
? err.type
|
||||
: ["solved" in err && err.solved ? "debug" : "error"],
|
||||
req
|
||||
req,
|
||||
)
|
||||
if ("name" in err) console.log(err)
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import logging, { Logging } from "./logging"
|
||||
import { NextApiRequest, NextApiResponse } from "next"
|
||||
import logging, { Logging } from "./logging"
|
||||
|
||||
export interface Result<T> {
|
||||
message: string
|
||||
|
@ -12,7 +12,7 @@ export interface Result<T> {
|
|||
export default function sendResponse<T>(
|
||||
req: NextApiRequest,
|
||||
res: NextApiResponse<T>,
|
||||
result: Result<T>
|
||||
result: Result<T>,
|
||||
) {
|
||||
if (result.redirectUrl) {
|
||||
res.redirect(result.statusCode ?? 307, result.redirectUrl)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { GamePropsSchema } from "./zodSchemas"
|
||||
import crypto from "crypto"
|
||||
import { GamePropsSchema } from "./zodSchemas"
|
||||
|
||||
export function getPayloadwithChecksum(
|
||||
payload: GamePropsSchema["payload"]
|
||||
payload: GamePropsSchema["payload"],
|
||||
): GamePropsSchema {
|
||||
const objString = JSON.stringify(payload)
|
||||
const hash = crypto.createHash("md5").update(objString).digest("hex")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { cSocket } from "../interfaces/NextApiSocket"
|
||||
import { io } from "socket.io-client"
|
||||
import { cSocket } from "../interfaces/NextApiSocket"
|
||||
|
||||
export const socket: cSocket = io({
|
||||
path: "/api/ws",
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { count } from "@components/Gamefield/Gamefield"
|
||||
import { Orientation } from "@prisma/client"
|
||||
import type {
|
||||
Hit,
|
||||
IndexedPosition,
|
||||
|
@ -8,8 +10,6 @@ import type {
|
|||
Target,
|
||||
TargetList,
|
||||
} from "../../interfaces/frontend"
|
||||
import { count } from "@components/Gamefield/Gamefield"
|
||||
import { Orientation } from "@prisma/client"
|
||||
|
||||
export function borderCN(count: number, x: number, y: number) {
|
||||
if (x === 0) return "left"
|
||||
|
@ -58,7 +58,7 @@ export function isAlreadyHit(x: number, y: number, hits: Hit[]) {
|
|||
|
||||
export function targetList(
|
||||
{ x: targetX, y: targetY }: Position,
|
||||
modeInput: number | string
|
||||
modeInput: number | string,
|
||||
): TargetList[] {
|
||||
const mode =
|
||||
typeof modeInput === "number"
|
||||
|
@ -98,7 +98,7 @@ export function overlapsWithAnyBorder(target: Position, mode: number) {
|
|||
export function composeTargetTiles(
|
||||
target: Target,
|
||||
mode: number,
|
||||
hits: Hit[]
|
||||
hits: Hit[],
|
||||
): PointerProps[] {
|
||||
const { show } = target
|
||||
return targetList(target, mode).map((targetItem) => {
|
||||
|
@ -132,7 +132,7 @@ export const initlialMouseCursor = {
|
|||
export const shipProps = (
|
||||
ships: ShipProps[],
|
||||
mode: number,
|
||||
targetPreview: Position & { orientation: Orientation }
|
||||
targetPreview: Position & { orientation: Orientation },
|
||||
) => ({
|
||||
size: mode + 2,
|
||||
variant:
|
||||
|
@ -190,7 +190,7 @@ export function shipFields(ship: ShipProps, i?: number) {
|
|||
export function intersectingShip(
|
||||
ships: ShipProps[],
|
||||
ship: ShipProps,
|
||||
withBorder?: boolean
|
||||
withBorder?: boolean,
|
||||
) {
|
||||
const thisShip = shipFields(ship)
|
||||
const reducedShips = ships.reduce(
|
||||
|
@ -201,17 +201,17 @@ export function intersectingShip(
|
|||
borders: [...prev.borders, ...borders],
|
||||
}
|
||||
},
|
||||
{ fields: [] as IndexedPosition[], borders: [] as IndexedPosition[] }
|
||||
{ fields: [] as IndexedPosition[], borders: [] as IndexedPosition[] },
|
||||
)
|
||||
const fields = reducedShips.fields.filter(
|
||||
(e) => thisShip.fields.filter((e2) => e2.x === e.x && e2.y === e.y).length
|
||||
(e) => thisShip.fields.filter((e2) => e2.x === e.x && e2.y === e.y).length,
|
||||
)
|
||||
const borders = thisShip.fields.filter(
|
||||
(e) =>
|
||||
reducedShips.borders.filter((e2) => e2.x === e.x && e2.y === e.y).length
|
||||
reducedShips.borders.filter((e2) => e2.x === e.x && e2.y === e.y).length,
|
||||
)
|
||||
const isInBorder = thisShip.fields.filter(
|
||||
(e) => withBorder && isBorder(e.x, e.y)
|
||||
(e) => withBorder && isBorder(e.x, e.y),
|
||||
)
|
||||
return {
|
||||
score: isInBorder.length ? 2 : fields.length || borders.length ? 1 : 0,
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import "../styles/App.scss"
|
||||
import "../styles/globals.scss"
|
||||
import "../styles/grid2.scss"
|
||||
import "../styles/grid.scss"
|
||||
import "@fortawesome/fontawesome-svg-core/styles.css"
|
||||
import { SessionProvider } from "next-auth/react"
|
||||
import type { AppProps } from "next/app"
|
||||
import { ToastContainer } from "react-toastify"
|
||||
import "react-toastify/dist/ReactToastify.css"
|
||||
import "../styles/App.scss"
|
||||
import "../styles/globals.scss"
|
||||
import "../styles/grid.scss"
|
||||
import "../styles/grid2.scss"
|
||||
|
||||
export default function App({
|
||||
Component,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Html, Head, Main, NextScript } from "next/document"
|
||||
import { Head, Html, Main, NextScript } from "next/document"
|
||||
|
||||
export default function Document() {
|
||||
return (
|
||||
|
|
|
@ -5,10 +5,10 @@ import NextAuth, { NextAuthOptions } from "next-auth"
|
|||
import AzureADProvider from "next-auth/providers/azure-ad"
|
||||
import EmailProvider from "next-auth/providers/email"
|
||||
import {
|
||||
uniqueNamesGenerator,
|
||||
Config,
|
||||
animals,
|
||||
Config,
|
||||
NumberDictionary,
|
||||
uniqueNamesGenerator,
|
||||
} from "unique-names-generator"
|
||||
|
||||
const numberDictionary = NumberDictionary.generate({ min: 0, max: 9999 })
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { authOptions } from "../auth/[...nextauth]"
|
||||
import { rejectionErrors } from "@lib/backend/errors"
|
||||
import sendResponse from "@lib/backend/sendResponse"
|
||||
import prisma from "@lib/prisma"
|
||||
import { Game } from "@prisma/client"
|
||||
import type { NextApiRequest, NextApiResponse } from "next"
|
||||
import { getServerSession } from "next-auth"
|
||||
import { authOptions } from "../auth/[...nextauth]"
|
||||
|
||||
interface Data {
|
||||
game: Game
|
||||
|
@ -12,7 +12,7 @@ interface Data {
|
|||
|
||||
export default async function id(
|
||||
req: NextApiRequest,
|
||||
res: NextApiResponse<Data>
|
||||
res: NextApiResponse<Data>,
|
||||
) {
|
||||
const gameId = req.query.id
|
||||
const session = await getServerSession(req, res, authOptions)
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
import { authOptions } from "../auth/[...nextauth]"
|
||||
import { composeBody, gameSelects, getAnyRunningGame } from "./running"
|
||||
import sendResponse from "@backend/sendResponse"
|
||||
import { rejectionErrors } from "@lib/backend/errors"
|
||||
import prisma from "@lib/prisma"
|
||||
import { GamePropsSchema } from "@lib/zodSchemas"
|
||||
import type { NextApiRequest, NextApiResponse } from "next"
|
||||
import { getServerSession } from "next-auth"
|
||||
import { authOptions } from "../auth/[...nextauth]"
|
||||
import { composeBody, gameSelects, getAnyRunningGame } from "./running"
|
||||
|
||||
export default async function create(
|
||||
req: NextApiRequest,
|
||||
res: NextApiResponse<GamePropsSchema>
|
||||
res: NextApiResponse<GamePropsSchema>,
|
||||
) {
|
||||
const session = await getServerSession(req, res, authOptions)
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import { authOptions } from "../auth/[...nextauth]"
|
||||
import running, { composeBody, gameSelects } from "./running"
|
||||
import sendError from "@backend/sendError"
|
||||
import sendResponse from "@backend/sendResponse"
|
||||
import { rejectionErrors } from "@lib/backend/errors"
|
||||
|
@ -9,10 +7,12 @@ import prisma from "@lib/prisma"
|
|||
import { GamePropsSchema } from "@lib/zodSchemas"
|
||||
import type { NextApiRequest, NextApiResponse } from "next"
|
||||
import { getServerSession } from "next-auth"
|
||||
import { authOptions } from "../auth/[...nextauth]"
|
||||
import { composeBody, gameSelects } from "./running"
|
||||
|
||||
export default async function join(
|
||||
req: NextApiRequest,
|
||||
res: NextApiResponse<GamePropsSchema>
|
||||
res: NextApiResponse<GamePropsSchema>,
|
||||
) {
|
||||
const session = await getServerSession(req, res, authOptions)
|
||||
const pin = await getPinFromBody(req, res)
|
||||
|
@ -82,7 +82,7 @@ export default async function join(
|
|||
await logging(
|
||||
"HERE".red + err.code + err.meta + err.message,
|
||||
["error"],
|
||||
req
|
||||
req,
|
||||
)
|
||||
throw sendError(req, res, rejectionErrors.gameNotFound)
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { authOptions } from "../auth/[...nextauth]"
|
||||
import sendResponse from "@backend/sendResponse"
|
||||
import { rejectionErrors } from "@lib/backend/errors"
|
||||
import { getPayloadwithChecksum } from "@lib/getPayloadwithChecksum"
|
||||
|
@ -6,6 +5,7 @@ import prisma from "@lib/prisma"
|
|||
import { GamePropsSchema } from "@lib/zodSchemas"
|
||||
import type { NextApiRequest, NextApiResponse } from "next"
|
||||
import { getServerSession } from "next-auth"
|
||||
import { authOptions } from "../auth/[...nextauth]"
|
||||
|
||||
export const gameSelects = {
|
||||
select: {
|
||||
|
@ -99,7 +99,7 @@ export const getAnyRunningGame = (userId: string) => {
|
|||
}
|
||||
|
||||
export function composeBody(
|
||||
gameDB: NonNullable<Awaited<ReturnType<typeof getAnyRunningGame>>>
|
||||
gameDB: NonNullable<Awaited<ReturnType<typeof getAnyRunningGame>>>,
|
||||
): GamePropsSchema {
|
||||
const { gamePin, ...game } = gameDB
|
||||
const users = gameDB.users
|
||||
|
@ -125,7 +125,7 @@ export function composeBody(
|
|||
|
||||
export default async function running(
|
||||
req: NextApiRequest,
|
||||
res: NextApiResponse<GamePropsSchema>
|
||||
res: NextApiResponse<GamePropsSchema>,
|
||||
) {
|
||||
const session = await getServerSession(req, res, authOptions)
|
||||
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
import logging from "@lib/backend/logging"
|
||||
import prisma from "@lib/prisma"
|
||||
import { GamePropsSchema } from "@lib/zodSchemas"
|
||||
import colors from "colors"
|
||||
import status from "http-status"
|
||||
import { NextApiRequest } from "next"
|
||||
import { getSession } from "next-auth/react"
|
||||
import { Server } from "socket.io"
|
||||
import {
|
||||
NextApiResponseWithSocket,
|
||||
sServer,
|
||||
|
@ -8,20 +16,12 @@ import {
|
|||
getAnyGame,
|
||||
getAnyRunningGame,
|
||||
} from "./game/running"
|
||||
import logging from "@lib/backend/logging"
|
||||
import prisma from "@lib/prisma"
|
||||
import { GamePropsSchema } from "@lib/zodSchemas"
|
||||
import colors from "colors"
|
||||
import status from "http-status"
|
||||
import { NextApiRequest } from "next"
|
||||
import { getSession } from "next-auth/react"
|
||||
import { Server } from "socket.io"
|
||||
|
||||
colors.enable()
|
||||
|
||||
const SocketHandler = async (
|
||||
req: NextApiRequest,
|
||||
res: NextApiResponseWithSocket
|
||||
res: NextApiResponseWithSocket,
|
||||
) => {
|
||||
if (res.socket.server.io) {
|
||||
logging("Socket is already running " + req.url, ["infoCyan"], req)
|
||||
|
@ -51,7 +51,7 @@ const SocketHandler = async (
|
|||
"Forbidden, no game found: " +
|
||||
JSON.stringify(Array.from(socket.rooms)),
|
||||
["debug"],
|
||||
socket.request
|
||||
socket.request,
|
||||
)
|
||||
return next(new Error(status["403"]))
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ const SocketHandler = async (
|
|||
const { payload, hash } = composeBody(game)
|
||||
// let index: number | null = null
|
||||
const index = payload.users.findIndex(
|
||||
(user) => socket.data.user?.id === user?.id
|
||||
(user) => socket.data.user?.id === user?.id,
|
||||
)
|
||||
if (index < 0) return next(new Error(status["401"]))
|
||||
socket.data.index = index
|
||||
|
@ -85,7 +85,7 @@ const SocketHandler = async (
|
|||
", " +
|
||||
socket.id.cyan,
|
||||
["infoGreen"],
|
||||
socket.request
|
||||
socket.request,
|
||||
)
|
||||
|
||||
socket.on("update", async (cb) => {
|
||||
|
@ -196,7 +196,7 @@ const SocketHandler = async (
|
|||
.emit(
|
||||
"draw-line",
|
||||
{ prevPoint, currentPoint, color },
|
||||
socket.data.index
|
||||
socket.data.index,
|
||||
)
|
||||
})
|
||||
|
||||
|
@ -279,7 +279,7 @@ const SocketHandler = async (
|
|||
logging(
|
||||
"Disconnecting: " + JSON.stringify(Array.from(socket.rooms)),
|
||||
["debug"],
|
||||
socket.request
|
||||
socket.request,
|
||||
)
|
||||
if (socket.data.index === undefined || !socket.data.gameId) return
|
||||
socket.to(socket.data.gameId).emit("playerEvent", {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { useGameProps } from "@hooks/useGameProps"
|
||||
import { useSession } from "next-auth/react"
|
||||
import { useRouter } from "next/router"
|
||||
import React, { useEffect } from "react"
|
||||
import { useEffect } from "react"
|
||||
import { toast } from "react-toastify"
|
||||
|
||||
export default function Game() {
|
||||
|
|
|
@ -26,7 +26,7 @@ export default function Lobby() {
|
|||
<div
|
||||
className={classNames(
|
||||
"mx-auto flex h-full max-w-screen-2xl flex-col items-center justify-evenly",
|
||||
{ "blur-sm": settings }
|
||||
{ "blur-sm": settings },
|
||||
)}
|
||||
>
|
||||
<Logo small={true} />
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { signOut, useSession } from "next-auth/react"
|
||||
import { useRouter } from "next/router"
|
||||
import React, { useEffect } from "react"
|
||||
import { useEffect } from "react"
|
||||
|
||||
function Logout() {
|
||||
const { status } = useSession()
|
||||
|
|
|
@ -11,8 +11,7 @@ import { useSession } from "next-auth/react"
|
|||
import { useRouter } from "next/router"
|
||||
import { useCallback, useEffect, useMemo, useState } from "react"
|
||||
import OtpInput from "react-otp-input"
|
||||
import { toast } from "react-toastify"
|
||||
import { Icons } from "react-toastify"
|
||||
import { Icons, toast } from "react-toastify"
|
||||
|
||||
export function isAuthenticated(res: Response) {
|
||||
switch (status[`${res.status}_CLASS`]) {
|
||||
|
@ -40,7 +39,7 @@ const handleConfirmation = () => {
|
|||
or
|
||||
<button onClick={() => toast.dismiss(toastId)}>Leave</button>
|
||||
</div>,
|
||||
{ autoClose: false, toastId }
|
||||
{ autoClose: false, toastId },
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -68,7 +67,7 @@ export default function Start() {
|
|||
{
|
||||
method: "POST",
|
||||
body: JSON.stringify({ pin }),
|
||||
}
|
||||
},
|
||||
)
|
||||
.then(isAuthenticated)
|
||||
.then((game) => GamePropsSchema.parse(game))
|
||||
|
@ -91,7 +90,7 @@ export default function Start() {
|
|||
autoClose: 5000,
|
||||
hideProgressBar: false,
|
||||
closeButton: true,
|
||||
})
|
||||
}),
|
||||
)
|
||||
if (!res) return
|
||||
full(res)
|
||||
|
@ -110,7 +109,7 @@ export default function Start() {
|
|||
autoClose: 5000,
|
||||
hideProgressBar: false,
|
||||
closeButton: true,
|
||||
})
|
||||
}),
|
||||
)
|
||||
.catch(() =>
|
||||
toast.update(toastId, {
|
||||
|
@ -121,10 +120,10 @@ export default function Start() {
|
|||
autoClose: 5000,
|
||||
hideProgressBar: false,
|
||||
closeButton: true,
|
||||
})
|
||||
}),
|
||||
)
|
||||
},
|
||||
[router, full]
|
||||
[router, full],
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
@ -10,33 +10,35 @@ import type { Prisma } from '@prisma/client';
|
|||
// ENUMS
|
||||
/////////////////////////////////////////
|
||||
|
||||
export const TransactionIsolationLevelSchema = z.enum(['ReadUncommitted','ReadCommitted','RepeatableRead','Serializable']);
|
||||
|
||||
export const AccountScalarFieldEnumSchema = z.enum(['id','userId','type','provider','providerAccountId','refresh_token','access_token','expires_at','ext_expires_in','token_type','scope','id_token','session_state','oauth_token_secret','oauth_token']);
|
||||
|
||||
export const ChatScalarFieldEnumSchema = z.enum(['id','createdAt','message','event','user_game_id']);
|
||||
export const SessionScalarFieldEnumSchema = z.enum(['id','sessionToken','userId','expires']);
|
||||
|
||||
export const UserScalarFieldEnumSchema = z.enum(['id','name','email','emailVerified','image','createdAt','updatedAt']);
|
||||
|
||||
export const VerificationTokenScalarFieldEnumSchema = z.enum(['identifier','token','expires']);
|
||||
|
||||
export const GameScalarFieldEnumSchema = z.enum(['id','createdAt','updatedAt','state','allowSpectators','allowSpecials','allowChat','allowMarkDraw']);
|
||||
|
||||
export const GamepinScalarFieldEnumSchema = z.enum(['id','createdAt','pin','gameId']);
|
||||
|
||||
export const HitScalarFieldEnumSchema = z.enum(['id','x','y','hit','user_GameId']);
|
||||
|
||||
export const MoveScalarFieldEnumSchema = z.enum(['id','createdAt','index','type','x','y','orientation','user_game_id']);
|
||||
|
||||
export const QueryModeSchema = z.enum(['default','insensitive']);
|
||||
|
||||
export const SessionScalarFieldEnumSchema = z.enum(['id','sessionToken','userId','expires']);
|
||||
|
||||
export const ShipScalarFieldEnumSchema = z.enum(['id','size','variant','x','y','orientation','user_GameId']);
|
||||
|
||||
export const SortOrderSchema = z.enum(['asc','desc']);
|
||||
|
||||
export const TransactionIsolationLevelSchema = z.enum(['ReadUncommitted','ReadCommitted','RepeatableRead','Serializable']);
|
||||
|
||||
export const UserScalarFieldEnumSchema = z.enum(['id','name','email','emailVerified','image','createdAt','updatedAt']);
|
||||
export const HitScalarFieldEnumSchema = z.enum(['id','x','y','hit','user_GameId']);
|
||||
|
||||
export const User_GameScalarFieldEnumSchema = z.enum(['id','createdAt','gameId','userId','index']);
|
||||
|
||||
export const VerificationTokenScalarFieldEnumSchema = z.enum(['identifier','token','expires']);
|
||||
export const MoveScalarFieldEnumSchema = z.enum(['id','createdAt','index','type','x','y','orientation','user_game_id']);
|
||||
|
||||
export const ChatScalarFieldEnumSchema = z.enum(['id','createdAt','message','event','user_game_id']);
|
||||
|
||||
export const SortOrderSchema = z.enum(['asc','desc']);
|
||||
|
||||
export const QueryModeSchema = z.enum(['default','insensitive']);
|
||||
|
||||
export const NullsOrderSchema = z.enum(['first','last']);
|
||||
|
||||
export const GameStateSchema = z.enum(['lobby','starting','running','ended','aborted']);
|
||||
|
||||
|
@ -549,16 +551,16 @@ export const AccountOrderByWithRelationInputSchema: z.ZodType<Prisma.AccountOrde
|
|||
type: z.lazy(() => SortOrderSchema).optional(),
|
||||
provider: z.lazy(() => SortOrderSchema).optional(),
|
||||
providerAccountId: z.lazy(() => SortOrderSchema).optional(),
|
||||
refresh_token: z.lazy(() => SortOrderSchema).optional(),
|
||||
access_token: z.lazy(() => SortOrderSchema).optional(),
|
||||
expires_at: z.lazy(() => SortOrderSchema).optional(),
|
||||
ext_expires_in: z.lazy(() => SortOrderSchema).optional(),
|
||||
token_type: z.lazy(() => SortOrderSchema).optional(),
|
||||
scope: z.lazy(() => SortOrderSchema).optional(),
|
||||
id_token: z.lazy(() => SortOrderSchema).optional(),
|
||||
session_state: z.lazy(() => SortOrderSchema).optional(),
|
||||
oauth_token_secret: z.lazy(() => SortOrderSchema).optional(),
|
||||
oauth_token: z.lazy(() => SortOrderSchema).optional(),
|
||||
refresh_token: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
|
||||
access_token: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
|
||||
expires_at: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
|
||||
ext_expires_in: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
|
||||
token_type: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
|
||||
scope: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
|
||||
id_token: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
|
||||
session_state: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
|
||||
oauth_token_secret: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
|
||||
oauth_token: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
|
||||
user: z.lazy(() => UserOrderByWithRelationInputSchema).optional()
|
||||
}).strict();
|
||||
|
||||
|
@ -573,16 +575,16 @@ export const AccountOrderByWithAggregationInputSchema: z.ZodType<Prisma.AccountO
|
|||
type: z.lazy(() => SortOrderSchema).optional(),
|
||||
provider: z.lazy(() => SortOrderSchema).optional(),
|
||||
providerAccountId: z.lazy(() => SortOrderSchema).optional(),
|
||||
refresh_token: z.lazy(() => SortOrderSchema).optional(),
|
||||
access_token: z.lazy(() => SortOrderSchema).optional(),
|
||||
expires_at: z.lazy(() => SortOrderSchema).optional(),
|
||||
ext_expires_in: z.lazy(() => SortOrderSchema).optional(),
|
||||
token_type: z.lazy(() => SortOrderSchema).optional(),
|
||||
scope: z.lazy(() => SortOrderSchema).optional(),
|
||||
id_token: z.lazy(() => SortOrderSchema).optional(),
|
||||
session_state: z.lazy(() => SortOrderSchema).optional(),
|
||||
oauth_token_secret: z.lazy(() => SortOrderSchema).optional(),
|
||||
oauth_token: z.lazy(() => SortOrderSchema).optional(),
|
||||
refresh_token: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
|
||||
access_token: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
|
||||
expires_at: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
|
||||
ext_expires_in: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
|
||||
token_type: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
|
||||
scope: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
|
||||
id_token: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
|
||||
session_state: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
|
||||
oauth_token_secret: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
|
||||
oauth_token: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
|
||||
_count: z.lazy(() => AccountCountOrderByAggregateInputSchema).optional(),
|
||||
_avg: z.lazy(() => AccountAvgOrderByAggregateInputSchema).optional(),
|
||||
_max: z.lazy(() => AccountMaxOrderByAggregateInputSchema).optional(),
|
||||
|
@ -673,10 +675,10 @@ export const UserWhereInputSchema: z.ZodType<Prisma.UserWhereInput> = z.object({
|
|||
|
||||
export const UserOrderByWithRelationInputSchema: z.ZodType<Prisma.UserOrderByWithRelationInput> = z.object({
|
||||
id: z.lazy(() => SortOrderSchema).optional(),
|
||||
name: z.lazy(() => SortOrderSchema).optional(),
|
||||
email: z.lazy(() => SortOrderSchema).optional(),
|
||||
emailVerified: z.lazy(() => SortOrderSchema).optional(),
|
||||
image: z.lazy(() => SortOrderSchema).optional(),
|
||||
name: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
|
||||
email: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
|
||||
emailVerified: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
|
||||
image: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
|
||||
createdAt: z.lazy(() => SortOrderSchema).optional(),
|
||||
updatedAt: z.lazy(() => SortOrderSchema).optional(),
|
||||
games: z.lazy(() => User_GameOrderByRelationAggregateInputSchema).optional(),
|
||||
|
@ -691,10 +693,10 @@ export const UserWhereUniqueInputSchema: z.ZodType<Prisma.UserWhereUniqueInput>
|
|||
|
||||
export const UserOrderByWithAggregationInputSchema: z.ZodType<Prisma.UserOrderByWithAggregationInput> = z.object({
|
||||
id: z.lazy(() => SortOrderSchema).optional(),
|
||||
name: z.lazy(() => SortOrderSchema).optional(),
|
||||
email: z.lazy(() => SortOrderSchema).optional(),
|
||||
emailVerified: z.lazy(() => SortOrderSchema).optional(),
|
||||
image: z.lazy(() => SortOrderSchema).optional(),
|
||||
name: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
|
||||
email: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
|
||||
emailVerified: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
|
||||
image: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
|
||||
createdAt: z.lazy(() => SortOrderSchema).optional(),
|
||||
updatedAt: z.lazy(() => SortOrderSchema).optional(),
|
||||
_count: z.lazy(() => UserCountOrderByAggregateInputSchema).optional(),
|
||||
|
@ -1102,8 +1104,8 @@ export const ChatWhereInputSchema: z.ZodType<Prisma.ChatWhereInput> = z.object({
|
|||
export const ChatOrderByWithRelationInputSchema: z.ZodType<Prisma.ChatOrderByWithRelationInput> = z.object({
|
||||
id: z.lazy(() => SortOrderSchema).optional(),
|
||||
createdAt: z.lazy(() => SortOrderSchema).optional(),
|
||||
message: z.lazy(() => SortOrderSchema).optional(),
|
||||
event: z.lazy(() => SortOrderSchema).optional(),
|
||||
message: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
|
||||
event: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
|
||||
user_game_id: z.lazy(() => SortOrderSchema).optional(),
|
||||
user_game: z.lazy(() => User_GameOrderByWithRelationInputSchema).optional()
|
||||
}).strict();
|
||||
|
@ -1115,8 +1117,8 @@ export const ChatWhereUniqueInputSchema: z.ZodType<Prisma.ChatWhereUniqueInput>
|
|||
export const ChatOrderByWithAggregationInputSchema: z.ZodType<Prisma.ChatOrderByWithAggregationInput> = z.object({
|
||||
id: z.lazy(() => SortOrderSchema).optional(),
|
||||
createdAt: z.lazy(() => SortOrderSchema).optional(),
|
||||
message: z.lazy(() => SortOrderSchema).optional(),
|
||||
event: z.lazy(() => SortOrderSchema).optional(),
|
||||
message: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
|
||||
event: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
|
||||
user_game_id: z.lazy(() => SortOrderSchema).optional(),
|
||||
_count: z.lazy(() => ChatCountOrderByAggregateInputSchema).optional(),
|
||||
_max: z.lazy(() => ChatMaxOrderByAggregateInputSchema).optional(),
|
||||
|
@ -1931,8 +1933,13 @@ export const IntNullableFilterSchema: z.ZodType<Prisma.IntNullableFilter> = z.ob
|
|||
}).strict();
|
||||
|
||||
export const UserRelationFilterSchema: z.ZodType<Prisma.UserRelationFilter> = z.object({
|
||||
is: z.lazy(() => UserWhereInputSchema).optional(),
|
||||
isNot: z.lazy(() => UserWhereInputSchema).optional()
|
||||
is: z.lazy(() => UserWhereInputSchema).optional().nullable(),
|
||||
isNot: z.lazy(() => UserWhereInputSchema).optional().nullable()
|
||||
}).strict();
|
||||
|
||||
export const SortOrderInputSchema: z.ZodType<Prisma.SortOrderInput> = z.object({
|
||||
sort: z.lazy(() => SortOrderSchema),
|
||||
nulls: z.lazy(() => NullsOrderSchema).optional()
|
||||
}).strict();
|
||||
|
||||
export const AccountProviderProviderAccountIdCompoundUniqueInputSchema: z.ZodType<Prisma.AccountProviderProviderAccountIdCompoundUniqueInput> = z.object({
|
||||
|
@ -2279,8 +2286,8 @@ export const BoolWithAggregatesFilterSchema: z.ZodType<Prisma.BoolWithAggregates
|
|||
}).strict();
|
||||
|
||||
export const GameRelationFilterSchema: z.ZodType<Prisma.GameRelationFilter> = z.object({
|
||||
is: z.lazy(() => GameWhereInputSchema).optional(),
|
||||
isNot: z.lazy(() => GameWhereInputSchema).optional()
|
||||
is: z.lazy(() => GameWhereInputSchema).optional().nullable(),
|
||||
isNot: z.lazy(() => GameWhereInputSchema).optional().nullable()
|
||||
}).strict();
|
||||
|
||||
export const GamepinCountOrderByAggregateInputSchema: z.ZodType<Prisma.GamepinCountOrderByAggregateInput> = z.object({
|
||||
|
@ -2323,8 +2330,8 @@ export const EnumOrientationFilterSchema: z.ZodType<Prisma.EnumOrientationFilter
|
|||
}).strict();
|
||||
|
||||
export const User_GameRelationFilterSchema: z.ZodType<Prisma.User_GameRelationFilter> = z.object({
|
||||
is: z.lazy(() => User_GameWhereInputSchema).optional(),
|
||||
isNot: z.lazy(() => User_GameWhereInputSchema).optional()
|
||||
is: z.lazy(() => User_GameWhereInputSchema).optional().nullable(),
|
||||
isNot: z.lazy(() => User_GameWhereInputSchema).optional().nullable()
|
||||
}).strict();
|
||||
|
||||
export const ShipCountOrderByAggregateInputSchema: z.ZodType<Prisma.ShipCountOrderByAggregateInput> = z.object({
|
||||
|
@ -4696,7 +4703,7 @@ export const AccountFindFirstArgsSchema: z.ZodType<Prisma.AccountFindFirstArgs>
|
|||
cursor: AccountWhereUniqueInputSchema.optional(),
|
||||
take: z.number().optional(),
|
||||
skip: z.number().optional(),
|
||||
distinct: AccountScalarFieldEnumSchema.array().optional(),
|
||||
distinct: z.union([ AccountScalarFieldEnumSchema,AccountScalarFieldEnumSchema.array() ]).optional(),
|
||||
}).strict()
|
||||
|
||||
export const AccountFindFirstOrThrowArgsSchema: z.ZodType<Prisma.AccountFindFirstOrThrowArgs> = z.object({
|
||||
|
@ -4707,7 +4714,7 @@ export const AccountFindFirstOrThrowArgsSchema: z.ZodType<Prisma.AccountFindFirs
|
|||
cursor: AccountWhereUniqueInputSchema.optional(),
|
||||
take: z.number().optional(),
|
||||
skip: z.number().optional(),
|
||||
distinct: AccountScalarFieldEnumSchema.array().optional(),
|
||||
distinct: z.union([ AccountScalarFieldEnumSchema,AccountScalarFieldEnumSchema.array() ]).optional(),
|
||||
}).strict()
|
||||
|
||||
export const AccountFindManyArgsSchema: z.ZodType<Prisma.AccountFindManyArgs> = z.object({
|
||||
|
@ -4718,7 +4725,7 @@ export const AccountFindManyArgsSchema: z.ZodType<Prisma.AccountFindManyArgs> =
|
|||
cursor: AccountWhereUniqueInputSchema.optional(),
|
||||
take: z.number().optional(),
|
||||
skip: z.number().optional(),
|
||||
distinct: AccountScalarFieldEnumSchema.array().optional(),
|
||||
distinct: z.union([ AccountScalarFieldEnumSchema,AccountScalarFieldEnumSchema.array() ]).optional(),
|
||||
}).strict()
|
||||
|
||||
export const AccountAggregateArgsSchema: z.ZodType<Prisma.AccountAggregateArgs> = z.object({
|
||||
|
@ -4758,7 +4765,7 @@ export const SessionFindFirstArgsSchema: z.ZodType<Prisma.SessionFindFirstArgs>
|
|||
cursor: SessionWhereUniqueInputSchema.optional(),
|
||||
take: z.number().optional(),
|
||||
skip: z.number().optional(),
|
||||
distinct: SessionScalarFieldEnumSchema.array().optional(),
|
||||
distinct: z.union([ SessionScalarFieldEnumSchema,SessionScalarFieldEnumSchema.array() ]).optional(),
|
||||
}).strict()
|
||||
|
||||
export const SessionFindFirstOrThrowArgsSchema: z.ZodType<Prisma.SessionFindFirstOrThrowArgs> = z.object({
|
||||
|
@ -4769,7 +4776,7 @@ export const SessionFindFirstOrThrowArgsSchema: z.ZodType<Prisma.SessionFindFirs
|
|||
cursor: SessionWhereUniqueInputSchema.optional(),
|
||||
take: z.number().optional(),
|
||||
skip: z.number().optional(),
|
||||
distinct: SessionScalarFieldEnumSchema.array().optional(),
|
||||
distinct: z.union([ SessionScalarFieldEnumSchema,SessionScalarFieldEnumSchema.array() ]).optional(),
|
||||
}).strict()
|
||||
|
||||
export const SessionFindManyArgsSchema: z.ZodType<Prisma.SessionFindManyArgs> = z.object({
|
||||
|
@ -4780,7 +4787,7 @@ export const SessionFindManyArgsSchema: z.ZodType<Prisma.SessionFindManyArgs> =
|
|||
cursor: SessionWhereUniqueInputSchema.optional(),
|
||||
take: z.number().optional(),
|
||||
skip: z.number().optional(),
|
||||
distinct: SessionScalarFieldEnumSchema.array().optional(),
|
||||
distinct: z.union([ SessionScalarFieldEnumSchema,SessionScalarFieldEnumSchema.array() ]).optional(),
|
||||
}).strict()
|
||||
|
||||
export const SessionAggregateArgsSchema: z.ZodType<Prisma.SessionAggregateArgs> = z.object({
|
||||
|
@ -4820,7 +4827,7 @@ export const UserFindFirstArgsSchema: z.ZodType<Prisma.UserFindFirstArgs> = z.ob
|
|||
cursor: UserWhereUniqueInputSchema.optional(),
|
||||
take: z.number().optional(),
|
||||
skip: z.number().optional(),
|
||||
distinct: UserScalarFieldEnumSchema.array().optional(),
|
||||
distinct: z.union([ UserScalarFieldEnumSchema,UserScalarFieldEnumSchema.array() ]).optional(),
|
||||
}).strict()
|
||||
|
||||
export const UserFindFirstOrThrowArgsSchema: z.ZodType<Prisma.UserFindFirstOrThrowArgs> = z.object({
|
||||
|
@ -4831,7 +4838,7 @@ export const UserFindFirstOrThrowArgsSchema: z.ZodType<Prisma.UserFindFirstOrThr
|
|||
cursor: UserWhereUniqueInputSchema.optional(),
|
||||
take: z.number().optional(),
|
||||
skip: z.number().optional(),
|
||||
distinct: UserScalarFieldEnumSchema.array().optional(),
|
||||
distinct: z.union([ UserScalarFieldEnumSchema,UserScalarFieldEnumSchema.array() ]).optional(),
|
||||
}).strict()
|
||||
|
||||
export const UserFindManyArgsSchema: z.ZodType<Prisma.UserFindManyArgs> = z.object({
|
||||
|
@ -4842,7 +4849,7 @@ export const UserFindManyArgsSchema: z.ZodType<Prisma.UserFindManyArgs> = z.obje
|
|||
cursor: UserWhereUniqueInputSchema.optional(),
|
||||
take: z.number().optional(),
|
||||
skip: z.number().optional(),
|
||||
distinct: UserScalarFieldEnumSchema.array().optional(),
|
||||
distinct: z.union([ UserScalarFieldEnumSchema,UserScalarFieldEnumSchema.array() ]).optional(),
|
||||
}).strict()
|
||||
|
||||
export const UserAggregateArgsSchema: z.ZodType<Prisma.UserAggregateArgs> = z.object({
|
||||
|
@ -4881,7 +4888,7 @@ export const VerificationTokenFindFirstArgsSchema: z.ZodType<Prisma.Verification
|
|||
cursor: VerificationTokenWhereUniqueInputSchema.optional(),
|
||||
take: z.number().optional(),
|
||||
skip: z.number().optional(),
|
||||
distinct: VerificationTokenScalarFieldEnumSchema.array().optional(),
|
||||
distinct: z.union([ VerificationTokenScalarFieldEnumSchema,VerificationTokenScalarFieldEnumSchema.array() ]).optional(),
|
||||
}).strict()
|
||||
|
||||
export const VerificationTokenFindFirstOrThrowArgsSchema: z.ZodType<Prisma.VerificationTokenFindFirstOrThrowArgs> = z.object({
|
||||
|
@ -4891,7 +4898,7 @@ export const VerificationTokenFindFirstOrThrowArgsSchema: z.ZodType<Prisma.Verif
|
|||
cursor: VerificationTokenWhereUniqueInputSchema.optional(),
|
||||
take: z.number().optional(),
|
||||
skip: z.number().optional(),
|
||||
distinct: VerificationTokenScalarFieldEnumSchema.array().optional(),
|
||||
distinct: z.union([ VerificationTokenScalarFieldEnumSchema,VerificationTokenScalarFieldEnumSchema.array() ]).optional(),
|
||||
}).strict()
|
||||
|
||||
export const VerificationTokenFindManyArgsSchema: z.ZodType<Prisma.VerificationTokenFindManyArgs> = z.object({
|
||||
|
@ -4901,7 +4908,7 @@ export const VerificationTokenFindManyArgsSchema: z.ZodType<Prisma.VerificationT
|
|||
cursor: VerificationTokenWhereUniqueInputSchema.optional(),
|
||||
take: z.number().optional(),
|
||||
skip: z.number().optional(),
|
||||
distinct: VerificationTokenScalarFieldEnumSchema.array().optional(),
|
||||
distinct: z.union([ VerificationTokenScalarFieldEnumSchema,VerificationTokenScalarFieldEnumSchema.array() ]).optional(),
|
||||
}).strict()
|
||||
|
||||
export const VerificationTokenAggregateArgsSchema: z.ZodType<Prisma.VerificationTokenAggregateArgs> = z.object({
|
||||
|
@ -4939,7 +4946,7 @@ export const GameFindFirstArgsSchema: z.ZodType<Prisma.GameFindFirstArgs> = z.ob
|
|||
cursor: GameWhereUniqueInputSchema.optional(),
|
||||
take: z.number().optional(),
|
||||
skip: z.number().optional(),
|
||||
distinct: GameScalarFieldEnumSchema.array().optional(),
|
||||
distinct: z.union([ GameScalarFieldEnumSchema,GameScalarFieldEnumSchema.array() ]).optional(),
|
||||
}).strict()
|
||||
|
||||
export const GameFindFirstOrThrowArgsSchema: z.ZodType<Prisma.GameFindFirstOrThrowArgs> = z.object({
|
||||
|
@ -4950,7 +4957,7 @@ export const GameFindFirstOrThrowArgsSchema: z.ZodType<Prisma.GameFindFirstOrThr
|
|||
cursor: GameWhereUniqueInputSchema.optional(),
|
||||
take: z.number().optional(),
|
||||
skip: z.number().optional(),
|
||||
distinct: GameScalarFieldEnumSchema.array().optional(),
|
||||
distinct: z.union([ GameScalarFieldEnumSchema,GameScalarFieldEnumSchema.array() ]).optional(),
|
||||
}).strict()
|
||||
|
||||
export const GameFindManyArgsSchema: z.ZodType<Prisma.GameFindManyArgs> = z.object({
|
||||
|
@ -4961,7 +4968,7 @@ export const GameFindManyArgsSchema: z.ZodType<Prisma.GameFindManyArgs> = z.obje
|
|||
cursor: GameWhereUniqueInputSchema.optional(),
|
||||
take: z.number().optional(),
|
||||
skip: z.number().optional(),
|
||||
distinct: GameScalarFieldEnumSchema.array().optional(),
|
||||
distinct: z.union([ GameScalarFieldEnumSchema,GameScalarFieldEnumSchema.array() ]).optional(),
|
||||
}).strict()
|
||||
|
||||
export const GameAggregateArgsSchema: z.ZodType<Prisma.GameAggregateArgs> = z.object({
|
||||
|
@ -5001,7 +5008,7 @@ export const GamepinFindFirstArgsSchema: z.ZodType<Prisma.GamepinFindFirstArgs>
|
|||
cursor: GamepinWhereUniqueInputSchema.optional(),
|
||||
take: z.number().optional(),
|
||||
skip: z.number().optional(),
|
||||
distinct: GamepinScalarFieldEnumSchema.array().optional(),
|
||||
distinct: z.union([ GamepinScalarFieldEnumSchema,GamepinScalarFieldEnumSchema.array() ]).optional(),
|
||||
}).strict()
|
||||
|
||||
export const GamepinFindFirstOrThrowArgsSchema: z.ZodType<Prisma.GamepinFindFirstOrThrowArgs> = z.object({
|
||||
|
@ -5012,7 +5019,7 @@ export const GamepinFindFirstOrThrowArgsSchema: z.ZodType<Prisma.GamepinFindFirs
|
|||
cursor: GamepinWhereUniqueInputSchema.optional(),
|
||||
take: z.number().optional(),
|
||||
skip: z.number().optional(),
|
||||
distinct: GamepinScalarFieldEnumSchema.array().optional(),
|
||||
distinct: z.union([ GamepinScalarFieldEnumSchema,GamepinScalarFieldEnumSchema.array() ]).optional(),
|
||||
}).strict()
|
||||
|
||||
export const GamepinFindManyArgsSchema: z.ZodType<Prisma.GamepinFindManyArgs> = z.object({
|
||||
|
@ -5023,7 +5030,7 @@ export const GamepinFindManyArgsSchema: z.ZodType<Prisma.GamepinFindManyArgs> =
|
|||
cursor: GamepinWhereUniqueInputSchema.optional(),
|
||||
take: z.number().optional(),
|
||||
skip: z.number().optional(),
|
||||
distinct: GamepinScalarFieldEnumSchema.array().optional(),
|
||||
distinct: z.union([ GamepinScalarFieldEnumSchema,GamepinScalarFieldEnumSchema.array() ]).optional(),
|
||||
}).strict()
|
||||
|
||||
export const GamepinAggregateArgsSchema: z.ZodType<Prisma.GamepinAggregateArgs> = z.object({
|
||||
|
@ -5063,7 +5070,7 @@ export const ShipFindFirstArgsSchema: z.ZodType<Prisma.ShipFindFirstArgs> = z.ob
|
|||
cursor: ShipWhereUniqueInputSchema.optional(),
|
||||
take: z.number().optional(),
|
||||
skip: z.number().optional(),
|
||||
distinct: ShipScalarFieldEnumSchema.array().optional(),
|
||||
distinct: z.union([ ShipScalarFieldEnumSchema,ShipScalarFieldEnumSchema.array() ]).optional(),
|
||||
}).strict()
|
||||
|
||||
export const ShipFindFirstOrThrowArgsSchema: z.ZodType<Prisma.ShipFindFirstOrThrowArgs> = z.object({
|
||||
|
@ -5074,7 +5081,7 @@ export const ShipFindFirstOrThrowArgsSchema: z.ZodType<Prisma.ShipFindFirstOrThr
|
|||
cursor: ShipWhereUniqueInputSchema.optional(),
|
||||
take: z.number().optional(),
|
||||
skip: z.number().optional(),
|
||||
distinct: ShipScalarFieldEnumSchema.array().optional(),
|
||||
distinct: z.union([ ShipScalarFieldEnumSchema,ShipScalarFieldEnumSchema.array() ]).optional(),
|
||||
}).strict()
|
||||
|
||||
export const ShipFindManyArgsSchema: z.ZodType<Prisma.ShipFindManyArgs> = z.object({
|
||||
|
@ -5085,7 +5092,7 @@ export const ShipFindManyArgsSchema: z.ZodType<Prisma.ShipFindManyArgs> = z.obje
|
|||
cursor: ShipWhereUniqueInputSchema.optional(),
|
||||
take: z.number().optional(),
|
||||
skip: z.number().optional(),
|
||||
distinct: ShipScalarFieldEnumSchema.array().optional(),
|
||||
distinct: z.union([ ShipScalarFieldEnumSchema,ShipScalarFieldEnumSchema.array() ]).optional(),
|
||||
}).strict()
|
||||
|
||||
export const ShipAggregateArgsSchema: z.ZodType<Prisma.ShipAggregateArgs> = z.object({
|
||||
|
@ -5125,7 +5132,7 @@ export const HitFindFirstArgsSchema: z.ZodType<Prisma.HitFindFirstArgs> = z.obje
|
|||
cursor: HitWhereUniqueInputSchema.optional(),
|
||||
take: z.number().optional(),
|
||||
skip: z.number().optional(),
|
||||
distinct: HitScalarFieldEnumSchema.array().optional(),
|
||||
distinct: z.union([ HitScalarFieldEnumSchema,HitScalarFieldEnumSchema.array() ]).optional(),
|
||||
}).strict()
|
||||
|
||||
export const HitFindFirstOrThrowArgsSchema: z.ZodType<Prisma.HitFindFirstOrThrowArgs> = z.object({
|
||||
|
@ -5136,7 +5143,7 @@ export const HitFindFirstOrThrowArgsSchema: z.ZodType<Prisma.HitFindFirstOrThrow
|
|||
cursor: HitWhereUniqueInputSchema.optional(),
|
||||
take: z.number().optional(),
|
||||
skip: z.number().optional(),
|
||||
distinct: HitScalarFieldEnumSchema.array().optional(),
|
||||
distinct: z.union([ HitScalarFieldEnumSchema,HitScalarFieldEnumSchema.array() ]).optional(),
|
||||
}).strict()
|
||||
|
||||
export const HitFindManyArgsSchema: z.ZodType<Prisma.HitFindManyArgs> = z.object({
|
||||
|
@ -5147,7 +5154,7 @@ export const HitFindManyArgsSchema: z.ZodType<Prisma.HitFindManyArgs> = z.object
|
|||
cursor: HitWhereUniqueInputSchema.optional(),
|
||||
take: z.number().optional(),
|
||||
skip: z.number().optional(),
|
||||
distinct: HitScalarFieldEnumSchema.array().optional(),
|
||||
distinct: z.union([ HitScalarFieldEnumSchema,HitScalarFieldEnumSchema.array() ]).optional(),
|
||||
}).strict()
|
||||
|
||||
export const HitAggregateArgsSchema: z.ZodType<Prisma.HitAggregateArgs> = z.object({
|
||||
|
@ -5187,7 +5194,7 @@ export const User_GameFindFirstArgsSchema: z.ZodType<Prisma.User_GameFindFirstAr
|
|||
cursor: User_GameWhereUniqueInputSchema.optional(),
|
||||
take: z.number().optional(),
|
||||
skip: z.number().optional(),
|
||||
distinct: User_GameScalarFieldEnumSchema.array().optional(),
|
||||
distinct: z.union([ User_GameScalarFieldEnumSchema,User_GameScalarFieldEnumSchema.array() ]).optional(),
|
||||
}).strict()
|
||||
|
||||
export const User_GameFindFirstOrThrowArgsSchema: z.ZodType<Prisma.User_GameFindFirstOrThrowArgs> = z.object({
|
||||
|
@ -5198,7 +5205,7 @@ export const User_GameFindFirstOrThrowArgsSchema: z.ZodType<Prisma.User_GameFind
|
|||
cursor: User_GameWhereUniqueInputSchema.optional(),
|
||||
take: z.number().optional(),
|
||||
skip: z.number().optional(),
|
||||
distinct: User_GameScalarFieldEnumSchema.array().optional(),
|
||||
distinct: z.union([ User_GameScalarFieldEnumSchema,User_GameScalarFieldEnumSchema.array() ]).optional(),
|
||||
}).strict()
|
||||
|
||||
export const User_GameFindManyArgsSchema: z.ZodType<Prisma.User_GameFindManyArgs> = z.object({
|
||||
|
@ -5209,7 +5216,7 @@ export const User_GameFindManyArgsSchema: z.ZodType<Prisma.User_GameFindManyArgs
|
|||
cursor: User_GameWhereUniqueInputSchema.optional(),
|
||||
take: z.number().optional(),
|
||||
skip: z.number().optional(),
|
||||
distinct: User_GameScalarFieldEnumSchema.array().optional(),
|
||||
distinct: z.union([ User_GameScalarFieldEnumSchema,User_GameScalarFieldEnumSchema.array() ]).optional(),
|
||||
}).strict()
|
||||
|
||||
export const User_GameAggregateArgsSchema: z.ZodType<Prisma.User_GameAggregateArgs> = z.object({
|
||||
|
@ -5249,7 +5256,7 @@ export const MoveFindFirstArgsSchema: z.ZodType<Prisma.MoveFindFirstArgs> = z.ob
|
|||
cursor: MoveWhereUniqueInputSchema.optional(),
|
||||
take: z.number().optional(),
|
||||
skip: z.number().optional(),
|
||||
distinct: MoveScalarFieldEnumSchema.array().optional(),
|
||||
distinct: z.union([ MoveScalarFieldEnumSchema,MoveScalarFieldEnumSchema.array() ]).optional(),
|
||||
}).strict()
|
||||
|
||||
export const MoveFindFirstOrThrowArgsSchema: z.ZodType<Prisma.MoveFindFirstOrThrowArgs> = z.object({
|
||||
|
@ -5260,7 +5267,7 @@ export const MoveFindFirstOrThrowArgsSchema: z.ZodType<Prisma.MoveFindFirstOrThr
|
|||
cursor: MoveWhereUniqueInputSchema.optional(),
|
||||
take: z.number().optional(),
|
||||
skip: z.number().optional(),
|
||||
distinct: MoveScalarFieldEnumSchema.array().optional(),
|
||||
distinct: z.union([ MoveScalarFieldEnumSchema,MoveScalarFieldEnumSchema.array() ]).optional(),
|
||||
}).strict()
|
||||
|
||||
export const MoveFindManyArgsSchema: z.ZodType<Prisma.MoveFindManyArgs> = z.object({
|
||||
|
@ -5271,7 +5278,7 @@ export const MoveFindManyArgsSchema: z.ZodType<Prisma.MoveFindManyArgs> = z.obje
|
|||
cursor: MoveWhereUniqueInputSchema.optional(),
|
||||
take: z.number().optional(),
|
||||
skip: z.number().optional(),
|
||||
distinct: MoveScalarFieldEnumSchema.array().optional(),
|
||||
distinct: z.union([ MoveScalarFieldEnumSchema,MoveScalarFieldEnumSchema.array() ]).optional(),
|
||||
}).strict()
|
||||
|
||||
export const MoveAggregateArgsSchema: z.ZodType<Prisma.MoveAggregateArgs> = z.object({
|
||||
|
@ -5311,7 +5318,7 @@ export const ChatFindFirstArgsSchema: z.ZodType<Prisma.ChatFindFirstArgs> = z.ob
|
|||
cursor: ChatWhereUniqueInputSchema.optional(),
|
||||
take: z.number().optional(),
|
||||
skip: z.number().optional(),
|
||||
distinct: ChatScalarFieldEnumSchema.array().optional(),
|
||||
distinct: z.union([ ChatScalarFieldEnumSchema,ChatScalarFieldEnumSchema.array() ]).optional(),
|
||||
}).strict()
|
||||
|
||||
export const ChatFindFirstOrThrowArgsSchema: z.ZodType<Prisma.ChatFindFirstOrThrowArgs> = z.object({
|
||||
|
@ -5322,7 +5329,7 @@ export const ChatFindFirstOrThrowArgsSchema: z.ZodType<Prisma.ChatFindFirstOrThr
|
|||
cursor: ChatWhereUniqueInputSchema.optional(),
|
||||
take: z.number().optional(),
|
||||
skip: z.number().optional(),
|
||||
distinct: ChatScalarFieldEnumSchema.array().optional(),
|
||||
distinct: z.union([ ChatScalarFieldEnumSchema,ChatScalarFieldEnumSchema.array() ]).optional(),
|
||||
}).strict()
|
||||
|
||||
export const ChatFindManyArgsSchema: z.ZodType<Prisma.ChatFindManyArgs> = z.object({
|
||||
|
@ -5333,7 +5340,7 @@ export const ChatFindManyArgsSchema: z.ZodType<Prisma.ChatFindManyArgs> = z.obje
|
|||
cursor: ChatWhereUniqueInputSchema.optional(),
|
||||
take: z.number().optional(),
|
||||
skip: z.number().optional(),
|
||||
distinct: ChatScalarFieldEnumSchema.array().optional(),
|
||||
distinct: z.union([ ChatScalarFieldEnumSchema,ChatScalarFieldEnumSchema.array() ]).optional(),
|
||||
}).strict()
|
||||
|
||||
export const ChatAggregateArgsSchema: z.ZodType<Prisma.ChatAggregateArgs> = z.object({
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
|
|
2
leaky-ships/types/next-auth.d.ts
vendored
2
leaky-ships/types/next-auth.d.ts
vendored
|
@ -1,4 +1,4 @@
|
|||
import NextAuth, { DefaultSession } from "next-auth"
|
||||
import { DefaultSession } from "next-auth"
|
||||
|
||||
declare module "next-auth" {
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue