From bda06a37cc07edce4a6d247339d7ae0c84419254 Mon Sep 17 00:00:00 2001 From: TeamCity Date: Wed, 10 Dec 2025 23:17:06 +0000 Subject: [PATCH 1/2] ci: bump version to v0.12.1 --- CHANGELOG.md | 1 + versions.env | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 637b584..f4d4a69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -103,3 +103,4 @@ ### Features * FRO-25 Create Game Info Component ([#19](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/issues/19)) ([06f27d6](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/commit/06f27d6813f625af25e734de3dcbcf07b10f3a1a)) +## [0.0.0](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/compare/0.12.0...0.0.0) (2025-12-10) diff --git a/versions.env b/versions.env index 93254ff..e338912 100644 --- a/versions.env +++ b/versions.env @@ -1,3 +1,3 @@ MAJOR=0 MINOR=12 -PATCH=0 +PATCH=1 From 0faa04240199dad6e417f173ca9247c487d3d4f7 Mon Sep 17 00:00:00 2001 From: LQ63 Date: Thu, 11 Dec 2025 02:05:58 +0100 Subject: [PATCH 2/2] feat(ui): FRO-34 Lobby Started Lobby Component --- src/components/lobby/LobbyComponent.vue | 125 ++++++++++++++++++++++++ src/composables/useUserInfo.ts | 1 + src/main.ts | 4 + src/router/index.ts | 9 +- src/services/ws.ts | 13 ++- src/views/CreateGame.vue | 1 - src/views/LobbyView.vue | 53 ++++++++++ 7 files changed, 202 insertions(+), 4 deletions(-) create mode 100644 src/components/lobby/LobbyComponent.vue create mode 100644 src/views/LobbyView.vue diff --git a/src/components/lobby/LobbyComponent.vue b/src/components/lobby/LobbyComponent.vue new file mode 100644 index 0000000..586adbf --- /dev/null +++ b/src/components/lobby/LobbyComponent.vue @@ -0,0 +1,125 @@ + + + + + diff --git a/src/composables/useUserInfo.ts b/src/composables/useUserInfo.ts index 781ba8a..24c1bd8 100644 --- a/src/composables/useUserInfo.ts +++ b/src/composables/useUserInfo.ts @@ -20,6 +20,7 @@ export const useUserInfo = defineStore('userInfo', () => { function requestState() { axios.get(`${api}/status`, {withCredentials: true}).then((response) => { + console.log("STATUS DATA:" + response.data.status + response.data.inGame) username.value = response.data.username; if (response.data.ingame) { gameId.value = response.data.gameId; diff --git a/src/main.ts b/src/main.ts index a7d595c..1ba1d75 100644 --- a/src/main.ts +++ b/src/main.ts @@ -12,11 +12,15 @@ import { createPinia } from 'pinia' import axios from 'axios' import VueAxios from 'vue-axios' import {useUserInfo} from "@/composables/useUserInfo.ts"; +import {useIngame} from "@/composables/useIngame.ts"; +import {initWebSocket} from "@/services/ws.ts"; const app = createApp(App) const pinia = createPinia() app.use(pinia) +const ingameStore = useIngame(); +initWebSocket(ingameStore) app.use(router) app.use(Quasar, { plugins: { diff --git a/src/router/index.ts b/src/router/index.ts index 908614e..bf54408 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -7,7 +7,8 @@ import defaultMenu from "../components/DefaultMenu.vue" import axios from "axios"; import { useUserInfo } from "@/composables/useUserInfo"; import rulesView from "../components/Rules.vue"; - +import LobbyView from "@/views/LobbyView.vue"; +import GameView from "@/views/Game.vue" const api = window?.__RUNTIME_CONFIG__?.API_URL; const router = createRouter({ @@ -50,6 +51,12 @@ const router = createRouter({ component: LoginView, meta: { requiresAuth: false } }, + { + path: '/lobby', + name: 'lobby', + component: LobbyView, + meta: {requiresAuth: true } + } ], }) diff --git a/src/services/ws.ts b/src/services/ws.ts index 7b59a09..d65f7f1 100644 --- a/src/services/ws.ts +++ b/src/services/ws.ts @@ -33,10 +33,13 @@ let ws: WebSocket | null = null; const pending = new Map(); const handlers = new Map(); -const uState = useIngame(); +let uState: ReturnType | null = null; let heartbeatTimer: ReturnType | null = null; +export function initWebSocket(ingameStore: ReturnType) { + uState = ingameStore; +} let defaultHandler: HandlerFn | null = null; function uuid(): string { @@ -70,6 +73,10 @@ function stopHeartbeat() { } function setupSocketHandlers(socket: WebSocket) { + if (!uState) { + console.error("[WS] WebSocket module not initialized with Pinia store!"); + return; + } socket.onmessage = async (raw) => { console.debug("[WS] MESSAGE:", raw.data); @@ -100,7 +107,9 @@ function setupSocketHandlers(socket: WebSocket) { } if (state && stateData) { - uState.setIngame(state, stateData); + if(uState) { + uState.setIngame(state, stateData); + } } // Server event → handler branch diff --git a/src/views/CreateGame.vue b/src/views/CreateGame.vue index 01a2e73..f34b7b9 100644 --- a/src/views/CreateGame.vue +++ b/src/views/CreateGame.vue @@ -11,7 +11,6 @@ const playerAmount = ref(2); const $q = useQuasar(); const isLoading = ref(false); const router = useRouter(); -const delay = (ms: number) => new Promise(resolve => setTimeout(resolve, ms)); const createGameQuasar = async () => { if (!lobbyName.value) { $q.notify({ message: 'Lobby-Name wird benötigt', color: 'red', position: 'top', icon: 'cancel' }); diff --git a/src/views/LobbyView.vue b/src/views/LobbyView.vue new file mode 100644 index 0000000..1637d86 --- /dev/null +++ b/src/views/LobbyView.vue @@ -0,0 +1,53 @@ + + + + +