18 Commits

Author SHA1 Message Date
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
TeamCity
027095f874 ci: bump version to v0.7.0 2025-12-10 14:22:13 +00:00
df61db2730 feat(api): FRO-14 Create Game (#14)
Added functionality to create Game so that it creates a game in the Backend

Co-authored-by: LQ63 <lkhermann@web.de>
Reviewed-on: #14
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:20:33 +01:00
TeamCity
8758f95fcd ci: bump version to v0.6.0 2025-12-10 14:12:10 +00:00
ecb38510de feat: FRO-21 Create Turn Component (#13)
Reviewed-on: #13
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:10:54 +01:00
TeamCity
e2f8dc23ab ci: bump version to v0.5.0 2025-12-10 13:17:38 +00:00
97a9f85758 feat: FRO-20 Create scoreboard component (#12)
Reviewed-on: #12
Co-authored-by: Janis <janis.e.20@gmx.de>
Co-committed-by: Janis <janis.e.20@gmx.de>
2025-12-10 14:16:14 +01:00
TeamCity
4f04cf7dfe ci: bump version to v0.4.0 2025-12-10 13:13:18 +00:00
adbe2be534 feat: FRO-17 Added Rule Component and changed Mainmenu structure (#11)
Added a Rule Component and changed MainMenu Structure

Co-authored-by: LQ63 <lkhermann@web.de>
Reviewed-on: #11
Reviewed-by: Janis <janis-e@gmx.de>
Co-authored-by: lq64 <lq@blackhole.local>
Co-committed-by: lq64 <lq@blackhole.local>
2025-12-10 14:12:12 +01:00
78 changed files with 675 additions and 84 deletions

View File

@@ -58,3 +58,48 @@
### Reverts ### Reverts
* deleted MainMenuBoxes.vue ([#10](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/issues/10)) ([4582306](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/commit/458230622bcf0a5d6f5fe5cec028ab46651b6760)) * deleted MainMenuBoxes.vue ([#10](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/issues/10)) ([4582306](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/commit/458230622bcf0a5d6f5fe5cec028ab46651b6760))
## [0.0.0](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/compare/0.3.1...0.0.0) (2025-12-10)
### Features
* FRO-17 Added Rule Component and changed Mainmenu structure ([#11](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/issues/11)) ([adbe2be](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/commit/adbe2be5345b95cd3bcd9deba936614b489268fd))
## [0.0.0](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/compare/0.4.0...0.0.0) (2025-12-10)
### Features
* FRO-20 Create scoreboard component ([#12](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/issues/12)) ([97a9f85](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/commit/97a9f857586eb41feb056d7af0a5d8553d2bcf80))
## [0.0.0](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/compare/0.5.0...0.0.0) (2025-12-10)
### Features
* FRO-21 Create Turn Component ([#13](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/issues/13)) ([ecb3851](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/commit/ecb38510de53b811eaaee2a39fc1ae423aed71c6))
## [0.0.0](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/compare/0.6.0...0.0.0) (2025-12-10)
### 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))

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

View File

@@ -0,0 +1,21 @@
<script setup lang="ts">
import MainMenuBoxes from "@/components/MainMenuBoxes.vue";
</script>
<template>
<header class="text-center q-mb-xl">
<p
class="text-h5 text-grey-4 q-mt-md"
style="max-width: 900px; margin-left: auto; margin-right: auto;"
>
Welcome to KnockOutWhist! In this game you have to "knock-out" your opponents until you are the last player standing.
Do you have what it takes to be crowned the champion?
</p>
</header>
<MainMenuBoxes />
</template>
<style scoped>
</style>

View File

@@ -23,6 +23,13 @@ const menuItems = [
icon: 'settings', icon: 'settings',
routeName: 'settings', routeName: 'settings',
color: 'grey-8' color: 'grey-8'
},
{
title: 'Rules',
description: 'Look at the rules to have a clear understanding for playing the game.',
icon: 'settings',
routeName: 'rules-Game',
color: 'grey-8'
} }
]; ];

107
src/components/Rules.vue Normal file
View File

@@ -0,0 +1,107 @@
<script setup lang="ts">
</script>
<template>
<div class="q-pa-md row justify-center">
<div style="width: 100%; max-width: 980px; min-width: 980px;">
<q-card class="rules-card bg-grey-10 text-white shadow-10">
<q-card-section class="text-center bg-grey-9 q-py-md">
<div class="text-h5 text-weight-bold rules-title">
<q-icon name="menu_book" class="q-mr-sm" /> Game Rules Overview
</div>
</q-card-section>
<q-card-section class="q-pa-none">
<q-list class="rules-list">
<QExpansionItem
icon="groups"
label="Players"
header-class="text-weight-bold bg-grey-8"
>
<q-card-section>
Two to seven players. The aim is to be the last player left in the game.
</q-card-section>
</QExpansionItem>
<QExpansionItem
icon="style"
label="Equipment & Card Ranks"
header-class="text-weight-bold bg-grey-8"
>
<q-card-section>
<p>A standard 52-card pack is used.</p>
<p>In each suit, cards rank from highest to lowest: **A K Q J 10 9 8 7 6 5 4 3 2**.</p>
</q-card-section>
</QExpansionItem>
<QExpansionItem
icon="casino"
label="Deal and Trumps"
header-class="text-weight-bold bg-grey-8"
>
<q-card-section>
<div class="text-subtitle1 text-primary q-mb-sm">First Hand (Deal)</div>
<p>The dealer deals seven cards to each player. One card is turned up to determine the trump suit for the round.</p>
<q-separator inset dark class="q-my-sm"/>
<div class="text-subtitle1 text-primary q-mb-sm">Subsequent Hands (Deal)</div>
<p>The deal rotates clockwise. The player who took the most tricks in the previous hand selects the trump suit. If there's a tie, players cut cards to decide who calls trumps. **One fewer card is dealt in each successive hand until the final hand consists of one card each.**</p>
</q-card-section>
</QExpansionItem>
<QExpansionItem
icon="play_circle_outline"
label="Play & Winning a Trick"
header-class="text-weight-bold bg-grey-8"
>
<q-card-section>
<div class="text-subtitle1 text-primary q-mb-sm">Play</div>
<p>The player to the dealer's left (eldest hand) leads the first trick. Any card can be led. Other players must follow suit if possible. A player with no cards of the suit led may play any card.</p>
<div class="text-subtitle1 text-primary q-my-sm">Winning a Trick</div>
<p>The highest card of the suit led wins, **unless** a trump is played, in which case the highest trump wins. The winner of the trick leads the next.</p>
<div class="text-subtitle1 text-primary q-my-sm">Leading Trumps</div>
<p>Some rules disallow leading trumps before the suit has been 'broken' (a trump has been played to the lead of another suit). Leading trumps is always permissible if a player holds only trumps.</p>
</q-card-section>
</QExpansionItem>
<QExpansionItem
icon="flare"
label="Knockout & Dog's Life (Special Rules)"
header-class="text-weight-bold bg-red-9"
>
<q-card-section>
<div class="text-subtitle1 text-red-4 q-mb-sm">Knockout</div>
<p>At the end of each hand, any player who took no tricks is knocked out and takes no further part in the game.</p>
<div class="text-subtitle1 text-red-4 q-my-sm">Winning the Game</div>
<p>The game is won when a player takes all the tricks in a round, as all other players are knocked out, leaving only one player remaining.</p>
<q-separator inset dark class="q-my-sm"/>
<div class="text-subtitle1 text-red-4 q-my-sm">Dog's Life (Optional)</div>
<p>The first player who takes no tricks is awarded a "dog's life". In the next hand, that player is dealt one card and can decide which trick to play it to. Each time a trick is played the dog may either play the card or knock on the table and wait to play it later. If the dog wins a trick, the player to the left leads the next and the dog re-enters the game properly in the next hand. If the dog fails, they are knocked out.</p>
</q-card-section>
</QExpansionItem>
</q-list>
</q-card-section>
</q-card>
</div>
</div>
</template>
<style scoped>
.rules-card {
width: 100%;
border: 2px solid #5a5a5a;
}
.rules-list .q-item {
border-bottom: 1px solid #333;
}
</style>

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,57 @@
<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.path.charAt(trumpsuit.value.path.length - 1)) {
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 bg-grey-2 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;"/>
<div v-else class="q-pa-sm"
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>
</template>
<style scoped>
.firstbox {
width: 80px;
border-radius: 6px;
}
</style>

View File

@@ -0,0 +1,110 @@
<script lang="ts" setup>
import {toRefs} from 'vue'
import type {Hand, Player} from "@/types/GameSubTypes.ts";
const props = defineProps<{
hand: Hand
isHandInactive?: boolean
self: Player | null
}>()
const emit = defineEmits<{
(e: 'play-card', idx: number): void
(e: 'skip-dog'): void
}>()
const { hand, isHandInactive, self } = toRefs(props)
function handlePlayCard(idx: number | null) {
if (idx === null) return
if (isHandInactive?.value) return
emit('play-card', idx)
}
function handleSkipDogLife() {
emit('skip-dog')
}
function getCardImagePath(cardPath: string) {
if (!cardPath) return ''
if (cardPath.includes('://') || cardPath.startsWith('/')) return cardPath
return `/${cardPath}`
}
</script>
<template>
<div class="bottom-div hand-container">
<div id="card-slide" :class="'ingame-cards-slide ' + (isHandInactive ? 'inactive' : '' )">
<div class="cards-row">
<div v-for="card in hand.cards" :key="card.identifier" class="handcard">
<div class="card-btn" @click="handlePlayCard(card.idx)" aria-label="Play card">
<q-img :src="getCardImagePath(card.path)" :alt="card.identifier" class="card" />
</div>
</div>
</div>
<div v-if="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
}
@media (max-height: 500px) {
.card {
width: 80px;
border-radius: 4px;
}
}
</style>

View File

@@ -0,0 +1,43 @@
<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(() => {
return [...trick.value.cards].map(card => {
return {
cardId: card[1].path,
player: card[0].name
}
})
})
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

@@ -0,0 +1,69 @@
<script setup lang="ts">
import type {Round} from "@/types/GameSubTypes.ts";
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
}
})
</script>
<template>
<q-card class="score-card q-mt-md" id="score-table-container">
<q-card-section class="row items-center q-px-md q-pt-md">
<div class="col">
<div class="text-h6 fw-bold">Tricks Won</div>
</div>
</q-card-section>
<q-separator />
<q-list dense class="q-pa-sm">
<q-item class="score-header">
<q-item-section style="width:50%">PLAYER</q-item-section>
<q-item-section side style="width:50%" class="text-right">TRICKS</q-item-section>
</q-item>
<q-separator inset />
<div v-if="playerScores.length">
<q-item v-for="player in playerScores" :key="player.name" class="score-row">
<q-item-section style="width:50%" class="text-truncate">{{ player.name }}</q-item-section>
<q-item-section side style="width:50%" class="text-right">{{ player.tricks }}</q-item-section>
</q-item>
</div>
<div v-else>
<q-item>
<q-item-section class="text-grey">No scores yet</q-item-section>
</q-item>
</div>
</q-list>
</q-card>
</template>
<style scoped>
.score-card {
background-color: rgba(255, 255, 255, 0.08);
border-radius: 8px;
backdrop-filter: blur(8px);
box-shadow: 0 4px 6px rgba(0,0,0,0.08);
}
.score-header {
font-weight: 700;
color: #000000;
border-bottom: 1px solid rgba(255,255,255,0.06);
}
.score-row {
color: #000000;
}
.text-right { text-align: right; }
</style>

View File

@@ -0,0 +1,38 @@
<script setup lang="ts">
import { computed } from 'vue'
import type {PlayerQueue} from "@/types/GameSubTypes.ts";
const props = defineProps<{
queue: PlayerQueue
}>()
const safeNextPlayers = computed(() => props.queue.players ?? [])
</script>
<template>
<q-card flat class="turn-tracker-container q-pa-md">
<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
}}</div>
<div v-if="safeNextPlayers.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-section>
<div class="text-body1 text-primary">{{ player.name }}</div>
</q-item-section>
</q-item>
</q-list>
</div>
</q-card-section>
</q-card>
</template>
<style scoped>
.turn-tracker-container {
max-width: 320px;
}
</style>

View File

@@ -5,7 +5,7 @@ import App from './App.vue'
import router from './router' import router from './router'
import Particles from "@tsparticles/vue3"; import Particles from "@tsparticles/vue3";
import { loadFull } from "tsparticles"; import { loadFull } from "tsparticles";
import { Quasar, Notify } from 'quasar' import { Quasar, Notify, QExpansionItem } from 'quasar'
import '@quasar/extras/material-icons/material-icons.css' import '@quasar/extras/material-icons/material-icons.css'
import 'quasar/dist/quasar.css' import 'quasar/dist/quasar.css'
import { createPinia } from 'pinia' import { createPinia } from 'pinia'
@@ -22,6 +22,9 @@ app.use(Quasar, {
plugins: { plugins: {
Notify Notify
}, },
components: {
QExpansionItem
}
}) })
app.use(VueAxios, axios) app.use(VueAxios, axios)
app.use(Particles, { app.use(Particles, {

View File

@@ -3,8 +3,10 @@ import LoginView from '../views/LoginView.vue'
import MainMenuView from '../views/MainMenuView.vue' import MainMenuView from '../views/MainMenuView.vue'
import createGameView from '../views/CreateGame.vue' import createGameView from '../views/CreateGame.vue'
import joinGameView from "@/views/JoinGameView.vue"; import joinGameView from "@/views/JoinGameView.vue";
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";
const api = window?.__RUNTIME_CONFIG__?.API_URL; const api = window?.__RUNTIME_CONFIG__?.API_URL;
@@ -12,29 +14,42 @@ const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL), history: createWebHistory(import.meta.env.BASE_URL),
routes: [ routes: [
{ {
path: '/', path: '/mainmenu/',
name: 'mainmenu',
component: MainMenuView, component: MainMenuView,
meta: { requiresAuth: true },
children: [
{
path: '',
name: 'mainmenu',
component: defaultMenu,
meta: { requiresAuth: true } meta: { requiresAuth: true }
}, },
{
path: 'create',
name: 'create-Game',
component: createGameView,
meta: {requiresAuth: true }
},
{
path: 'join',
name: 'join-Game',
component: joinGameView,
meta: {requiresAuth: true }
},
{
path: 'rules',
name: 'rules-Game',
component: rulesView,
meta: {requiresAuth: true }
},
],
},
{ {
path: '/login', path: '/login',
name: 'login', name: 'login',
component: LoginView, component: LoginView,
meta: { requiresAuth: false } meta: { requiresAuth: false }
}, },
{
path: '/create',
name: 'create-Game',
component: createGameView,
meta: { requiresAuth: true }
},
{
path: '/join',
name: 'join-Game',
component: joinGameView,
meta: { requiresAuth: true }
}
], ],
}) })

