Compare commits
7 Commits
02869fff8b
...
feat/BAC-8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5f30b9f739 | ||
|
|
7829b35211 | ||
|
|
8482aa8876 | ||
| c6537467f8 | |||
|
|
3eb505806c | ||
| 058d232d2b | |||
|
|
67dcf6274c |
15
CHANGELOG.md
15
CHANGELOG.md
@@ -145,3 +145,18 @@
|
|||||||
### Features
|
### Features
|
||||||
|
|
||||||
* Update joinGame endpoint to accept gameId as a path parameter ([92a7bc0](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/commit/92a7bc05866b77053ebb1d074ad207be8348f9d6))
|
* Update joinGame endpoint to accept gameId as a path parameter ([92a7bc0](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/commit/92a7bc05866b77053ebb1d074ad207be8348f9d6))
|
||||||
|
## [0.0.0](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/compare/0.19.0...0.0.0) (2026-01-07)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Enhance user state management with polling and WebSocket connection handling ([02869ff](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/commit/02869fff8b448cde73369679c9b38bc99fb771ff))
|
||||||
|
## [0.0.0](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/compare/0.20.0...0.0.0) (2026-01-07)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Implement PlayDogCard functionality in user session and update Vue component ([058d232](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/commit/058d232d2ba00f33b1e658fc8a793dcd59018fa4))
|
||||||
|
## [0.0.0](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/compare/0.21.0...0.0.0) (2026-01-07)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Update LobbyComponent to use icons for player removal buttons ([c653746](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/commit/c6537467f87d60aeece18f86f42c839d5437c18b))
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import TurnC from "@/components/ingame/TurnC.vue";
|
|||||||
import TrumpC from "@/components/ingame/TrumpC.vue";
|
import TrumpC from "@/components/ingame/TrumpC.vue";
|
||||||
import {storeToRefs} from "pinia";
|
import {storeToRefs} from "pinia";
|
||||||
import {ref, toRefs, watch} from "vue";
|
import {ref, toRefs, watch} from "vue";
|
||||||
|
import TieC from "@/components/ingame/TieC.vue";
|
||||||
|
|
||||||
const ig = useIngame()
|
const ig = useIngame()
|
||||||
const { state } = toRefs(ig)
|
const { state } = toRefs(ig)
|
||||||
@@ -45,6 +46,22 @@ watch(
|
|||||||
<TrumpC />
|
<TrumpC />
|
||||||
</div>
|
</div>
|
||||||
</transition>
|
</transition>
|
||||||
|
|
||||||
|
|
||||||
|
<transition
|
||||||
|
appear
|
||||||
|
enter-active-class="animate__animated animate__fadeInDown"
|
||||||
|
leave-active-class="animate__animated animate__fadeOutDown"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
v-if="state === 'TieBreak'"
|
||||||
|
class="full-overlay-blur"
|
||||||
|
style="z-index: 2000;"
|
||||||
|
>
|
||||||
|
<TieC />
|
||||||
|
</div>
|
||||||
|
</transition>
|
||||||
|
|
||||||
<div class="fit row wrap justify-center items-center content-start">
|
<div class="fit row wrap justify-center items-center content-start">
|
||||||
<div class="mt-5 ml-4 self-start col-2">
|
<div class="mt-5 ml-4 self-start col-2">
|
||||||
<TurnC v-if="(cachedGameInfo as GameInfo)?.playerQueue" :queue="(cachedGameInfo as GameInfo).playerQueue!"/>
|
<TurnC v-if="(cachedGameInfo as GameInfo)?.playerQueue" :queue="(cachedGameInfo as GameInfo).playerQueue!"/>
|
||||||
|
|||||||
@@ -25,9 +25,8 @@ function triggerWiggle(index: number) {
|
|||||||
function handlePlayCard(index: number | null) {
|
function handlePlayCard(index: number | null) {
|
||||||
if (index === null) return
|
if (index === null) return
|
||||||
|
|
||||||
wb.sendAndWait("PlayCard", { cardindex: index }).catch((error) => {
|
wb.sendAndWait((<GameInfo>wi.data)?.self?.dogLife ? "PlayDogCard" : "PlayCard", { cardindex: index }).catch((error) => {
|
||||||
triggerWiggle(index)
|
triggerWiggle(index)
|
||||||
|
|
||||||
$q.notify({
|
$q.notify({
|
||||||
message: error.message,
|
message: error.message,
|
||||||
color: "negative",
|
color: "negative",
|
||||||
@@ -45,7 +44,13 @@ function onBeforeLeave(el: Element) {
|
|||||||
element.style.height = height;
|
element.style.height = height;
|
||||||
}
|
}
|
||||||
function handleSkipDogLife() {
|
function handleSkipDogLife() {
|
||||||
//TODO: Add some animation or feedback for skipping turn
|
wb.sendAndWait("PlayDogCard", { cardindex: 'Skip' }).catch((error) => {
|
||||||
|
$q.notify({
|
||||||
|
message: error.message,
|
||||||
|
color: "negative",
|
||||||
|
position: "top"
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCardImagePath(cardPath: string) {
|
function getCardImagePath(cardPath: string) {
|
||||||
|
|||||||
98
src/components/ingame/TieC.vue
Normal file
98
src/components/ingame/TieC.vue
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import {useWebSocket} from "@/composables/useWebsocket.ts";
|
||||||
|
import {useIngame} from "@/composables/useIngame.ts";
|
||||||
|
import type {GameInfo, LobbyInfo, TieInfo, TrumpInfo} from "@/types/GameTypes.ts";
|
||||||
|
import {useQuasar} from "quasar";
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { computed } from 'vue'
|
||||||
|
|
||||||
|
const wb = useWebSocket()
|
||||||
|
const wi = useIngame()
|
||||||
|
const tieInf = computed(() => wi.data as TieInfo)
|
||||||
|
const tieBlankCard = [
|
||||||
|
"/images/cards/AS.png"
|
||||||
|
]
|
||||||
|
const $q = useQuasar();
|
||||||
|
function getCardImagePath(cardPath: string) {
|
||||||
|
if (!cardPath) return ''
|
||||||
|
if (cardPath.includes('://') || cardPath.startsWith('/')) return cardPath
|
||||||
|
return `/${cardPath}`
|
||||||
|
}
|
||||||
|
function selectTie(tieIndex: number) {
|
||||||
|
wb.sendAndWait("PickTie", { cardIndex: tieIndex }).then(
|
||||||
|
$q.notify({
|
||||||
|
message: "You've successfully picked your tieCard!",
|
||||||
|
color: "positive",
|
||||||
|
position: "top"
|
||||||
|
})
|
||||||
|
|
||||||
|
).catch((error) => {
|
||||||
|
$q.notify({
|
||||||
|
message: error.message,
|
||||||
|
color: "negative",
|
||||||
|
position: "top"
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const model = ref(1)
|
||||||
|
const options = computed(() => {
|
||||||
|
const list = []
|
||||||
|
const max = tieInf.value.highestAmount?.valueOf() || 0
|
||||||
|
for (let i = 1; i <= max; i++) {
|
||||||
|
list.push(i)
|
||||||
|
}
|
||||||
|
return list
|
||||||
|
})
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<q-card v-if="tieInf.self?.name === tieInf.currentPlayer?.name" class="player-profile-card" flat bordered>
|
||||||
|
<q-card-section class="bg-white text-dark text-center q-py-lg">
|
||||||
|
<div class="text-h3 text-weight-bolder">
|
||||||
|
{{ tieInf.self?.name || "Loading Player..."}}
|
||||||
|
</div>
|
||||||
|
</q-card-section>
|
||||||
|
<q-card-section class="bg-dark text-dark text-center q-py-lg">
|
||||||
|
<div class="q-pa-md" style="max-width: 500px">
|
||||||
|
<div class="q-gutter-md">
|
||||||
|
<q-select
|
||||||
|
v-model="model"
|
||||||
|
:options="options"
|
||||||
|
label="Select Amount"
|
||||||
|
filled
|
||||||
|
bg-color="white"
|
||||||
|
label-color="primary"
|
||||||
|
color="primary"
|
||||||
|
popup-content-class="bg-white text-black"
|
||||||
|
/>
|
||||||
|
<q-btn
|
||||||
|
color="positive"
|
||||||
|
icon="sports_martial_arts"
|
||||||
|
@click="selectTie(model)"
|
||||||
|
class="full-width"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</q-card-section>
|
||||||
|
|
||||||
|
</q-card>
|
||||||
|
<q-card
|
||||||
|
v-else
|
||||||
|
class="player-profile-card text-center"
|
||||||
|
flat
|
||||||
|
bordered
|
||||||
|
style="min-height: 200px; display: flex; flex-direction: column; justify-content: center;"
|
||||||
|
>
|
||||||
|
<q-card-section class="q-pa-lg">
|
||||||
|
<q-spinner-hourglass color="black" size="3em" class="q-mb-md" />
|
||||||
|
<div class="text-h5 text-grey-8">
|
||||||
|
Waiting for {{ tieInf.currentPlayer?.name || 'the other player' }} to select card for the tie...
|
||||||
|
</div>
|
||||||
|
</q-card-section>
|
||||||
|
</q-card>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -103,14 +103,14 @@ const profileIcon = 'person';
|
|||||||
<q-btn
|
<q-btn
|
||||||
v-if="player.id !== (<LobbyInfo>ig.data).self.id"
|
v-if="player.id !== (<LobbyInfo>ig.data).self.id"
|
||||||
color="negative"
|
color="negative"
|
||||||
label="Remove"
|
icon="sports_martial_arts"
|
||||||
@click="handleKickPlayer(player)"
|
@click="handleKickPlayer(player)"
|
||||||
class="full-width"
|
class="full-width"
|
||||||
/>
|
/>
|
||||||
<q-btn
|
<q-btn
|
||||||
v-else
|
v-else
|
||||||
color="negative"
|
color="negative"
|
||||||
label="Remove (Cannot Kick Self)"
|
icon="sports_martial_arts"
|
||||||
disable
|
disable
|
||||||
class="full-width"
|
class="full-width"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ ui.requestState().then(() => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="lobby-background">
|
<div class="lobby-background">
|
||||||
<Ingame v-if="state === 'InGame' || state === 'SelectTrump'"/>
|
<Ingame v-if="state === 'InGame' || state === 'SelectTrump' || state === 'TieBreak'"/>
|
||||||
<lobby-component v-if="state === 'Lobby'"/>
|
<lobby-component v-if="state === 'Lobby'"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
MAJOR=0
|
MAJOR=0
|
||||||
MINOR=19
|
MINOR=22
|
||||||
PATCH=0
|
PATCH=0
|
||||||
|
|||||||
Reference in New Issue
Block a user