diff --git a/tank-frontend/src/PlayerInfo.tsx b/tank-frontend/src/PlayerInfo.tsx index 2916d04..4ab04bc 100644 --- a/tank-frontend/src/PlayerInfo.tsx +++ b/tank-frontend/src/PlayerInfo.tsx @@ -1,4 +1,4 @@ -import {makeApiUrl, Scores, useMyWebSocket} from './serverCalls'; +import {makeApiUrl, PlayerInfoMessage, useMyWebSocket} from './serverCalls'; import Column from './components/Column.tsx'; import {ReadyState} from 'react-use-websocket'; import {useEffect, useState} from 'react'; @@ -21,21 +21,6 @@ function ScoreRow({name, value}: { ; } -type TankInfo = { - readonly magazine: string; - readonly position: { x: number; y: number }; - readonly orientation: number; - readonly moving: boolean; -} - -type PlayerInfoMessage = { - readonly name: string; - readonly scores: Scores; - readonly controls: string; - readonly tank?: TankInfo; - readonly openConnections: number; -} - export default function PlayerInfo({player}: { player: string }) { const [shouldSendMessage, setShouldSendMessage] = useState(false); diff --git a/tank-frontend/src/serverCalls.tsx b/tank-frontend/src/serverCalls.tsx index 6e003fb..66675fd 100644 --- a/tank-frontend/src/serverCalls.tsx +++ b/tank-frontend/src/serverCalls.tsx @@ -19,6 +19,21 @@ export type Player = { readonly scores: Scores; }; +type TankInfo = { + readonly magazine: string; + readonly position: { x: number; y: number }; + readonly orientation: number; + readonly moving: boolean; +} + +export type PlayerInfoMessage = { + readonly name: string; + readonly scores: Scores; + readonly controls: string; + readonly tank?: TankInfo; + readonly openConnections: number; +} + export function useMyWebSocket(url: string, options: Options = {}) { return useWebSocket(url, { shouldReconnect: () => true,