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>
This commit is contained in:
2025-12-10 15:43:27 +01:00
committed by lq64
parent 027095f874
commit b20ec0a363
62 changed files with 111 additions and 1 deletions

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,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

@@ -11,7 +11,7 @@ type Hand = {
type Player = {
id: string
name: string
dogLife: string
dogLife: boolean
}
type PlayerQueue = {