refactor: add typescript & pnpm workspace & docker file

This commit is contained in:
Ralex
2025-10-16 23:12:40 +02:00
parent 8f73241f34
commit edb7146d6d
122 changed files with 7568 additions and 8502 deletions

View File

@@ -0,0 +1,37 @@
/* eslint-disable no-unused-vars */
import { create } from "zustand"
type PlayerState = {
gameId?: string
username?: string
points?: number
}
type PlayerStore = {
player: PlayerState | null
login: (gameId: string) => void
join: (username: string) => void
updatePoints: (points: number) => void
logout: () => void
}
export const usePlayerStore = create<PlayerStore>((set) => ({
player: null,
login: (username) =>
set((state) => ({
player: { ...state.player, username },
})),
join: (gameId) =>
set((state) => ({
player: { ...state.player, gameId, points: 0 },
})),
updatePoints: (points) =>
set((state) => ({
player: { ...state.player, points },
})),
logout: () => set({ player: null }),
}))