View File

@@ -11,7 +11,7 @@ type Hand = {
type Player = { type Player = {
id: string id: string
name: string name: string
dogLife: string dogLife: boolean
} }
type PlayerQueue = { type PlayerQueue = {
@@ -28,12 +28,13 @@ type PodiumPlayer = {
type Round = { type Round = {
trumpSuit: Card trumpSuit: Card
playersIn: Player[]
firstRound: boolean firstRound: boolean
trickList: Trick[] trickList: Trick[]
} }
type Trick = { type Trick = {
cards: { [player: string]: Card } cards: Map<Player, Card>
firstCard: Card | null firstCard: Card | null
winner: Player | null winner: Player | null
} }

View File

@@ -2,7 +2,9 @@
import { ref } from 'vue'; import { ref } from 'vue';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import axios from "axios";
const api = window?.__RUNTIME_CONFIG__?.API_URL;
const lobbyName = ref(''); const lobbyName = ref('');
const isPublic = ref(false); const isPublic = ref(false);
const playerAmount = ref(2); const playerAmount = ref(2);
@@ -16,27 +18,26 @@ const createGameQuasar = async () => {
return; return;
} }
isLoading.value = true; isLoading.value = true;
//TODO: Implement Logic to Create the Game and Redirect to Lobby axios.post(`${api}/createGame`, {lobbyname: lobbyName.value, playeramount: playerAmount.value.toString()}, {withCredentials: true}).then((response) => {
await delay(3000) const responseData = response.data
isLoading.value = false; console.log("Response" + responseData.status)
$q.notify({ $q.notify({
message: `Lobby "${lobbyName.value}" erfolgreich erstellt!`, message: `Lobby "${lobbyName.value}" erfolgreich erstellt mit gameId ${responseData.gameId}!`,
color: 'green-6', color: 'green-6',
icon: 'check_circle', icon: 'check_circle',
position: 'top' position: 'top'
}); });
router.push({ name: 'mainmenu'}); router.push("/lobby")
}).catch((err) => {
console.log("ERROR:" + err)
}).finally(() =>
isLoading.value = false
)
} }
</script> </script>
<template> <template>
<q-layout>
<q-page-container>
<q-page class="flex justify-start items-center column ">
<header class="text-center q-mb-xl"> <header class="text-center q-mb-xl">
<h1 class="game-title text-white q-my-none">
KnockOutWhist
</h1>
<p <p
class="text-h5 text-grey-4 q-mt-md" class="text-h5 text-grey-4 q-mt-md"
style="max-width: 900px; margin-left: auto; margin-right: auto;" style="max-width: 900px; margin-left: auto; margin-right: auto;"
@@ -45,9 +46,7 @@ const createGameQuasar = async () => {
to play with and you are ready to go! to play with and you are ready to go!
</p> </p>
</header> </header>
<div class="q-pa-md" style="width: 100%; max-width: 400px;"> <div class="q-pa-md" style="width: 100%; max-width: 400px;">
<div> <div>
<q-input <q-input
v-model="lobbyName" v-model="lobbyName"
@@ -108,9 +107,6 @@ const createGameQuasar = async () => {
</div> </div>
</div> </div>
</q-page>
</q-page-container>
</q-layout>
</template> </template>
<style scoped> <style scoped>

View File

@@ -2,38 +2,42 @@
import {ref} from "vue"; import {ref} from "vue";
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import {useQuasar} from "quasar"; import {useQuasar} from "quasar";
import axios from "axios";
const router = useRouter(); const router = useRouter();
const lobbyCode = ref(''); const lobbyCode = ref('');
const isLoading = ref(false); const isLoading = ref(false);
const $q = useQuasar(); const $q = useQuasar();
const delay = (ms: number) => new Promise(resolve => setTimeout(resolve, ms)); const api = window?.__RUNTIME_CONFIG__?.API_URL;
const startGameQuasar = async() => { const startGameQuasar = async() => {
if (!lobbyCode.value) { if (!lobbyCode.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' });
return; return;
} }
isLoading.value = true; isLoading.value = true;
//TODO: Implement Logic to Start the Game and Redirect to Ingame axios.post(`${api}/joinGame`, {gameId: lobbyCode.value.toString()}, {withCredentials: true}).then(response => {
await delay(3000) const responseData = response.data
isLoading.value = false;
$q.notify({ $q.notify({
message: `Lobby "${lobbyCode.value}" erfolgreich gefunden`, message: `Lobby "${lobbyCode.value}" erfolgreich gefunden`,
color: 'green-6', color: 'green-6',
icon: 'check_circle', icon: 'check_circle',
position: 'top' position: 'top'
}); });
router.push({ name: 'mainmenu'}); router.push("/lobby")
}).catch(() => {
$q.notify({
message: `Lobby "${lobbyCode.value}" nicht gefunden`,
color: 'red-6',
icon: 'cancel',
position: 'top'
})
}).finally(() =>
isLoading.value = false
)
} }
</script> </script>
<template> <template>
<q-layout>
<q-page-container>
<q-page class="flex justify-start items-center column ">
<header class="text-center q-mb-xl"> <header class="text-center q-mb-xl">
<h1 class="game-title text-white q-my-none">
KnockOutWhist
</h1>
<p <p
class="text-h5 text-grey-4 q-mt-md" class="text-h5 text-grey-4 q-mt-md"
style="max-width: 900px; margin-left: auto; margin-right: auto;" style="max-width: 900px; margin-left: auto; margin-right: auto;"
@@ -70,9 +74,6 @@ const startGameQuasar = async() => {
</div> </div>
</div> </div>
</q-page>
</q-page-container>
</q-layout>
</template> </template>
<style scoped> <style scoped>

View File

@@ -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(() =>

View File

@@ -1,27 +1,24 @@
<script setup lang="ts"> <script setup lang="ts">
import MainMenuBoxes from "@/components/MainMenuBoxes.vue"; import UserStatusArea from '../components/User.vue'
</script> </script>
<template> <template>
<q-layout view="hHh lpR fFf" class="font-roboto"> <q-layout view="hHh lpR fFf" class="font-roboto">
<q-page-container> <q-header elevated class="bg-dark text-white">
<q-page class="flex justify-start items-center column"> <q-toolbar>
<q-toolbar-title class="q-ml-md">
</q-toolbar-title>
<header class="text-center q-mb-xl"> <UserStatusArea />
<h1 class="game-title text-white q-my-none"> </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"> <h1 class="game-title text-white q-my-none">
KnockOutWhist KnockOutWhist
</h1> </h1>
<p
class="text-h5 text-grey-4 q-mt-md"
style="max-width: 900px; margin-left: auto; margin-right: auto;"
>
Welcome to KnockOutWhist! In this game you have to "knock-out" your opponents until you are the last player standing.
Do you have what it takes to be crowned the champion?
</p>
</header> </header>
<router-view></router-view>
<MainMenuBoxes />
</q-page> </q-page>
</q-page-container> </q-page-container>
</q-layout> </q-layout>

View File

@@ -1,3 +1,3 @@
MAJOR=0 MAJOR=0
MINOR=3 MINOR=12
PATCH=1 PATCH=0