diff --git a/clients/player-client/src/components/Keyboard.tsx b/clients/player-client/src/components/Keyboard.tsx index 4e203f6a..a91f007d 100644 --- a/clients/player-client/src/components/Keyboard.tsx +++ b/clients/player-client/src/components/Keyboard.tsx @@ -22,7 +22,7 @@ export const Keyboard: React.FC = () => { return (
- {inputContext.state.key} {inputContext.state.timestamp}{' '} + {inputContext.state.key} {inputContext.state.timestamp?.toISO()}{' '} {input &&
Input: {input?.map(i => i.key).join(', ')}
}
); diff --git a/clients/player-client/src/context/Input/InputAction.type.ts b/clients/player-client/src/context/Input/InputAction.type.ts index 318cf671..26c2415e 100644 --- a/clients/player-client/src/context/Input/InputAction.type.ts +++ b/clients/player-client/src/context/Input/InputAction.type.ts @@ -1,8 +1,9 @@ import { InputActionType } from './InputActionType.type'; +import { DateTime } from 'luxon'; export type InputAction = | { type: InputActionType.SET_TOUCH_GRID; payload: { x: number; y: number } } | { type: InputActionType.SET_KEYSTROKE; - payload: { key: string; timestamp: string }; + payload: { key: string; timestamp: DateTime }; }; diff --git a/clients/player-client/src/context/Input/InputState.type.ts b/clients/player-client/src/context/Input/InputState.type.ts index 269c8c9c..7b9f95d6 100644 --- a/clients/player-client/src/context/Input/InputState.type.ts +++ b/clients/player-client/src/context/Input/InputState.type.ts @@ -1,6 +1,8 @@ +import { DateTime } from 'luxon'; + export type InputState = { x?: number; y?: number; key?: string; - timestamp?: string; + timestamp?: DateTime; }; diff --git a/clients/player-client/src/core/types/player-input-record.type.ts b/clients/player-client/src/core/types/player-input-record.type.ts index e3039862..eaef9966 100644 --- a/clients/player-client/src/core/types/player-input-record.type.ts +++ b/clients/player-client/src/core/types/player-input-record.type.ts @@ -1,4 +1,6 @@ +import { DateTime } from 'luxon'; + export type PlayerInputRecord = { key: string; - timestamp: string; + timestamp: DateTime; }; diff --git a/clients/player-client/src/core/useHandleInput.ts b/clients/player-client/src/core/useHandleInput.ts index ae7fdac3..bdda7aee 100644 --- a/clients/player-client/src/core/useHandleInput.ts +++ b/clients/player-client/src/core/useHandleInput.ts @@ -19,7 +19,7 @@ export default function useHandleInput(): PlayerInputRecord[] | null { // Collect key press for the given direction newInputRecords.push({ key: direction, - timestamp: DateTime.now().toISO(), + timestamp: DateTime.now(), }); } });