60 lines
2.2 KiB
Vue
60 lines
2.2 KiB
Vue
<script setup>
|
|
import { ref } from 'vue'
|
|
defineProps({ players: { type: Array, required: true } })
|
|
const expanded = ref(null)
|
|
</script>
|
|
|
|
<template>
|
|
<aside class="opponents">
|
|
<h3>Spieler</h3>
|
|
<div
|
|
v-for="p in players"
|
|
:key="p.name"
|
|
class="opp"
|
|
:class="{ dead: !p.alive, me: p.is_player }"
|
|
@click="!p.is_player && (expanded = expanded === p.name ? null : p.name)"
|
|
>
|
|
<div class="row">
|
|
<span class="oname">{{ p.name }}</span>
|
|
<span v-if="p.archetype" class="arch">{{ p.archetype }}</span>
|
|
<span v-if="p.alive" class="strength" title="Boardstärke">⚡ {{ p.score }}</span>
|
|
<span v-if="p.alive" class="hp">{{ p.hp }}</span>
|
|
<span v-else class="placement">#{{ p.placement }}</span>
|
|
</div>
|
|
<div v-if="p.alive" class="hpbar"><div :style="{ width: p.hp + '%' }" /></div>
|
|
<div v-if="expanded === p.name && p.alive && p.board.length" class="scout">
|
|
<div>Level {{ p.level }}</div>
|
|
<div class="units">
|
|
<img
|
|
v-for="(u, i) in p.board"
|
|
:key="i"
|
|
:src="u.icon"
|
|
:alt="u.name"
|
|
:title="`${u.name} ${'★'.repeat(u.stars)}`"
|
|
/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</aside>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.opponents { display: flex; flex-direction: column; gap: 6px; }
|
|
h3 { font-size: 12px; text-transform: uppercase; color: #8a92a8; margin-bottom: 2px; }
|
|
.opp { background: #161b29; border-radius: 6px; padding: 6px 8px; cursor: pointer; }
|
|
.opp.me { border: 1px solid #7de3d4; cursor: default; }
|
|
.opp.dead { opacity: 0.4; }
|
|
.row { display: flex; align-items: center; gap: 6px; }
|
|
.oname { flex: 1; font-weight: 600; }
|
|
.me .oname { color: #7de3d4; }
|
|
.arch { color: #7d86a0; font-size: 11px; }
|
|
.strength { color: #e5a531; font-size: 12px; font-weight: 600; }
|
|
.hp { font-weight: 700; color: #7de37d; }
|
|
.placement { color: #8a92a8; }
|
|
.hpbar { height: 4px; background: #232a3d; border-radius: 2px; margin-top: 4px; }
|
|
.hpbar div { height: 100%; background: #4caf6e; border-radius: 2px; }
|
|
.scout { margin-top: 6px; font-size: 12px; color: #aab2c8; }
|
|
.units { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 4px; }
|
|
.units img { width: 26px; height: 26px; border-radius: 4px; object-fit: cover; }
|
|
</style>
|