17 Commits
0.7.0 ... main

Author SHA1 Message Date
TeamCity
ee8523d51a ci: bump version to v0.14.0 2025-12-15 09:08:10 +00:00
70a44fd1ea feat(ui): FRO-5 Animation Card Played (#23)
Added a fade Up Out animation. Also added a sliding animation for the remaining cards

Co-authored-by: LQ63 <lkhermann@web.de>
Reviewed-on: #23
Co-authored-by: lq64 <lq@blackhole.local>
Co-committed-by: lq64 <lq@blackhole.local>
2025-12-15 10:06:02 +01:00
bb6355d9ed feat(ui): FRO-34 Lobby (#21)
Started with Lobby Component

Co-authored-by: LQ63 <lkhermann@web.de>
Co-authored-by: Janis <janis-e@gmx.de>
Reviewed-on: #21
Reviewed-by: Janis <janis-e@gmx.de>
Co-authored-by: lq64 <lq@blackhole.local>
Co-committed-by: lq64 <lq@blackhole.local>
2025-12-14 15:10:27 +01:00
TeamCity
f0623dbfb2 ci: bump version to v0.13.0 2025-12-11 10:02:21 +00:00
d73b4f396b feat(ui): FRO-35 Animations (#22)
Added animations for mainmenu

Co-authored-by: LQ63 <lkhermann@web.de>
Reviewed-on: #22
Co-authored-by: lq64 <lq@blackhole.local>
Co-committed-by: lq64 <lq@blackhole.local>
2025-12-11 11:00:49 +01:00
TeamCity
bda06a37cc ci: bump version to v0.12.1 2025-12-10 23:17:06 +00:00
39898ed03b feat/FRO-31: Added ingame (#20)
Force push of Janis ingame changes

Co-authored-by: Janis <janis.e.20@gmx.de>
Reviewed-on: #20
2025-12-11 00:15:50 +01:00
TeamCity
97b7df2a75 ci: bump version to v0.12.0 2025-12-10 19:32:59 +00:00
06f27d6813 feat: FRO-25 Create Game Info Component (#19)
Reviewed-on: #19
Co-authored-by: Janis <janis.e.20@gmx.de>
Co-committed-by: Janis <janis.e.20@gmx.de>
2025-12-10 20:31:36 +01:00
TeamCity
7c8cf6503b ci: bump version to v0.11.0 2025-12-10 16:09:56 +00:00
f05f10ea56 feat(ui): FRO-13 User Component (#18)
Added possibility to log off as a user

Co-authored-by: LQ63 <lkhermann@web.de>
Reviewed-on: #18
Reviewed-by: Janis <janis-e@gmx.de>
Co-authored-by: lq64 <lq@blackhole.local>
Co-committed-by: lq64 <lq@blackhole.local>
2025-12-10 17:08:23 +01:00
TeamCity
43920b25f3 ci: bump version to v0.10.0 2025-12-10 15:47:51 +00:00
21db939d34 feat: FRO-24 Create Played Cards Component (#17)
Reviewed-on: #17
Reviewed-by: lq64 <lq@blackhole.local>
Co-authored-by: Janis <janis.e.20@gmx.de>
Co-committed-by: Janis <janis.e.20@gmx.de>
2025-12-10 16:46:34 +01:00
TeamCity
0b05cba25f ci: bump version to v0.9.0 2025-12-10 14:47:18 +00:00
14e001cae6 feat(api): FRO-15 Join Game (#16)
Added join game functionality

Co-authored-by: LQ63 <lkhermann@web.de>
Reviewed-on: #16
Reviewed-by: Janis <janis-e@gmx.de>
Co-authored-by: lq64 <lq@blackhole.local>
Co-committed-by: lq64 <lq@blackhole.local>
2025-12-10 15:45:56 +01:00
TeamCity
fc60234faf ci: bump version to v0.8.0 2025-12-10 14:44:38 +00:00
b20ec0a363 feat: FRO-23 Create Player Hand Component (#15)
Reviewed-on: #15
Reviewed-by: lq64 <lq@blackhole.local>
Co-authored-by: Janis <janis.e.20@gmx.de>
Co-committed-by: Janis <janis.e.20@gmx.de>
2025-12-10 15:43:27 +01:00
90 changed files with 943 additions and 78 deletions

View File

@@ -78,3 +78,40 @@
### Features
* **api:** FRO-14 Create Game ([#14](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/issues/14)) ([df61db2](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/commit/df61db2730b5e6b2796cbe58d1d224f1d5d6f085))
## [0.0.0](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/compare/0.7.0...0.0.0) (2025-12-10)
### Features
* FRO-23 Create Player Hand Component ([#15](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/issues/15)) ([b20ec0a](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/commit/b20ec0a3638649155f2f9c5984014d75eb2ba618))
## [0.0.0](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/compare/0.8.0...0.0.0) (2025-12-10)
### Features
* **api:** FRO-15 Join Game ([#16](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/issues/16)) ([14e001c](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/commit/14e001cae67592c5ea15786905aa3574df9a9e6c))
## [0.0.0](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/compare/0.9.0...0.0.0) (2025-12-10)
### Features
* FRO-24 Create Played Cards Component ([#17](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/issues/17)) ([21db939](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/commit/21db939d342c72f5ad5fad3b4f873e902d1e5a0f))
## [0.0.0](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/compare/0.10.0...0.0.0) (2025-12-10)
### Features
* **ui:** FRO-13 User Component ([#18](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/issues/18)) ([f05f10e](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/commit/f05f10ea56b21f15cefbc76277ead5806eb1cf18))
## [0.0.0](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/compare/0.11.0...0.0.0) (2025-12-10)
### 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)
## [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))
## [0.0.0](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/compare/0.13.0...0.0.0) (2025-12-15)
### Features
* **ui:** FRO-34 Lobby ([#21](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/issues/21)) ([bb6355d](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/commit/bb6355d9ed6745b4852a52040d880ee1dcc6d797))
* **ui:** FRO-5 Animation Card Played ([#23](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/issues/23)) ([70a44fd](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/commit/70a44fd1ea119d43f875e6cfac56fb25747d8913))

2
env.d.ts vendored
View File

@@ -1,7 +1,7 @@
/// <reference types="vite/client" />
declare global {
interface Window { __RUNTIME_CONFIG__?: { API_URL?: string } }
interface Window { __RUNTIME_CONFIG__?: { API_URL?: string; WEBSOCKET_URL?: string } }
}
export {};

25
package-lock.json generated
View File

@@ -10,6 +10,7 @@
"dependencies": {
"@quasar/extras": "^1.17.0",
"@tsparticles/vue3": "~3.0.1",
"animate.css": "^4.1.1",
"axios": "^1.13.2",
"pinia": "^3.0.4",
"quasar": "^2.18.6",
@@ -73,7 +74,6 @@
"integrity": "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@babel/code-frame": "^7.27.1",
"@babel/generator": "^7.28.5",
@@ -2574,7 +2574,6 @@
"integrity": "sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"undici-types": "~7.16.0"
}
@@ -2625,7 +2624,6 @@
"integrity": "sha512-PC0PDZfJg8sP7cmKe6L3QIL8GZwU5aRvUFedqSIpw3B+QjRSUZeeITC2M5XKeMXEzL6wccN196iy3JLwKNvDVA==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@typescript-eslint/scope-manager": "8.48.1",
"@typescript-eslint/types": "8.48.1",
@@ -2843,7 +2841,6 @@
"integrity": "sha512-iHmwV3QcVGGvSC1BG5bZ4z6iwa1SOpAPWmnjOErd4Ske+lZua5K9TtAVdx0gMBClJ28DViCbSmZitjWZsWO3LA==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@rolldown/pluginutils": "1.0.0-beta.50"
},
@@ -3230,7 +3227,6 @@
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
"dev": true,
"license": "MIT",
"peer": true,
"bin": {
"acorn": "bin/acorn"
},
@@ -3272,6 +3268,12 @@
"dev": true,
"license": "MIT"
},
"node_modules/animate.css": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/animate.css/-/animate.css-4.1.1.tgz",
"integrity": "sha512-+mRmCTv6SbCmtYJCN4faJMNFVNN5EuCTTprDTAo7YzIGji2KADmakjVA3+8mVDkZ2Bf09vayB35lSQIex2+QaQ==",
"license": "MIT"
},
"node_modules/ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
@@ -3316,7 +3318,6 @@
"resolved": "https://registry.npmjs.org/axios/-/axios-1.13.2.tgz",
"integrity": "sha512-VPk9ebNqPcy5lRGuSlKx752IlDatOjT9paPlm8A7yOuW2Fbvp4X3JznJtT4f0GzGLLiWE9W8onz51SqLYwzGaA==",
"license": "MIT",
"peer": true,
"dependencies": {
"follow-redirects": "^1.15.6",
"form-data": "^4.0.4",
@@ -3399,7 +3400,6 @@
}
],
"license": "MIT",
"peer": true,
"dependencies": {
"baseline-browser-mapping": "^2.9.0",
"caniuse-lite": "^1.0.30001759",
@@ -3867,7 +3867,6 @@
"integrity": "sha512-BhHmn2yNOFA9H9JmmIVKJmd288g9hrVRDkdoIgRCRuSySRUHH7r/DI6aAXW9T1WwUuY3DFgrcaqB+deURBLR5g==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.8.0",
"@eslint-community/regexpp": "^4.12.1",
@@ -3928,7 +3927,6 @@
"integrity": "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==",
"dev": true,
"license": "MIT",
"peer": true,
"bin": {
"eslint-config-prettier": "bin/cli.js"
},
@@ -3976,7 +3974,6 @@
"integrity": "sha512-SbR9ZBUFKgvWAbq3RrdCtWaW0IKm6wwUiApxf3BVTNfqUIo4IQQmreMg2iHFJJ6C/0wss3LXURBJ1OwS/MhFcQ==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.4.0",
"natural-compare": "^1.4.0",
@@ -4658,7 +4655,6 @@
"integrity": "sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ==",
"dev": true,
"license": "MIT",
"peer": true,
"bin": {
"jiti": "lib/jiti-cli.mjs"
}
@@ -5344,7 +5340,6 @@
"integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==",
"dev": true,
"license": "MIT",
"peer": true,
"bin": {
"prettier": "bin/prettier.cjs"
},
@@ -5389,7 +5384,6 @@
"resolved": "https://registry.npmjs.org/quasar/-/quasar-2.18.6.tgz",
"integrity": "sha512-ZlK+vJXOBPSFDCNQDBDNwSI+AHoqaFPxK8ve6mhsYLhMKWI5b8zsGY9VU1xYjngO2aBvU4fvGWXy4tTbzrBk8Q==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">= 10.18.1",
"npm": ">= 6.13.4",
@@ -6150,7 +6144,6 @@
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=12"
},
@@ -6255,7 +6248,6 @@
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
"devOptional": true,
"license": "Apache-2.0",
"peer": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
@@ -6386,7 +6378,6 @@
"integrity": "sha512-tI2l/nFHC5rLh7+5+o7QjKjSR04ivXDF4jcgV0f/bTQ+OJiITy5S6gaynVsEM+7RqzufMnVbIon6Sr5x1SDYaQ==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"esbuild": "^0.25.0",
"fdir": "^6.5.0",
@@ -6637,7 +6628,6 @@
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=12"
},
@@ -6657,7 +6647,6 @@
"resolved": "https://registry.npmjs.org/vue/-/vue-3.5.25.tgz",
"integrity": "sha512-YLVdgv2K13WJ6n+kD5owehKtEXwdwXuj2TTyJMsO7pSeKw2bfRNZGjhB7YzrpbMYj5b5QsUebHpOqR3R3ziy/g==",
"license": "MIT",
"peer": true,
"dependencies": {
"@vue/compiler-dom": "3.5.25",
"@vue/compiler-sfc": "3.5.25",

View File

@@ -17,14 +17,15 @@
},
"dependencies": {
"@quasar/extras": "^1.17.0",
"quasar": "^2.18.6",
"vue": "^3.5.25",
"vue-router": "^4.6.3",
"tsparticles": "~3.9.1",
"@tsparticles/vue3": "~3.0.1",
"animate.css": "^4.1.1",
"axios": "^1.13.2",
"pinia": "^3.0.4",
"quasar": "^2.18.6",
"tsparticles": "~3.9.1",
"vue": "^3.5.25",
"vue-axios": "^3.5.2",
"pinia": "^3.0.4"
"vue-router": "^4.6.3"
},
"devDependencies": {
"@quasar/vite-plugin": "^1.10.0",

View File

@@ -1,4 +1,5 @@
window.__RUNTIME_CONFIG__ = {
API_URL: "http://localhost:9000"
API_URL: "http://localhost:9000",
WEBSOCKET_API_URL: "ws://localhost:9000/websocket"
};

View File

@@ -1,4 +1,5 @@
window.__RUNTIME_CONFIG__ = {
API_URL: "${API_URL}"
API_URL: "${API_URL}",
WEBSOCKET_API_URL: "${WEBSOCKET_API_URL}"
};

BIN
public/images/cards/1B.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

BIN
public/images/cards/1J.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
public/images/cards/2B.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
public/images/cards/2C.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

BIN
public/images/cards/2D.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

BIN
public/images/cards/2H.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

BIN
public/images/cards/2J.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
public/images/cards/2S.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

BIN
public/images/cards/3C.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
public/images/cards/3D.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

BIN
public/images/cards/3H.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

BIN
public/images/cards/3S.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

BIN
public/images/cards/4C.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

BIN
public/images/cards/4D.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

BIN
public/images/cards/4H.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

BIN
public/images/cards/4S.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

BIN
public/images/cards/5C.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
public/images/cards/5D.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

BIN
public/images/cards/5H.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

BIN
public/images/cards/5S.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
public/images/cards/6C.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
public/images/cards/6D.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

BIN
public/images/cards/6H.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

BIN
public/images/cards/6S.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
public/images/cards/7C.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
public/images/cards/7D.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

BIN
public/images/cards/7H.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

BIN
public/images/cards/7S.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
public/images/cards/8C.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
public/images/cards/8D.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
public/images/cards/8H.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
public/images/cards/8S.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
public/images/cards/9C.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
public/images/cards/9D.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
public/images/cards/9H.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
public/images/cards/9S.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
public/images/cards/AC.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

BIN
public/images/cards/ACB.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
public/images/cards/AD.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

BIN
public/images/cards/ADB.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
public/images/cards/AH.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

BIN
public/images/cards/AHB.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
public/images/cards/AS.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
public/images/cards/ASB.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
public/images/cards/JC.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

BIN
public/images/cards/JD.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

BIN
public/images/cards/JH.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

BIN
public/images/cards/JS.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

BIN
public/images/cards/KC.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

BIN
public/images/cards/KD.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

BIN
public/images/cards/KH.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

BIN
public/images/cards/KS.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

BIN
public/images/cards/QC.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
public/images/cards/QD.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

BIN
public/images/cards/QH.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

BIN
public/images/cards/QS.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

BIN
public/images/cards/TC.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
public/images/cards/TD.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
public/images/cards/TH.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
public/images/cards/TS.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

80
src/components/Ingame.vue Normal file
View File

@@ -0,0 +1,80 @@
<script setup lang="ts">
import {useIngame} from "@/composables/useIngame.ts";
import type {GameInfo} from "@/types/GameTypes.ts";
import HandC from "@/components/ingame/HandC.vue";
import GameInfoC from "@/components/ingame/GameInfoC.vue";
import PlayedCardsC from "@/components/ingame/PlayedCardsC.vue";
import ScoreboardC from "@/components/ingame/ScoreboardC.vue";
import TurnC from "@/components/ingame/TurnC.vue";
const ig = useIngame()
</script>
<template>
<q-layout>
<q-page-container>
<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">
<div class="mt-5 ml-4 self-start col-2">
<TurnC v-if="(ig.data as GameInfo)?.playerQueue" :queue="(ig.data as GameInfo).playerQueue!"/>
</div>
<div class="text-center col-6">
<ScoreboardC v-if="(ig.data as GameInfo)?.currentRound" :current-round="(ig.data as GameInfo).currentRound!" />
</div>
<div class="mt-5 ml-4 self-end col-2" style="margin-left: 6em">
<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 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-page>
</q-page-container>
</q-layout>
</template>
<style scoped>
.game-field-background {
background-image: var(--body-background-color);
background-repeat: no-repeat;
background-size: cover;
max-width: 1400px;
margin: 0 auto;
min-height: 100vh;
}
.ingame-side-shadow {
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>

View File

@@ -39,12 +39,20 @@ const navigateTo = (routeName: string) => {
</script>
<template>
<div class="row q-col-gutter-md justify-center" style="width: 100%; max-width: 1000px;">
<transition-group
appear
enter-active-class="animate__animated animate__fadeIn"
leave-active-class="animate__animated animate__fadeOut"
tag="div"
class="row q-col-gutter-md justify-center"
style="width: 100%; max-width: 1000px;"
>
<div
v-for="(item, index) in menuItems"
:key="index"
class="col-12 col-sm-6 col-md-4"
:style="{ animationDuration: '1.6s', animationDelay: `${index * 0.3 + 0.5}s` }"
>
<q-card
class="menu-card bg-dark text-white q-pa-sm cursor-pointer"
@@ -68,7 +76,7 @@ const navigateTo = (routeName: string) => {
</q-card-section>
</q-card>
</div>
</div>
</transition-group>
</template>
<style scoped>
@@ -77,7 +85,6 @@ const navigateTo = (routeName: string) => {
border: 1px solid rgba(255, 255, 255, 0.1);
}
/* Hover-Effekt für die Karten */
.menu-card:hover {
transform: translateY(-5px);
background-color: #2c3e50 !important;

81
src/components/User.vue Normal file
View File

@@ -0,0 +1,81 @@
<script setup lang="ts">
import { useUserInfo } from "@/composables/useUserInfo.ts";
import { useRouter } from 'vue-router';
import {useQuasar} from "quasar";
import axios from "axios";
const api = window?.__RUNTIME_CONFIG__?.API_URL;
const $q = useQuasar()
let userinfo = useUserInfo();
const router = useRouter();
const handleLogoff = () => {
axios.post(`${api}/logout`, {}, {withCredentials: true}).then((response) => {
const responseData = response.data
console.log("Response" + responseData.status)
$q.notify({
message: `You successfully logged out!`,
color: 'green-6',
icon: 'check_circle',
position: 'top'
});
router.push({ name: 'login' });
}).catch((err) => {
console.log("ERROR:" + err)
$q.notify({
message: `Something went wrong`,
color: 'red-6',
icon: 'cancel',
position: 'top'
});
})
}
</script>
<template>
<div class="row items-center q-gutter-x-md">
<div
v-if="userinfo.username"
class="text-body1 text-weight-medium row items-center q-gutter-x-sm cursor-pointer relative-position"
>
<div id="user-menu-target" class="row items-center q-gutter-x-sm" style="min-width: 150px">
<q-icon name="account_circle" size="md" />
<span>{{ userinfo.username }}</span>
<q-icon name="arrow_drop_down" size="sm" />
</div>
<q-menu
target="#user-menu-target"
anchor="bottom right"
self="top right"
>
<q-list style="max-width: 150px" class="bg-dark">
<q-item
clickable
v-close-popup
@click="handleLogoff"
class="text-negative"
>
<q-item-section avatar>
<q-icon name="logout" color="negative" />
</q-item-section>
<q-item-section>Log Off</q-item-section>
</q-item>
</q-list>
</q-menu>
</div>
<div v-else class="text-caption text-grey-4">
Not Logged In
</div>
</div>
</template>
<style scoped>
#user-menu-target:hover {
opacity: 0.8;
}
</style>

View File

@@ -0,0 +1,55 @@
<script lang="ts" setup>
import type {Card} from "@/types/GameSubTypes.ts";
import {computed, toRefs} from "vue";
const props = defineProps<{
trumpsuit: Card
firstCard: Card | null
}>()
const {trumpsuit, firstCard} = toRefs(props)
const trumpName = computed(() => {
switch (trumpsuit.value.identifier.charAt(1) as string) {
case 'S':
return 'Spades'
case 'H':
return 'Hearts'
case 'D':
return 'Diamonds'
case 'C':
return 'Clubs'
default:
return 'Unknown'
}
})
</script>
<template>
<div>
<div class="q-mb-sm">
<div class="text-h6 q-mb-xs q-font-medium">Trumpsuit</div>
<div id="trumpsuit" class="text-h5 text-primary">{{ trumpName }}</div>
</div>
<div class="q-mt-md">
<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"
style="display:inline-block;">
<q-img v-if="firstCard" :src="firstCard.path" alt="First Card" class="firstbox"
style="width: 80px; border-radius: 6px;"/>
<q-img v-else src="/images/cards/1B.png" alt="First Card" class="firstbox"
style="width: 80px; border-radius: 6px;"/>
</div>
</div>
</div>
</template>
<style scoped>
.firstbox {
width: 80px;
border-radius: 6px;
}
</style>

View File

@@ -0,0 +1,165 @@
<script lang="ts" setup>
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 wi = useIngame()
const $q = useQuasar();
const wiggleIdx = ref<number | null>(null)
let wiggleTimer: ReturnType<typeof setTimeout> | null = null
function triggerWiggle(index: number) {
// 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) {
if (index === null) return
wb.sendAndWait("PlayCard", { cardindex: index }).catch((error) => {
triggerWiggle(index)
$q.notify({
message: error.message,
color: "negative",
position: "top"
})
})
}
function onBeforeLeave(el: Element) {
const element = el as HTMLElement;
const { marginLeft, marginTop, width, height } = window.getComputedStyle(element);
element.style.left = `${element.offsetLeft - parseFloat(marginLeft)}px`;
element.style.top = `${element.offsetTop - parseFloat(marginTop)}px`;
element.style.width = width;
element.style.height = height;
}
function handleSkipDogLife() {
//TODO: Add some animation or feedback for skipping turn
}
function getCardImagePath(cardPath: string) {
if (!cardPath) return ''
if (cardPath.includes('://') || cardPath.startsWith('/')) return cardPath
return `/${cardPath}`
}
</script>
<template>
<div class="hand-container">
<div id="card-slide" class="ingame-cards-slide">
<transition-group
tag="div"
class="cards-row"
name="card-move"
enter-active-class="animate__animated animate__fadeIn"
@before-leave="onBeforeLeave"
move-class="card-moving">
<div v-for="card in (<GameInfo>wi.data)?.hand?.cards" :key="card.identifier" :class="['handcard', { wiggle: wiggleIdx === card.idx }]">
<div class="card-btn" aria-label="Play card">
<q-img :src="getCardImagePath(card.path)" v-on:click="handlePlayCard(card.idx)" :alt="card.identifier" class="card" />
</div>
</div>
</transition-group>
<div v-if="(<GameInfo>wi.data)?.self?.dogLife" class="dog-actions">
<q-btn color="negative" label="Skip Turn" @click="handleSkipDogLife" />
</div>
</div>
</div>
</template>
<style scoped>
.bottom-div {
position: fixed;
bottom: 0;
left: 50%;
transform: translateX(-50%);
max-width: 1400px;
width: 100%;
margin: 0;
text-align: center;
padding: 10px;
}
.hand-container {
margin-left: 0;
margin-right: 0;
}
.ingame-cards-slide {
display: flex;
flex-direction: column;
align-items: center;
gap: 8px;
}
.cards-row {
display: flex;
flex-wrap: nowrap;
gap: 8px;
align-items: flex-end;
justify-content: center;
}
.handcard {
border-radius: 6px;
}
.card-btn {
padding: 0;
min-width: 0;
border-radius: 6px;
}
.inactive {
opacity: 0.6;
pointer-events: none;
}
.dog-actions {
margin-top: 8px;
}
.handcard :hover {
box-shadow: 3px 3px 3px #000000;
}
.card {
width:120px;
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) {
.card {
width: 80px;
border-radius: 4px;
}
}
.card-moving {
transition: transform 0.5s ease;
transition-delay: 1s;
}
.card-move-leave-active {
position: absolute;
transition: all 0.5s ease;
pointer-events: none;
}
.card-move-leave-to {
opacity: 0;
transform: translateY(-400px);
}
</style>

View File

@@ -0,0 +1,46 @@
<script lang="ts" setup>
import {computed, defineProps, toRefs} from 'vue'
import type {Trick} from "@/types/GameSubTypes.ts";
const props = defineProps<{ trick: Trick }>()
const {trick } = toRefs(props)
const playedCards = computed(() => {
if (!trick.value) return []
let result: { cardId: string, player: string }[] = []
for (const key in trick.value.cards) {
result.push({
cardId: trick.value.cards[key]?.path ?? '',
player: key
})
}
return result;
})
function getCardImagePath(cardPath: string) {
if (!cardPath) return ''
if (cardPath.includes('://') || cardPath.startsWith('/')) return cardPath
return `/${cardPath}`
}
</script>
<template>
<div class="row items-center justify-center q-gutter-sm" id="trick-cards-content">
<div v-for="(play, index) in playedCards" :key="index" class="col-auto">
<q-card flat class="bg-transparent trick-card" style="width: 7rem; backdrop-filter: blur(4px);">
<q-card-section class="q-pa-sm q-pb-xs">
<q-img :src="getCardImagePath(play.cardId)" alt="card" style="border-radius: 6px; width:100%" />
</q-card-section>
<q-card-section class="q-pa-sm q-pt-xs text-center bg-transparent">
<div class="text-subtitle2 text-grey-7">{{ play.player }}</div>
</q-card-section>
</q-card>
</div>
</div>
</template>
<style scoped>
.trick-card {
box-shadow: 0 1px 6px rgba(0,0,0,0.08);
}
</style>

View File

@@ -1,15 +1,18 @@
<script setup lang="ts">
import type {Round} from "@/types/GameSubTypes.ts";
import {computed, type ComputedRef} from "vue";
interface PlayerScore { name: string; tricks: number }
const props = defineProps<{ currentRound: Round }>()
const playerScores: PlayerScore[] = props.currentRound.playersIn.map(player => {
return {
name: player.name,
tricks: props.currentRound.trickList.filter(trick => {
return trick.winner?.id === player.id
}).length
}
const playerScores: ComputedRef<PlayerScore[]> = computed(() => {
return props.currentRound.playersIn.map(player => {
return {
name: player.name,
tricks: props.currentRound.trickList.filter(trick => {
return trick.winner?.id === player.id
}).length
}
})
})
</script>

View File

@@ -1,26 +1,26 @@
<script setup lang="ts">
import { computed } from 'vue'
import {computed, toRefs} from 'vue'
import type {PlayerQueue} from "@/types/GameSubTypes.ts";
import {useIngame} from "@/composables/useIngame.ts";
import type {GameInfo} from "@/types/GameTypes.ts";
const props = defineProps<{
queue: PlayerQueue
}>()
const safeNextPlayers = computed(() => props.queue.players ?? [])
const ig = useIngame()
const currentPlayer = computed(() => (<GameInfo>ig.data).playerQueue.currentPlayer)
const queue = computed(() => { return (<GameInfo>ig.data).playerQueue.queue ?? []})
</script>
<template>
<q-card flat class="turn-tracker-container q-pa-md">
<q-card flat class="turn-tracker-container q-pa-md no-background">
<q-card-section>
<div class="text-subtitle2 q-mb-xs">Current Player</div>
<div id="current-player-name" class="text-h6 text-weight-bold text-positive">{{
props.queue.currentPlayer?.name
currentPlayer?.name
}}</div>
<div v-if="safeNextPlayers.length > 0" class="q-mt-md">
<div v-if="queue.length > 0" class="q-mt-md">
<div id="next-players-text" class="text-subtitle2 q-mb-xs">Next Players</div>
<q-list id="next-players-container" dense>
<q-item v-for="player in safeNextPlayers" :key="player.id">
<q-item v-for="player in queue" :key="player.id">
<q-item-section>
<div class="text-body1 text-primary">{{ player.name }}</div>
</q-item-section>
@@ -35,4 +35,7 @@ const safeNextPlayers = computed(() => props.queue.players ?? [])
.turn-tracker-container {
max-width: 320px;
}
.no-background {
background: none !important;
}
</style>

View File

@@ -0,0 +1,150 @@
<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>

View File

@@ -0,0 +1,30 @@
import { defineStore } from 'pinia'
import {ref, type Ref} from 'vue'
import type {GameInfo, LobbyInfo, TieInfo, TrumpInfo, WonInfo} from "@/types/GameTypes.ts";
import axios from "axios";
import {initWebSocket} from "@/services/ws.ts";
const api = window?.__RUNTIME_CONFIG__?.API_URL;
export const useIngame = defineStore('ingame', () => {
const state: Ref<'Lobby' | 'InGame' | 'SelectTrump' | 'TieBreak' | 'FinishedMatch' | null> = ref(null);
const data: Ref<GameInfo | LobbyInfo | TieInfo | TrumpInfo | WonInfo | null> = ref(null);
function setIngame(newState: 'Lobby' | 'InGame' | 'SelectTrump' | 'TieBreak' | 'FinishedMatch', newData: GameInfo | LobbyInfo | TieInfo | TrumpInfo | WonInfo) {
state.value = newState;
data.value = newData;
}
async function requestGame(gameId: string) {
await axios.get(`${api}/status/${gameId}`, {withCredentials: true}).then((response) => {
setIngame(response.data.state, response.data.data);
});
}
function clearIngame() {
state.value = null;
data.value = null;
}
return { state, data, requestGame, setIngame, clearIngame };
});

View File

@@ -1,19 +1,42 @@
import { defineStore } from 'pinia'
import {ref, type Ref} from 'vue'
import axios from "axios";
const api = window?.__RUNTIME_CONFIG__?.API_URL;
export const useUserInfo = defineStore('userInfo', () => {
const username: Ref<string | null> = ref(null);
const userId: Ref<number | null> = ref(null);
const gameId: Ref<string | null> = ref(null);
function setUserInfo(name: string, id: number) {
username.value = name;
userId.value = id;
}
function setGameId(id: string) {
gameId.value = id;
}
async function requestState() {
await 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.gameId) {
console.log("GAMEID:" + response.data.gameId)
gameId.value = response.data.gameId;
}
})
}
function clearUserInfo() {
username.value = null;
userId.value = null;
}
return { username, userId, setUserInfo, clearUserInfo };
function clearGameId() {
gameId.value = null;
}
return { username, userId, gameId, setUserInfo, requestState, clearUserInfo, setGameId, clearGameId };
});

View File

@@ -6,8 +6,13 @@ import {
sendEventAndWait,
onEvent,
isWebSocketConnected,
setDefaultHandler,
} from "@/services/ws";
function defaultEventHandler<T = any>(data: (data: T) => void) {
setDefaultHandler(data);
}
export function useWebSocket() {
const isConnected = ref(isWebSocketConnected());
const lastMessage = ref<any>(null);
@@ -32,10 +37,12 @@ export function useWebSocket() {
};
onMounted(() => {
console.log("Registering event handler for " + event);
onEvent(event, wrapped);
});
onBeforeUnmount(() => {
console.log("Unregistering event handler for " + event);
onEvent(event, () => {});
});
}
@@ -51,5 +58,6 @@ export function useWebSocket() {
sendAndWait: sendEventAndWait,
useEvent,
defaultEventHandler
};
}

View File

@@ -12,11 +12,16 @@ import { createPinia } from 'pinia'
import axios from 'axios'
import VueAxios from 'vue-axios'
import {useUserInfo} from "@/composables/useUserInfo.ts";
import 'animate.css/animate.min.css';
import {useIngame} from "@/composables/useIngame.ts";
import {initWebSocket} from "@/services/ws.ts";
const app = createApp(App)
const pinia = createPinia()
app.use(pinia)
const ui = useIngame();
initWebSocket(ui);
app.use(router)
app.use(Quasar, {
plugins: {

View File

@@ -7,14 +7,14 @@ import defaultMenu from "../components/DefaultMenu.vue"
import axios from "axios";
import { useUserInfo } from "@/composables/useUserInfo";
import rulesView from "../components/Rules.vue";
import Game from "@/views/Game.vue";
const api = window?.__RUNTIME_CONFIG__?.API_URL;
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes: [
{
path: '/mainmenu/',
path: '/',
component: MainMenuView,
meta: { requiresAuth: true },
children: [
@@ -50,6 +50,12 @@ const router = createRouter({
component: LoginView,
meta: { requiresAuth: false }
},
{
path: '/game',
name: 'game',
component: Game,
meta: {requiresAuth: true }
}
],
})

View File

@@ -2,13 +2,18 @@
// Reads runtime configuration injected into window.__RUNTIME_CONFIG__ (created by env.js at container start)
declare global {
interface Window { __RUNTIME_CONFIG__?: { API_URL?: string } }
interface Window { __RUNTIME_CONFIG__?: { API_URL?: string; WEBSOCKET_URL?: string } }
}
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 WEBSOCKET_URL = runtime.API_URL || (import.meta.env.VITE_WEBSOCKET_URL as string) || 'http://localhost:9000';
export function getApiUrl(): string {
return API_URL;
}
export function getWebsocketUrl(): string {
return WEBSOCKET_URL;
}

View File

@@ -1,4 +1,8 @@
const api = window.__RUNTIME_CONFIG__?.API_URL;
import {useIngame} from "@/composables/useIngame.ts";
import type {GameInfo, LobbyInfo, TieInfo, TrumpInfo, WonInfo} from "@/types/GameTypes.ts";
import router from "@/router";
const api = "localhost:9000"
// ---------- Types ---------------------------------------------------------
@@ -6,6 +10,8 @@ export type ServerMessage<T = any> = {
id?: string;
event?: string;
status?: "success" | "error";
state?: "Lobby" | "InGame" | "SelectTrump" | "TieBreak" | "FinishedMatch";
stateData?: GameInfo | LobbyInfo | TieInfo | TrumpInfo | WonInfo;
data?: T;
error?: string;
};
@@ -28,9 +34,15 @@ let ws: WebSocket | null = null;
const pending = new Map<string, PendingEntry>();
const handlers = new Map<string, HandlerFn>();
let uState: ReturnType<typeof useIngame> | null = null;
let heartbeatTimer: ReturnType<typeof setInterval> | null = null;
export function initWebSocket(ingameStore: ReturnType<typeof useIngame>) {
uState = ingameStore;
}
let defaultHandler: HandlerFn | null = null;
function uuid(): string {
return crypto.randomUUID();
}
@@ -62,6 +74,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);
@@ -73,7 +89,7 @@ function setupSocketHandlers(socket: WebSocket) {
return;
}
const { id, event, status, data } = msg;
const { id, event, state, stateData, status, data } = msg;
// RPC response branch
if (id && status) {
@@ -91,6 +107,14 @@ function setupSocketHandlers(socket: WebSocket) {
return;
}
if (state && stateData) {
console.debug("[WS] State change:", state, stateData);
if(uState) {
console.debug("[WS] State change cascade:", state, stateData);
uState.setIngame(state, stateData);
}
}
// Server event → handler branch
if (id && event) {
const handler = handlers.get(event);
@@ -103,7 +127,17 @@ function setupSocketHandlers(socket: WebSocket) {
if (!handler) {
console.warn("[WS] No handler for event:", event);
reply("error", `No handler for '${event}'`);
if (defaultHandler) {
try {
await defaultHandler(data ?? {});
reply("success");
} catch (err) {
reply("error", (err as Error).message);
}
} else {
reply("error", `No handler for '${event}'`);
}
return;
}
@@ -133,7 +167,7 @@ function setupSocketHandlers(socket: WebSocket) {
}
// You redirect here — if you dont want auto reconnect, keep as is.
location.href = "/mainmenu";
router.replace("/");
};
}
@@ -232,5 +266,9 @@ export function onEvent(event: string, handler: HandlerFn) {
handlers.set(event, handler);
}
export function setDefaultHandler(handler: HandlerFn) {
defaultHandler = handler;
}
export const isWebSocketConnected = () =>
!!ws && ws.readyState === WebSocket.OPEN;

View File

@@ -11,12 +11,12 @@ type Hand = {
type Player = {
id: string
name: string
dogLife: string
dogLife: boolean
}
type PlayerQueue = {
currentPlayer: Player | null
players: Player[]
queue: Player[]
}
type PodiumPlayer = {
@@ -34,7 +34,7 @@ type Round = {
}
type Trick = {
cards: { [player: string]: Card }
cards: { [key: string]: Card} | null
firstCard: Card | null
winner: Player | null
}

View File

@@ -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' });
@@ -27,7 +26,7 @@ const createGameQuasar = async () => {
icon: 'check_circle',
position: 'top'
});
router.push("/lobby")
router.replace("/game")
}).catch((err) => {
console.log("ERROR:" + err)
}).finally(() =>

47
src/views/Game.vue Normal file
View File

@@ -0,0 +1,47 @@
<script lang="ts" setup>
import {useWebSocket} from "@/composables/useWebsocket.ts";
import {useIngame} from "@/composables/useIngame.ts";
import Ingame from "@/components/Ingame.vue";
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";
const wb = useWebSocket()
const ig = useIngame()
const { state } = storeToRefs(ig)
const ui = useUserInfo()
const $q = useQuasar();
ui.requestState().then(() => {
if (ui.gameId == null) {
$q.notify({
message: "You're not in any game!",
color: "negative"
})
router.replace("/")
} else {
ig.requestGame(ui.gameId).then(() => {
wb.connect()
})
}
})
</script>
<template>
<div class="lobby-background">
<Ingame v-if="state === 'InGame'"/>
<lobby-component v-if="state === 'Lobby'"/>
</div>
</template>
<style scoped>
.lobby-background {
background-color: var(--body-background-color);
width: 100%;
min-height: 100vh;
}
</style>

View File

@@ -2,27 +2,37 @@
import {ref} from "vue";
import { useRouter } from 'vue-router';
import {useQuasar} from "quasar";
import axios from "axios";
const router = useRouter();
const lobbyCode = ref('');
const isLoading = ref(false);
const $q = useQuasar();
const delay = (ms: number) => new Promise(resolve => setTimeout(resolve, ms));
const api = window?.__RUNTIME_CONFIG__?.API_URL;
const startGameQuasar = async() => {
if (!lobbyCode.value) {
$q.notify({ message: 'Lobby-Name wird benötigt', color: 'red', position: 'top', icon: 'cancel' });
return;
}
isLoading.value = true;
//TODO: Implement Logic to Start the Game and Redirect to Ingame
await delay(3000)
isLoading.value = false;
$q.notify({
message: `Lobby "${lobbyCode.value}" erfolgreich gefunden`,
color: 'green-6',
icon: 'check_circle',
position: 'top'
});
router.push({ name: 'mainmenu'});
axios.post(`${api}/joinGame`, {gameId: lobbyCode.value.toString()}, {withCredentials: true}).then(response => {
const responseData = response.data
$q.notify({
message: `Lobby "${lobbyCode.value}" erfolgreich gefunden`,
color: 'green-6',
icon: 'check_circle',
position: 'top'
});
router.replace("/game")
}).catch(() => {
$q.notify({
message: `Lobby "${lobbyCode.value}" nicht gefunden`,
color: 'red-6',
icon: 'cancel',
position: 'top'
})
}).finally(() =>
isLoading.value = false
)
}
</script>

53
src/views/LobbyView.vue Normal file
View File

@@ -0,0 +1,53 @@
<script setup lang="ts">
import {computed, ref} from 'vue';
import LobbyComponent from '../components/lobby/LobbyComponent.vue';
import type {LobbyInfo} from "@/types/GameTypes.ts";
import type {User} from "@/types/GameSubTypes.ts";
import {useIngame} from "@/composables/useIngame.ts";
import {sendEvent} from "@/services/ws.ts";
const ig = useIngame()
const lobbyInfo = computed<LobbyInfo | null>(() => {
if (ig.state === 'Lobby' && ig.data) {
return ig.data as LobbyInfo;
}
return null;
});
const handleKickPlayer = (user: User) => {
sendEvent("KickEvent", {
user: user
})
};
const handleStartGame = () => {
//TODO: Implement start game
};
const handleLeaveGame = (user: User) => {
sendEvent("LeftEvent",{
user: user
})
};
</script>
<template>
<q-layout>
<q-page-container>
<q-page class="vh-100 column">
<lobby-component
v-if="lobbyInfo"
:lobbyInfo="lobbyInfo"
@kick-player="handleKickPlayer"
@start-game="handleStartGame"
@leave-game="handleLeaveGame"
/>
</q-page>
</q-page-container>
</q-layout>
</template>
<style scoped>
</style>

View File

@@ -80,7 +80,7 @@ const onSubmit = () => {
loginError.value = ''
axios.post(`${api}/login`, {username: username.value, password: password.value}, {withCredentials: true}).then((response) => {
uInfo.setUserInfo(response.data.user.username, response.data.user.id)
router.push("/mainmenu")
router.push("/")
}).catch(() => {
loginError.value = 'Invalid username or password'
}).finally(() =>

View File

@@ -1,18 +1,40 @@
<script setup lang="ts">
import MainMenuBoxes from "@/components/MainMenuBoxes.vue";
import UserStatusArea from '../components/User.vue'
</script>
<template>
<q-layout view="hHh lpR fFf" class="font-roboto">
<q-page-container>
<q-page class="flex justify-start items-center column">
<q-header elevated class="bg-dark text-white">
<q-toolbar>
<q-toolbar-title class="q-ml-md">
</q-toolbar-title>
<header class="text-center q-mb-xl">
<UserStatusArea />
</q-toolbar>
</q-header>
<q-page-container>
<q-page class="flex justify-start items-center column q-pa-md">
<header class="text-center q-mb-xl q-mt-md">
<transition
appear
enter-active-class="animate__fadeInDown"
leave-active-class="animate__fadeOutUp"
>
<div
class="animate__animated"
:style="{ animationDuration: '1.6s' }"
>
<h1 class="game-title text-white q-my-none">
KnockOutWhist
</h1>
</header>
<router-view></router-view>
</div>
</transition>
</header>
<router-view></router-view>
</q-page>
</q-page-container>
</q-layout>

View File

@@ -1,3 +1,3 @@
MAJOR=0
MINOR=7
MINOR=14
PATCH=0