Compare commits
1 Commits
30798ce723
...
0.13.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f0623dbfb2 |
@@ -104,3 +104,8 @@
|
|||||||
|
|
||||||
* 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))
|
* 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)
|
## [0.0.0](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/compare/0.12.0...0.0.0) (2025-12-10)
|
||||||
|
## [0.0.0](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/compare/0.12.1...0.0.0) (2025-12-11)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **ui:** FRO-35 Animations ([#22](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/issues/22)) ([d73b4f3](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/commit/d73b4f396be89b4f8ce2a446afe47c604cfe8598))
|
||||||
|
|||||||
2
env.d.ts
vendored
2
env.d.ts
vendored
@@ -1,7 +1,7 @@
|
|||||||
/// <reference types="vite/client" />
|
/// <reference types="vite/client" />
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface Window { __RUNTIME_CONFIG__?: { API_URL?: string; WEBSOCKET_URL?: string } }
|
interface Window { __RUNTIME_CONFIG__?: { API_URL?: string } }
|
||||||
}
|
}
|
||||||
|
|
||||||
export {};
|
export {};
|
||||||
|
|||||||
18
package-lock.json
generated
18
package-lock.json
generated
@@ -74,6 +74,7 @@
|
|||||||
"integrity": "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==",
|
"integrity": "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/code-frame": "^7.27.1",
|
"@babel/code-frame": "^7.27.1",
|
||||||
"@babel/generator": "^7.28.5",
|
"@babel/generator": "^7.28.5",
|
||||||
@@ -2574,6 +2575,7 @@
|
|||||||
"integrity": "sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ==",
|
"integrity": "sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"undici-types": "~7.16.0"
|
"undici-types": "~7.16.0"
|
||||||
}
|
}
|
||||||
@@ -2624,6 +2626,7 @@
|
|||||||
"integrity": "sha512-PC0PDZfJg8sP7cmKe6L3QIL8GZwU5aRvUFedqSIpw3B+QjRSUZeeITC2M5XKeMXEzL6wccN196iy3JLwKNvDVA==",
|
"integrity": "sha512-PC0PDZfJg8sP7cmKe6L3QIL8GZwU5aRvUFedqSIpw3B+QjRSUZeeITC2M5XKeMXEzL6wccN196iy3JLwKNvDVA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/scope-manager": "8.48.1",
|
"@typescript-eslint/scope-manager": "8.48.1",
|
||||||
"@typescript-eslint/types": "8.48.1",
|
"@typescript-eslint/types": "8.48.1",
|
||||||
@@ -2841,6 +2844,7 @@
|
|||||||
"integrity": "sha512-iHmwV3QcVGGvSC1BG5bZ4z6iwa1SOpAPWmnjOErd4Ske+lZua5K9TtAVdx0gMBClJ28DViCbSmZitjWZsWO3LA==",
|
"integrity": "sha512-iHmwV3QcVGGvSC1BG5bZ4z6iwa1SOpAPWmnjOErd4Ske+lZua5K9TtAVdx0gMBClJ28DViCbSmZitjWZsWO3LA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@rolldown/pluginutils": "1.0.0-beta.50"
|
"@rolldown/pluginutils": "1.0.0-beta.50"
|
||||||
},
|
},
|
||||||
@@ -3227,6 +3231,7 @@
|
|||||||
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
|
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"acorn": "bin/acorn"
|
"acorn": "bin/acorn"
|
||||||
},
|
},
|
||||||
@@ -3318,6 +3323,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.13.2.tgz",
|
"resolved": "https://registry.npmjs.org/axios/-/axios-1.13.2.tgz",
|
||||||
"integrity": "sha512-VPk9ebNqPcy5lRGuSlKx752IlDatOjT9paPlm8A7yOuW2Fbvp4X3JznJtT4f0GzGLLiWE9W8onz51SqLYwzGaA==",
|
"integrity": "sha512-VPk9ebNqPcy5lRGuSlKx752IlDatOjT9paPlm8A7yOuW2Fbvp4X3JznJtT4f0GzGLLiWE9W8onz51SqLYwzGaA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"follow-redirects": "^1.15.6",
|
"follow-redirects": "^1.15.6",
|
||||||
"form-data": "^4.0.4",
|
"form-data": "^4.0.4",
|
||||||
@@ -3400,6 +3406,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"baseline-browser-mapping": "^2.9.0",
|
"baseline-browser-mapping": "^2.9.0",
|
||||||
"caniuse-lite": "^1.0.30001759",
|
"caniuse-lite": "^1.0.30001759",
|
||||||
@@ -3867,6 +3874,7 @@
|
|||||||
"integrity": "sha512-BhHmn2yNOFA9H9JmmIVKJmd288g9hrVRDkdoIgRCRuSySRUHH7r/DI6aAXW9T1WwUuY3DFgrcaqB+deURBLR5g==",
|
"integrity": "sha512-BhHmn2yNOFA9H9JmmIVKJmd288g9hrVRDkdoIgRCRuSySRUHH7r/DI6aAXW9T1WwUuY3DFgrcaqB+deURBLR5g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint-community/eslint-utils": "^4.8.0",
|
"@eslint-community/eslint-utils": "^4.8.0",
|
||||||
"@eslint-community/regexpp": "^4.12.1",
|
"@eslint-community/regexpp": "^4.12.1",
|
||||||
@@ -3927,6 +3935,7 @@
|
|||||||
"integrity": "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==",
|
"integrity": "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"eslint-config-prettier": "bin/cli.js"
|
"eslint-config-prettier": "bin/cli.js"
|
||||||
},
|
},
|
||||||
@@ -3974,6 +3983,7 @@
|
|||||||
"integrity": "sha512-SbR9ZBUFKgvWAbq3RrdCtWaW0IKm6wwUiApxf3BVTNfqUIo4IQQmreMg2iHFJJ6C/0wss3LXURBJ1OwS/MhFcQ==",
|
"integrity": "sha512-SbR9ZBUFKgvWAbq3RrdCtWaW0IKm6wwUiApxf3BVTNfqUIo4IQQmreMg2iHFJJ6C/0wss3LXURBJ1OwS/MhFcQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint-community/eslint-utils": "^4.4.0",
|
"@eslint-community/eslint-utils": "^4.4.0",
|
||||||
"natural-compare": "^1.4.0",
|
"natural-compare": "^1.4.0",
|
||||||
@@ -4655,6 +4665,7 @@
|
|||||||
"integrity": "sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ==",
|
"integrity": "sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"jiti": "lib/jiti-cli.mjs"
|
"jiti": "lib/jiti-cli.mjs"
|
||||||
}
|
}
|
||||||
@@ -5340,6 +5351,7 @@
|
|||||||
"integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==",
|
"integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"prettier": "bin/prettier.cjs"
|
"prettier": "bin/prettier.cjs"
|
||||||
},
|
},
|
||||||
@@ -5384,6 +5396,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/quasar/-/quasar-2.18.6.tgz",
|
"resolved": "https://registry.npmjs.org/quasar/-/quasar-2.18.6.tgz",
|
||||||
"integrity": "sha512-ZlK+vJXOBPSFDCNQDBDNwSI+AHoqaFPxK8ve6mhsYLhMKWI5b8zsGY9VU1xYjngO2aBvU4fvGWXy4tTbzrBk8Q==",
|
"integrity": "sha512-ZlK+vJXOBPSFDCNQDBDNwSI+AHoqaFPxK8ve6mhsYLhMKWI5b8zsGY9VU1xYjngO2aBvU4fvGWXy4tTbzrBk8Q==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 10.18.1",
|
"node": ">= 10.18.1",
|
||||||
"npm": ">= 6.13.4",
|
"npm": ">= 6.13.4",
|
||||||
@@ -6144,6 +6157,7 @@
|
|||||||
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12"
|
"node": ">=12"
|
||||||
},
|
},
|
||||||
@@ -6248,6 +6262,7 @@
|
|||||||
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
|
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
|
||||||
"devOptional": true,
|
"devOptional": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
"peer": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"tsc": "bin/tsc",
|
"tsc": "bin/tsc",
|
||||||
"tsserver": "bin/tsserver"
|
"tsserver": "bin/tsserver"
|
||||||
@@ -6378,6 +6393,7 @@
|
|||||||
"integrity": "sha512-tI2l/nFHC5rLh7+5+o7QjKjSR04ivXDF4jcgV0f/bTQ+OJiITy5S6gaynVsEM+7RqzufMnVbIon6Sr5x1SDYaQ==",
|
"integrity": "sha512-tI2l/nFHC5rLh7+5+o7QjKjSR04ivXDF4jcgV0f/bTQ+OJiITy5S6gaynVsEM+7RqzufMnVbIon6Sr5x1SDYaQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"esbuild": "^0.25.0",
|
"esbuild": "^0.25.0",
|
||||||
"fdir": "^6.5.0",
|
"fdir": "^6.5.0",
|
||||||
@@ -6628,6 +6644,7 @@
|
|||||||
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12"
|
"node": ">=12"
|
||||||
},
|
},
|
||||||
@@ -6647,6 +6664,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/vue/-/vue-3.5.25.tgz",
|
"resolved": "https://registry.npmjs.org/vue/-/vue-3.5.25.tgz",
|
||||||
"integrity": "sha512-YLVdgv2K13WJ6n+kD5owehKtEXwdwXuj2TTyJMsO7pSeKw2bfRNZGjhB7YzrpbMYj5b5QsUebHpOqR3R3ziy/g==",
|
"integrity": "sha512-YLVdgv2K13WJ6n+kD5owehKtEXwdwXuj2TTyJMsO7pSeKw2bfRNZGjhB7YzrpbMYj5b5QsUebHpOqR3R3ziy/g==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vue/compiler-dom": "3.5.25",
|
"@vue/compiler-dom": "3.5.25",
|
||||||
"@vue/compiler-sfc": "3.5.25",
|
"@vue/compiler-sfc": "3.5.25",
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
window.__RUNTIME_CONFIG__ = {
|
window.__RUNTIME_CONFIG__ = {
|
||||||
API_URL: "http://localhost:9000",
|
API_URL: "http://localhost:9000"
|
||||||
WEBSOCKET_API_URL: "ws://localhost:9000/websocket"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
window.__RUNTIME_CONFIG__ = {
|
window.__RUNTIME_CONFIG__ = {
|
||||||
API_URL: "${API_URL}",
|
API_URL: "${API_URL}"
|
||||||
WEBSOCKET_API_URL: "${WEBSOCKET_API_URL}"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -13,45 +13,38 @@ const ig = useIngame()
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<q-layout>
|
<q-page class="game-field-background vh-100 ingame-side-shadow">
|
||||||
<q-page-container>
|
<div class="py-5 container-xxl">
|
||||||
<q-page class="game-field-background vh-100 ingame-side-shadow">
|
|
||||||
<div class="py-5 container-xxl">
|
|
||||||
|
|
||||||
<div class="fit row wrap justify-center items-center content-start">
|
<q-row class="q-gutter-md q-mx-md">
|
||||||
<div class="mt-5 ml-4 self-start col-2">
|
<q-col cols="4" class="mt-5 text-start">
|
||||||
<TurnC v-if="(ig.data as GameInfo)?.playerQueue" :queue="(ig.data as GameInfo).playerQueue!"/>
|
<TurnC v-if="(ig.data as GameInfo)?.playerQueue" :queue="(ig.data as GameInfo).playerQueue!"/>
|
||||||
</div>
|
</q-col>
|
||||||
|
|
||||||
<div class="text-center col-6">
|
<q-col cols="4" class="text-center">
|
||||||
<ScoreboardC v-if="(ig.data as GameInfo)?.currentRound" :current-round="(ig.data as GameInfo).currentRound!" />
|
<ScoreboardC v-if="(ig.data as GameInfo)?.currentRound" :current-round="(ig.data as GameInfo).currentRound!" />
|
||||||
</div>
|
|
||||||
|
|
||||||
|
<div class="d-flex justify-content-center g-3 mb-5">
|
||||||
<div class="mt-5 ml-4 self-end col-2" style="margin-left: 6em">
|
<PlayedCardsC v-if="(ig.data as GameInfo)?.currentTrick" :trick="(ig.data as GameInfo).currentTrick!" />
|
||||||
<GameInfoC v-if="(ig.data as GameInfo)?.currentRound"
|
|
||||||
:first-card="(ig.data as GameInfo).currentTrick?.firstCard ?? null"
|
|
||||||
:trumpsuit="(ig.data as GameInfo).currentRound!.trumpSuit"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
</q-col>
|
||||||
|
|
||||||
<div class="fit row wrap justify-center items-center content-start">
|
|
||||||
<div class="mt-4 ml-4 col-3 justify-content-center">
|
|
||||||
<div class="d-flex justify-content-center g-3 mb-5">
|
|
||||||
<PlayedCardsC v-if="(ig.data as GameInfo)?.currentTrick" :trick="(ig.data as GameInfo).currentTrick!" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="q-gutter-sm mt-4 bottom-div justify-content-center row" style="backdrop-filter: blur(4px); margin-left: 0; margin-right: 0;">
|
|
||||||
<div class="flex justify-center col-12">
|
|
||||||
<HandC v-if="(ig.data as GameInfo)?.hand && (ig.data as GameInfo)?.self"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
<q-col cols="4" class="mt-5 text-end">
|
||||||
</q-page>
|
<GameInfoC v-if="(ig.data as GameInfo)?.currentRound"
|
||||||
</q-page-container>
|
:first-card="(ig.data as GameInfo).currentTrick?.firstCard ?? null"
|
||||||
</q-layout>
|
:trumpsuit="(ig.data as GameInfo).currentRound!.trumpSuit"/>
|
||||||
|
</q-col>
|
||||||
|
</q-row>
|
||||||
|
|
||||||
|
<q-row justify="center" class="q-gutter-sm mt-4 bottom-div" style="backdrop-filter: blur(4px); margin-left: 0; margin-right: 0;">
|
||||||
|
<q-col cols="12" class="flex justify-center">
|
||||||
|
<HandC v-if="(ig.data as GameInfo)?.hand && (ig.data as GameInfo)?.self" :hand="(ig.data as GameInfo).hand!" :self="(ig.data as GameInfo).self"/>
|
||||||
|
</q-col>
|
||||||
|
</q-row>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</q-page>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@@ -66,15 +59,4 @@ const ig = useIngame()
|
|||||||
.ingame-side-shadow {
|
.ingame-side-shadow {
|
||||||
box-shadow: 0 1px 15px 0 #000000
|
box-shadow: 0 1px 15px 0 #000000
|
||||||
}
|
}
|
||||||
.bottom-div {
|
|
||||||
position: fixed;
|
|
||||||
bottom: 0;
|
|
||||||
left: 50%;
|
|
||||||
transform: translateX(-50%);
|
|
||||||
max-width: 1400px;
|
|
||||||
width: 100%;
|
|
||||||
margin: 0;
|
|
||||||
text-align: center;
|
|
||||||
padding: 10px;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ const {trumpsuit, firstCard} = toRefs(props)
|
|||||||
|
|
||||||
|
|
||||||
const trumpName = computed(() => {
|
const trumpName = computed(() => {
|
||||||
switch (trumpsuit.value.identifier.charAt(1) as string) {
|
switch (trumpsuit.value.path.charAt(trumpsuit.value.path.length - 1)) {
|
||||||
case 'S':
|
case 'S':
|
||||||
return 'Spades'
|
return 'Spades'
|
||||||
case 'H':
|
case 'H':
|
||||||
@@ -36,12 +36,14 @@ const trumpName = computed(() => {
|
|||||||
|
|
||||||
<div class="q-mt-md">
|
<div class="q-mt-md">
|
||||||
<div class="text-subtitle1 q-mb-xs q-font-medium">First Card</div>
|
<div class="text-subtitle1 q-mb-xs q-font-medium">First Card</div>
|
||||||
<div id="first-card-container" class="q-pa-sm rounded shadow-2"
|
<div id="first-card-container" class="q-pa-sm bg-grey-2 rounded shadow-2"
|
||||||
style="display:inline-block;">
|
style="display:inline-block;">
|
||||||
<q-img v-if="firstCard" :src="firstCard.path" alt="First Card" class="firstbox"
|
<q-img v-if="firstCard" :src="firstCard.path" alt="First Card" class="firstbox"
|
||||||
style="width: 80px; border-radius: 6px;"/>
|
style="width: 80px; border-radius: 6px;"/>
|
||||||
<q-img v-else src="/images/cards/1B.png" alt="First Card" class="firstbox"
|
<div v-else class="q-pa-sm"
|
||||||
style="width: 80px; border-radius: 6px;"/>
|
style="width: 80px; height: 120px; display:flex; align-items:center; justify-content:center; border-radius:6px; background: #ffffff; color: #666;">
|
||||||
|
No image
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,40 +1,42 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import {toRefs} from 'vue'
|
||||||
|
import type {Hand, Player} from "@/types/GameSubTypes.ts";
|
||||||
import {useWebSocket} from "@/composables/useWebsocket.ts";
|
import {useWebSocket} from "@/composables/useWebsocket.ts";
|
||||||
import {useIngame} from "@/composables/useIngame.ts";
|
|
||||||
import type {GameInfo} from "@/types/GameTypes.ts";
|
|
||||||
import {useQuasar} from "quasar";
|
|
||||||
import { ref } from 'vue';
|
|
||||||
|
|
||||||
const wb = useWebSocket()
|
const wb = useWebSocket()
|
||||||
const wi = useIngame()
|
|
||||||
const $q = useQuasar();
|
|
||||||
|
|
||||||
const wiggleIdx = ref<number | null>(null)
|
const props = defineProps<{
|
||||||
let wiggleTimer: ReturnType<typeof setTimeout> | null = null
|
hand: Hand
|
||||||
|
isHandInactive?: boolean
|
||||||
|
self: Player | null
|
||||||
|
}>()
|
||||||
|
|
||||||
function triggerWiggle(index: number) {
|
const { hand, isHandInactive, self } = toRefs(props)
|
||||||
// clear previous timer if any
|
|
||||||
if (wiggleTimer) clearTimeout(wiggleTimer)
|
|
||||||
wiggleIdx.value = index
|
|
||||||
wiggleTimer = setTimeout(() => {
|
|
||||||
wiggleIdx.value = null
|
|
||||||
wiggleTimer = null
|
|
||||||
}, 700)
|
|
||||||
}
|
|
||||||
|
|
||||||
function handlePlayCard(index: number | null) {
|
function handlePlayCard(element: any, index: number | null) {
|
||||||
if (index === null) return
|
if (index === null) return
|
||||||
|
if (isHandInactive?.value) return
|
||||||
|
isHandInactive.value = true
|
||||||
|
|
||||||
|
const wiggleKeyframes = [
|
||||||
|
{ transform: 'translateX(0)' },
|
||||||
|
{ transform: 'translateX(-5px)' },
|
||||||
|
{ transform: 'translateX(5px)' },
|
||||||
|
{ transform: 'translateX(-5px)' },
|
||||||
|
{ transform: 'translateX(0)' }
|
||||||
|
];
|
||||||
|
|
||||||
|
const wiggleTiming = {
|
||||||
|
duration: 400,
|
||||||
|
iterations: 1,
|
||||||
|
easing: 'ease-in-out',
|
||||||
|
fill: 'forwards'
|
||||||
|
};
|
||||||
|
|
||||||
wb.sendAndWait("PlayCard", { cardindex: index })
|
wb.sendAndWait("PlayCard", { cardindex: index })
|
||||||
.catch((error) => {
|
.catch(() => {
|
||||||
triggerWiggle(index)
|
element.animate(wiggleKeyframes, wiggleTiming);
|
||||||
|
isHandInactive.value = false;
|
||||||
$q.notify({
|
|
||||||
message: error.message,
|
|
||||||
color: "negative",
|
|
||||||
position: "top"
|
|
||||||
})
|
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,16 +52,16 @@ function getCardImagePath(cardPath: string) {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="hand-container">
|
<div class="bottom-div hand-container">
|
||||||
<div id="card-slide" class="ingame-cards-slide">
|
<div id="card-slide" :class="'ingame-cards-slide ' + (isHandInactive ? 'inactive' : '' )">
|
||||||
<div class="cards-row">
|
<div class="cards-row">
|
||||||
<div v-for="card in (<GameInfo>wi.data)?.hand?.cards" :key="card.identifier" :class="['handcard', { wiggle: wiggleIdx === card.idx }]">
|
<div v-for="card in hand.cards" :key="card.identifier" class="handcard">
|
||||||
<div class="card-btn" aria-label="Play card">
|
<div class="card-btn" @click="handlePlayCard(this, card.idx)" aria-label="Play card">
|
||||||
<q-img :src="getCardImagePath(card.path)" v-on:click="handlePlayCard(card.idx)" :alt="card.identifier" class="card" />
|
<q-img :src="getCardImagePath(card.path)" :alt="card.identifier" class="card" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="(<GameInfo>wi.data)?.self?.dogLife" class="dog-actions">
|
<div v-if="self?.dogLife" class="dog-actions">
|
||||||
<q-btn color="negative" label="Skip Turn" @click="handleSkipDogLife" />
|
<q-btn color="negative" label="Skip Turn" @click="handleSkipDogLife" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -117,18 +119,6 @@ function getCardImagePath(cardPath: string) {
|
|||||||
width:120px;
|
width:120px;
|
||||||
border-radius:6px
|
border-radius:6px
|
||||||
}
|
}
|
||||||
.wiggle {
|
|
||||||
animation: wiggle 700ms ease-in-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes wiggle {
|
|
||||||
0% { transform: translateY(0) rotate(0deg); }
|
|
||||||
15% { transform: translateY(-8px) rotate(-6deg); }
|
|
||||||
35% { transform: translateY(0) rotate(6deg); }
|
|
||||||
55% { transform: translateY(-4px) rotate(-3deg); }
|
|
||||||
75% { transform: translateY(0) rotate(2deg); }
|
|
||||||
100% { transform: translateY(0) rotate(0deg); }
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-height: 500px) {
|
@media (max-height: 500px) {
|
||||||
.card {
|
.card {
|
||||||
|
|||||||
@@ -6,15 +6,12 @@ const props = defineProps<{ trick: Trick }>()
|
|||||||
const {trick } = toRefs(props)
|
const {trick } = toRefs(props)
|
||||||
|
|
||||||
const playedCards = computed(() => {
|
const playedCards = computed(() => {
|
||||||
if (!trick.value) return []
|
return [...trick.value.cards].map(card => {
|
||||||
let result: { cardId: string, player: string }[] = []
|
return {
|
||||||
for (const key in trick.value.cards) {
|
cardId: card[1].path,
|
||||||
result.push({
|
player: card[0].name
|
||||||
cardId: trick.value.cards[key]?.path ?? '',
|
}
|
||||||
player: key
|
})
|
||||||
})
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
})
|
})
|
||||||
|
|
||||||
function getCardImagePath(cardPath: string) {
|
function getCardImagePath(cardPath: string) {
|
||||||
|
|||||||
@@ -1,18 +1,15 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type {Round} from "@/types/GameSubTypes.ts";
|
import type {Round} from "@/types/GameSubTypes.ts";
|
||||||
import {computed, type ComputedRef} from "vue";
|
|
||||||
|
|
||||||
interface PlayerScore { name: string; tricks: number }
|
interface PlayerScore { name: string; tricks: number }
|
||||||
const props = defineProps<{ currentRound: Round }>()
|
const props = defineProps<{ currentRound: Round }>()
|
||||||
const playerScores: ComputedRef<PlayerScore[]> = computed(() => {
|
const playerScores: PlayerScore[] = props.currentRound.playersIn.map(player => {
|
||||||
return props.currentRound.playersIn.map(player => {
|
return {
|
||||||
return {
|
name: player.name,
|
||||||
name: player.name,
|
tricks: props.currentRound.trickList.filter(trick => {
|
||||||
tricks: props.currentRound.trickList.filter(trick => {
|
return trick.winner?.id === player.id
|
||||||
return trick.winner?.id === player.id
|
}).length
|
||||||
}).length
|
}
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -1,26 +1,26 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {computed, toRefs} from 'vue'
|
import { computed } from 'vue'
|
||||||
import type {PlayerQueue} from "@/types/GameSubTypes.ts";
|
import type {PlayerQueue} from "@/types/GameSubTypes.ts";
|
||||||
import {useIngame} from "@/composables/useIngame.ts";
|
|
||||||
import type {GameInfo} from "@/types/GameTypes.ts";
|
|
||||||
|
|
||||||
const ig = useIngame()
|
const props = defineProps<{
|
||||||
const currentPlayer = computed(() => (<GameInfo>ig.data).playerQueue.currentPlayer)
|
queue: PlayerQueue
|
||||||
const queue = computed(() => { return (<GameInfo>ig.data).playerQueue.queue ?? []})
|
}>()
|
||||||
|
|
||||||
|
const safeNextPlayers = computed(() => props.queue.players ?? [])
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<q-card flat class="turn-tracker-container q-pa-md no-background">
|
<q-card flat class="turn-tracker-container q-pa-md">
|
||||||
<q-card-section>
|
<q-card-section>
|
||||||
<div class="text-subtitle2 q-mb-xs">Current Player</div>
|
<div class="text-subtitle2 q-mb-xs">Current Player</div>
|
||||||
<div id="current-player-name" class="text-h6 text-weight-bold text-positive">{{
|
<div id="current-player-name" class="text-h6 text-weight-bold text-positive">{{
|
||||||
currentPlayer?.name
|
props.queue.currentPlayer?.name
|
||||||
}}</div>
|
}}</div>
|
||||||
|
|
||||||
<div v-if="queue.length > 0" class="q-mt-md">
|
<div v-if="safeNextPlayers.length > 0" class="q-mt-md">
|
||||||
<div id="next-players-text" class="text-subtitle2 q-mb-xs">Next Players</div>
|
<div id="next-players-text" class="text-subtitle2 q-mb-xs">Next Players</div>
|
||||||
<q-list id="next-players-container" dense>
|
<q-list id="next-players-container" dense>
|
||||||
<q-item v-for="player in queue" :key="player.id">
|
<q-item v-for="player in safeNextPlayers" :key="player.id">
|
||||||
<q-item-section>
|
<q-item-section>
|
||||||
<div class="text-body1 text-primary">{{ player.name }}</div>
|
<div class="text-body1 text-primary">{{ player.name }}</div>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
@@ -35,7 +35,4 @@ const queue = computed(() => { return (<GameInfo>ig.data).playerQueue.queue ?? [
|
|||||||
.turn-tracker-container {
|
.turn-tracker-container {
|
||||||
max-width: 320px;
|
max-width: 320px;
|
||||||
}
|
}
|
||||||
.no-background {
|
|
||||||
background: none !important;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,150 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import type {User} from "@/types/GameSubTypes.ts";
|
|
||||||
import {useIngame} from "@/composables/useIngame.ts";
|
|
||||||
import type {LobbyInfo} from "@/types/GameTypes.ts";
|
|
||||||
import {useWebSocket} from "@/composables/useWebsocket.ts";
|
|
||||||
import {computed} from "vue";
|
|
||||||
import router from "@/router";
|
|
||||||
import {useQuasar} from "quasar";
|
|
||||||
|
|
||||||
const wb = useWebSocket()
|
|
||||||
const ig = useIngame();
|
|
||||||
const $q = useQuasar();
|
|
||||||
|
|
||||||
const maxPlayers = computed(() => (<LobbyInfo>ig.data).maxPlayers);
|
|
||||||
const isHost = computed(() => (<LobbyInfo>ig.data).self.host);
|
|
||||||
const players = computed(() => {
|
|
||||||
return (<LobbyInfo>ig.data).users;
|
|
||||||
})
|
|
||||||
const lobbyName = computed(() => {
|
|
||||||
return `${ig.data?.gameId}`
|
|
||||||
});
|
|
||||||
|
|
||||||
const handleKickPlayer = (user: User) => {
|
|
||||||
if (isHost) {
|
|
||||||
wb.send("KickPlayer", {playerId: user.id})
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleStartGame = () => {
|
|
||||||
if (isHost) {
|
|
||||||
wb.sendAndWait("StartGame", {})
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleLeaveGame = (user: User) => {
|
|
||||||
wb.sendAndWait("LeaveGame", {user: user})
|
|
||||||
};
|
|
||||||
|
|
||||||
wb.useEvent("SessionClosed", () => {
|
|
||||||
$q.notify({
|
|
||||||
message: `You left the lobby.`,
|
|
||||||
color: "positive"
|
|
||||||
})
|
|
||||||
router.replace("/")
|
|
||||||
})
|
|
||||||
wb.useEvent("LeftEvent", () => {
|
|
||||||
$q.notify({
|
|
||||||
message: `You left the lobby.`,
|
|
||||||
color: "positive"
|
|
||||||
})
|
|
||||||
router.replace("/")
|
|
||||||
})
|
|
||||||
|
|
||||||
wb.useEvent("KickEvent", () => {
|
|
||||||
$q.notify({
|
|
||||||
message: `You were kicked from the lobby!`,
|
|
||||||
color: "amber"
|
|
||||||
})
|
|
||||||
router.replace("/")
|
|
||||||
})
|
|
||||||
const profileIcon = 'person';
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
|
|
||||||
<div class="row q-pa-md items-center">
|
|
||||||
<div class="col text-center text-h4 text-weight-medium">
|
|
||||||
Lobby Name: {{ lobbyName }} </div>
|
|
||||||
<q-btn
|
|
||||||
color="negative"
|
|
||||||
label="Exit"
|
|
||||||
@click="handleLeaveGame((<LobbyInfo>ig.data).self)"
|
|
||||||
class="q-ml-auto"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row q-pb-md">
|
|
||||||
<div class="col text-center text-subtitle1">
|
|
||||||
Players: {{ players.length }} / {{ maxPlayers }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row justify-center items-center flex-grow-1 q-px-md">
|
|
||||||
<div class="col-12">
|
|
||||||
<div class="row justify-center q-gutter-md">
|
|
||||||
<div v-for="player in players" :key="player.id" class="col-auto">
|
|
||||||
<q-card class="bg-dark q-pa-md text-center" style="width: 250px;">
|
|
||||||
|
|
||||||
<q-avatar size="80px" color="primary" text-color="white" :icon="profileIcon" class="q-mb-sm" />
|
|
||||||
|
|
||||||
<q-card-section>
|
|
||||||
<div class="text-h6">
|
|
||||||
{{ player.username }} <q-badge v-if="player.id === (<LobbyInfo>ig.data).self.id" color="orange" align="middle" class="q-ml-xs">
|
|
||||||
(You)
|
|
||||||
</q-badge>
|
|
||||||
<q-badge v-else-if="player.host" color="blue" align="middle" class="q-ml-xs">
|
|
||||||
(Host)
|
|
||||||
</q-badge>
|
|
||||||
</div>
|
|
||||||
</q-card-section>
|
|
||||||
|
|
||||||
<q-card-actions align="center" v-if="isHost">
|
|
||||||
<q-btn
|
|
||||||
v-if="player.id !== (<LobbyInfo>ig.data).self.id"
|
|
||||||
color="negative"
|
|
||||||
label="Remove"
|
|
||||||
@click="handleKickPlayer(player)"
|
|
||||||
class="full-width"
|
|
||||||
/>
|
|
||||||
<q-btn
|
|
||||||
v-else
|
|
||||||
color="negative"
|
|
||||||
label="Remove (Cannot Kick Self)"
|
|
||||||
disable
|
|
||||||
class="full-width"
|
|
||||||
/>
|
|
||||||
</q-card-actions>
|
|
||||||
|
|
||||||
</q-card>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row q-py-lg text-center">
|
|
||||||
<div class="col-12">
|
|
||||||
<template v-if="isHost">
|
|
||||||
<q-btn
|
|
||||||
color="positive"
|
|
||||||
label="Start Game"
|
|
||||||
size="lg"
|
|
||||||
@click="handleStartGame"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
<template v-else>
|
|
||||||
<div class="text-h6 q-mb-sm">
|
|
||||||
Waiting for the host to start the game...
|
|
||||||
</div>
|
|
||||||
<q-spinner
|
|
||||||
color="primary"
|
|
||||||
size="3em"
|
|
||||||
:thickness="2"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
</style>
|
|
||||||
@@ -2,7 +2,6 @@ import { defineStore } from 'pinia'
|
|||||||
import {ref, type Ref} from 'vue'
|
import {ref, type Ref} from 'vue'
|
||||||
import type {GameInfo, LobbyInfo, TieInfo, TrumpInfo, WonInfo} from "@/types/GameTypes.ts";
|
import type {GameInfo, LobbyInfo, TieInfo, TrumpInfo, WonInfo} from "@/types/GameTypes.ts";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import {initWebSocket} from "@/services/ws.ts";
|
|
||||||
|
|
||||||
const api = window?.__RUNTIME_CONFIG__?.API_URL;
|
const api = window?.__RUNTIME_CONFIG__?.API_URL;
|
||||||
|
|
||||||
@@ -15,8 +14,8 @@ export const useIngame = defineStore('ingame', () => {
|
|||||||
data.value = newData;
|
data.value = newData;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function requestGame(gameId: string) {
|
function requestGame(gameId: string) {
|
||||||
await axios.get(`${api}/status/${gameId}`, {withCredentials: true}).then((response) => {
|
axios.get(`${api}/status/${gameId}`, {withCredentials: true}).then((response) => {
|
||||||
setIngame(response.data.state, response.data.data);
|
setIngame(response.data.state, response.data.data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,15 +18,13 @@ export const useUserInfo = defineStore('userInfo', () => {
|
|||||||
gameId.value = id;
|
gameId.value = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function requestState() {
|
function requestState() {
|
||||||
await axios.get(`${api}/status`, {withCredentials: true}).then((response) => {
|
axios.get(`${api}/status`, {withCredentials: true}).then((response) => {
|
||||||
console.log("STATUS DATA:" + response.data.status + response.data.inGame)
|
|
||||||
username.value = response.data.username;
|
username.value = response.data.username;
|
||||||
if (response.data.gameId) {
|
if (response.data.ingame) {
|
||||||
console.log("GAMEID:" + response.data.gameId)
|
|
||||||
gameId.value = response.data.gameId;
|
gameId.value = response.data.gameId;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearUserInfo() {
|
function clearUserInfo() {
|
||||||
|
|||||||
@@ -37,12 +37,10 @@ export function useWebSocket() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
console.log("Registering event handler for " + event);
|
|
||||||
onEvent(event, wrapped);
|
onEvent(event, wrapped);
|
||||||
});
|
});
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
console.log("Unregistering event handler for " + event);
|
|
||||||
onEvent(event, () => {});
|
onEvent(event, () => {});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,15 +13,10 @@ import axios from 'axios'
|
|||||||
import VueAxios from 'vue-axios'
|
import VueAxios from 'vue-axios'
|
||||||
import {useUserInfo} from "@/composables/useUserInfo.ts";
|
import {useUserInfo} from "@/composables/useUserInfo.ts";
|
||||||
import 'animate.css/animate.min.css';
|
import 'animate.css/animate.min.css';
|
||||||
import {useIngame} from "@/composables/useIngame.ts";
|
|
||||||
import {initWebSocket} from "@/services/ws.ts";
|
|
||||||
|
|
||||||
const app = createApp(App)
|
const app = createApp(App)
|
||||||
const pinia = createPinia()
|
const pinia = createPinia()
|
||||||
|
|
||||||
app.use(pinia)
|
app.use(pinia)
|
||||||
const ui = useIngame();
|
|
||||||
initWebSocket(ui);
|
|
||||||
app.use(router)
|
app.use(router)
|
||||||
app.use(Quasar, {
|
app.use(Quasar, {
|
||||||
plugins: {
|
plugins: {
|
||||||
|
|||||||
@@ -7,14 +7,14 @@ import defaultMenu from "../components/DefaultMenu.vue"
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { useUserInfo } from "@/composables/useUserInfo";
|
import { useUserInfo } from "@/composables/useUserInfo";
|
||||||
import rulesView from "../components/Rules.vue";
|
import rulesView from "../components/Rules.vue";
|
||||||
import Game from "@/views/Game.vue";
|
|
||||||
const api = window?.__RUNTIME_CONFIG__?.API_URL;
|
const api = window?.__RUNTIME_CONFIG__?.API_URL;
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history: createWebHistory(import.meta.env.BASE_URL),
|
history: createWebHistory(import.meta.env.BASE_URL),
|
||||||
routes: [
|
routes: [
|
||||||
{
|
{
|
||||||
path: '/',
|
path: '/mainmenu/',
|
||||||
component: MainMenuView,
|
component: MainMenuView,
|
||||||
meta: { requiresAuth: true },
|
meta: { requiresAuth: true },
|
||||||
children: [
|
children: [
|
||||||
@@ -50,12 +50,6 @@ const router = createRouter({
|
|||||||
component: LoginView,
|
component: LoginView,
|
||||||
meta: { requiresAuth: false }
|
meta: { requiresAuth: false }
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: '/game',
|
|
||||||
name: 'game',
|
|
||||||
component: Game,
|
|
||||||
meta: {requiresAuth: true }
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -2,18 +2,13 @@
|
|||||||
// Reads runtime configuration injected into window.__RUNTIME_CONFIG__ (created by env.js at container start)
|
// Reads runtime configuration injected into window.__RUNTIME_CONFIG__ (created by env.js at container start)
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface Window { __RUNTIME_CONFIG__?: { API_URL?: string; WEBSOCKET_URL?: string } }
|
interface Window { __RUNTIME_CONFIG__?: { API_URL?: string } }
|
||||||
}
|
}
|
||||||
|
|
||||||
const runtime = (globalThis as any).__RUNTIME_CONFIG__ || {};
|
const runtime = (globalThis as any).__RUNTIME_CONFIG__ || {};
|
||||||
|
|
||||||
export const API_URL = runtime.API_URL || (import.meta.env.VITE_API_URL as string) || 'http://localhost:9000';
|
export const API_URL = runtime.API_URL || (import.meta.env.VITE_API_URL as string) || 'http://localhost:9000';
|
||||||
export const WEBSOCKET_URL = runtime.API_URL || (import.meta.env.VITE_WEBSOCKET_URL as string) || 'http://localhost:9000';
|
|
||||||
|
|
||||||
export function getApiUrl(): string {
|
export function getApiUrl(): string {
|
||||||
return API_URL;
|
return API_URL;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getWebsocketUrl(): string {
|
|
||||||
return WEBSOCKET_URL;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import {useIngame} from "@/composables/useIngame.ts";
|
import {useIngame} from "@/composables/useIngame.ts";
|
||||||
import type {GameInfo, LobbyInfo, TieInfo, TrumpInfo, WonInfo} from "@/types/GameTypes.ts";
|
import type {GameInfo, LobbyInfo, TieInfo, TrumpInfo, WonInfo} from "@/types/GameTypes.ts";
|
||||||
import router from "@/router";
|
|
||||||
|
|
||||||
const api = "localhost:9000"
|
const api = window.__RUNTIME_CONFIG__?.API_URL;
|
||||||
|
|
||||||
// ---------- Types ---------------------------------------------------------
|
// ---------- Types ---------------------------------------------------------
|
||||||
|
|
||||||
@@ -34,13 +33,10 @@ let ws: WebSocket | null = null;
|
|||||||
|
|
||||||
const pending = new Map<string, PendingEntry>();
|
const pending = new Map<string, PendingEntry>();
|
||||||
const handlers = new Map<string, HandlerFn>();
|
const handlers = new Map<string, HandlerFn>();
|
||||||
let uState: ReturnType<typeof useIngame> | null = null;
|
const uState = useIngame();
|
||||||
|
|
||||||
let heartbeatTimer: ReturnType<typeof setInterval> | null = null;
|
let heartbeatTimer: ReturnType<typeof setInterval> | null = null;
|
||||||
|
|
||||||
export function initWebSocket(ingameStore: ReturnType<typeof useIngame>) {
|
|
||||||
uState = ingameStore;
|
|
||||||
}
|
|
||||||
let defaultHandler: HandlerFn | null = null;
|
let defaultHandler: HandlerFn | null = null;
|
||||||
|
|
||||||
function uuid(): string {
|
function uuid(): string {
|
||||||
@@ -74,10 +70,6 @@ function stopHeartbeat() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setupSocketHandlers(socket: WebSocket) {
|
function setupSocketHandlers(socket: WebSocket) {
|
||||||
if (!uState) {
|
|
||||||
console.error("[WS] WebSocket module not initialized with Pinia store!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
socket.onmessage = async (raw) => {
|
socket.onmessage = async (raw) => {
|
||||||
console.debug("[WS] MESSAGE:", raw.data);
|
console.debug("[WS] MESSAGE:", raw.data);
|
||||||
|
|
||||||
@@ -108,11 +100,7 @@ function setupSocketHandlers(socket: WebSocket) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (state && stateData) {
|
if (state && stateData) {
|
||||||
console.debug("[WS] State change:", state, stateData);
|
uState.setIngame(state, stateData);
|
||||||
if(uState) {
|
|
||||||
console.debug("[WS] State change cascade:", state, stateData);
|
|
||||||
uState.setIngame(state, stateData);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Server event → handler branch
|
// Server event → handler branch
|
||||||
@@ -167,7 +155,7 @@ function setupSocketHandlers(socket: WebSocket) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// You redirect here — if you don’t want auto reconnect, keep as is.
|
// You redirect here — if you don’t want auto reconnect, keep as is.
|
||||||
router.replace("/");
|
location.href = "/mainmenu";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ type Player = {
|
|||||||
|
|
||||||
type PlayerQueue = {
|
type PlayerQueue = {
|
||||||
currentPlayer: Player | null
|
currentPlayer: Player | null
|
||||||
queue: Player[]
|
players: Player[]
|
||||||
}
|
}
|
||||||
|
|
||||||
type PodiumPlayer = {
|
type PodiumPlayer = {
|
||||||
@@ -34,7 +34,7 @@ type Round = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Trick = {
|
type Trick = {
|
||||||
cards: { [key: string]: Card} | null
|
cards: Map<Player, Card>
|
||||||
firstCard: Card | null
|
firstCard: Card | null
|
||||||
winner: Player | null
|
winner: Player | null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ const playerAmount = ref(2);
|
|||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const isLoading = ref(false);
|
const isLoading = ref(false);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const delay = (ms: number) => new Promise(resolve => setTimeout(resolve, ms));
|
||||||
const createGameQuasar = async () => {
|
const createGameQuasar = async () => {
|
||||||
if (!lobbyName.value) {
|
if (!lobbyName.value) {
|
||||||
$q.notify({ message: 'Lobby-Name wird benötigt', color: 'red', position: 'top', icon: 'cancel' });
|
$q.notify({ message: 'Lobby-Name wird benötigt', color: 'red', position: 'top', icon: 'cancel' });
|
||||||
@@ -26,7 +27,7 @@ const createGameQuasar = async () => {
|
|||||||
icon: 'check_circle',
|
icon: 'check_circle',
|
||||||
position: 'top'
|
position: 'top'
|
||||||
});
|
});
|
||||||
router.replace("/game")
|
router.push("/lobby")
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.log("ERROR:" + err)
|
console.log("ERROR:" + err)
|
||||||
}).finally(() =>
|
}).finally(() =>
|
||||||
|
|||||||
@@ -1,40 +1,26 @@
|
|||||||
<script lang="ts" setup>
|
<script setup lang="ts">
|
||||||
import {useWebSocket} from "@/composables/useWebsocket.ts";
|
import {useWebSocket} from "@/composables/useWebsocket.ts";
|
||||||
import {useIngame} from "@/composables/useIngame.ts";
|
import {useIngame} from "@/composables/useIngame.ts";
|
||||||
import Ingame from "@/components/Ingame.vue";
|
import Ingame from "@/components/Ingame.vue";
|
||||||
import {useUserInfo} from "@/composables/useUserInfo.ts";
|
import {useUserInfo} from "@/composables/useUserInfo.ts";
|
||||||
import LobbyComponent from "@/components/lobby/LobbyComponent.vue";
|
|
||||||
import {storeToRefs} from "pinia";
|
|
||||||
import {useQuasar} from "quasar";
|
|
||||||
import router from "@/router";
|
import router from "@/router";
|
||||||
|
|
||||||
const wb = useWebSocket()
|
const wb = useWebSocket()
|
||||||
const ig = useIngame()
|
const ig = useIngame()
|
||||||
const { state } = storeToRefs(ig)
|
|
||||||
const ui = useUserInfo()
|
const ui = useUserInfo()
|
||||||
const $q = useQuasar();
|
|
||||||
|
|
||||||
|
ui.requestState()
|
||||||
ui.requestState().then(() => {
|
if (ui.gameId) {
|
||||||
if (ui.gameId == null) {
|
ig.requestGame(ui.gameId)
|
||||||
$q.notify({
|
wb.connect()
|
||||||
message: "You're not in any game!",
|
} else {
|
||||||
color: "negative"
|
router.replace("/")
|
||||||
|
}
|
||||||
})
|
|
||||||
router.replace("/")
|
|
||||||
} else {
|
|
||||||
ig.requestGame(ui.gameId).then(() => {
|
|
||||||
wb.connect()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="lobby-background">
|
<div class="lobby-background">
|
||||||
<Ingame v-if="state === 'InGame'"/>
|
<Ingame v-if="ig.state === 'InGame'" />
|
||||||
<lobby-component v-if="state === 'Lobby'"/>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -42,6 +28,6 @@ ui.requestState().then(() => {
|
|||||||
.lobby-background {
|
.lobby-background {
|
||||||
background-color: var(--body-background-color);
|
background-color: var(--body-background-color);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-height: 100vh;
|
min-height:100vh;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ const startGameQuasar = async() => {
|
|||||||
icon: 'check_circle',
|
icon: 'check_circle',
|
||||||
position: 'top'
|
position: 'top'
|
||||||
});
|
});
|
||||||
router.replace("/game")
|
router.push("/lobby")
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
$q.notify({
|
$q.notify({
|
||||||
message: `Lobby "${lobbyCode.value}" nicht gefunden`,
|
message: `Lobby "${lobbyCode.value}" nicht gefunden`,
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ const onSubmit = () => {
|
|||||||
loginError.value = ''
|
loginError.value = ''
|
||||||
axios.post(`${api}/login`, {username: username.value, password: password.value}, {withCredentials: true}).then((response) => {
|
axios.post(`${api}/login`, {username: username.value, password: password.value}, {withCredentials: true}).then((response) => {
|
||||||
uInfo.setUserInfo(response.data.user.username, response.data.user.id)
|
uInfo.setUserInfo(response.data.user.username, response.data.user.id)
|
||||||
router.push("/")
|
router.push("/mainmenu")
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
loginError.value = 'Invalid username or password'
|
loginError.value = 'Invalid username or password'
|
||||||
}).finally(() =>
|
}).finally(() =>
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
MAJOR=0
|
MAJOR=0
|
||||||
MINOR=12
|
MINOR=13
|
||||||
PATCH=1
|
PATCH=0
|
||||||
|
|||||||
Reference in New Issue
Block a user