diff --git a/package.json b/package.json index 12cc769..a45a6a4 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,8 @@ "version": "1.0.0", "type": "module", "scripts": { + "start:ui": "vite preview --host", + "build:ui": "vite build", "dev:ui": "vite", "dev:server": "NODE_ENV=development tsx watch --clear-screen=false ./src/server/main.ts" }, diff --git a/src/clientGame.ts b/src/clientGame.ts index 6c903a5..62a3c30 100644 --- a/src/clientGame.ts +++ b/src/clientGame.ts @@ -25,7 +25,6 @@ export const useGame = defineStore("game", () => { const actions = reactive([]) const auth = useAuth() - const actionsBus = useGameActionsBus() actionsBus.on(action => { actions.push(action) @@ -60,11 +59,15 @@ export const useGame = defineStore("game", () => { }) }) }, - async create() { - return await trpcClient.createGame.mutate() + async reset() { + window.location.hash = "" + lobbyCode.value = null + state.value = getUninitializedGameState() + actions.splice(0, actions.length) }, start: () => trpcClient.game.start.mutate({ lobbyCode: lobbyCode.value! }), hit: () => trpcClient.game.hit.mutate({ lobbyCode: lobbyCode.value! }), - stay: () => trpcClient.game.stay.mutate({ lobbyCode: lobbyCode.value! }) + stay: () => trpcClient.game.stay.mutate({ lobbyCode: lobbyCode.value! }), + create: () => trpcClient.createGame.mutate() } }) \ No newline at end of file diff --git a/src/components/Game.vue b/src/components/Game.vue index 9567b05..4ff6ee5 100644 --- a/src/components/Game.vue +++ b/src/components/Game.vue @@ -1,27 +1,34 @@