Files
buildpath/frontend/components/ChampionTitle.vue
vhaudiquet d8443efd7e
All checks were successful
pipeline / build-and-push-images (push) Successful in 23s
pipeline / deploy (push) Successful in 7s
Lane-dependant stats (fix #5)
2024-11-29 18:26:17 +01:00

32 lines
1.3 KiB
Vue

<script setup lang="ts">
const props = defineProps<{
championId: number,
winrate: number,
pickrate: number,
gameCount: number
}>()
const winrate = ref((props.winrate * 100).toFixed(2))
watch(() => props.winrate, () => {winrate.value = (props.winrate * 100).toFixed(2)})
const pickrate = ref((props.pickrate * 100).toFixed(2))
watch(() => props.pickrate, () => {pickrate.value = (props.pickrate * 100).toFixed(2)})
const { data: championData } : ChampionResponse = await useFetch(CDRAGON_BASE + "plugins/rcp-be-lol-game-data/global/default/v1/champions/" + props.championId + ".json")
const championName = championData.value.name
const championDescription = championData.value.title
</script>
<template>
<div style="display: flex;">
<NuxtImg width="160" height="160" :src="CDRAGON_BASE + 'plugins/rcp-be-lol-game-data/global/default/v1/champion-icons/' + championId + '.png'"/>
<div style="margin-left: 15px; margin-top: 5px;">
<h1>{{ championName }}</h1>
<h3 style="margin-top: 5px">{{ championDescription }}</h3>
<div style="margin-top: 30px; display: flex;">
<h2>{{ winrate }}% win.</h2>
<h2 style="margin-left: 20px; margin-right: 20px;">{{ pickrate }}% pick.</h2>
<h2>{{ gameCount }} games</h2>
</div>
</div>
</div>
</template>