Files
buildpath/frontend/components/ItemViewer.vue

87 lines
3.6 KiB
Vue

<script setup>
const props = defineProps({
builds: {
type: Array,
required: true
}
})
const {data : items} = await useFetch(CDRAGON_BASE + "plugins/rcp-be-lol-game-data/global/default/v1/items.json")
const itemMap = reactive(new Map())
for(let item of items.value) {
itemMap.set(item.id, item)
}
</script>
<template>
<div style="width: fit-content; height: fit-content;">
<div class="item-box">
<h2 class="item-box-title">start</h2>
<div style="display: flex; width: fit-content; height: fit-content; margin:auto;">
<div style="margin-left: 5px; margin-right: 5px;" v-for="item in builds.start" >
<img style="border: 1px solid var(--color-on-surface);" width="64" height="64" :alt="item.data" :src="CDRAGON_BASE + mapPath(itemMap.get(item.data).iconPath)" />
<h3 style="width: fit-content; margin:auto; margin-bottom: 10px;">{{ item.count }}</h3>
</div>
</div>
</div>
<div v-if="builds.bootsFirst > 0.5" class="item-box" style="margin-top: 10px;">
<div style="display:flex; justify-content: center; align-items: baseline;">
<h2 class="item-box-title">boots rush</h2><h5 style="margin-left: 5px;">({{ (builds.bootsFirst * 100).toFixed(2) }}%)</h5>
</div>
<div style="display: flex; width: fit-content; height: fit-content; margin:auto;">
<div style="margin-left: 5px; margin-right: 5px;" v-for="item in builds.boots" >
<img style="border: 1px solid var(--color-on-surface);" width="64" height="64" :alt="item.data" :src="CDRAGON_BASE + mapPath(itemMap.get(item.data).iconPath)" />
<h3 style="width: fit-content; margin:auto; margin-bottom: 10px;">{{ item.count }}</h3>
</div>
</div>
</div>
<div class="item-box" style="margin-top: 10px;">
<h2 class="item-box-title">core</h2>
<TreeItem style="margin:auto; width: fit-content;" :tree="builds.tree" />
</div>
<div v-if="builds.bootsFirst <= 0.5" class="item-box" style="margin-top: 10px;">
<h2 class="item-box-title">boots</h2>
<div style="display: flex; width: fit-content; height: fit-content; margin:auto;">
<div style="margin-left: 5px; margin-right: 5px;" v-for="item in builds.boots" >
<img style="border: 1px solid var(--color-on-surface);" width="64" height="64" :alt="item.data" :src="CDRAGON_BASE + mapPath(itemMap.get(item.data).iconPath)" />
<h3 style="width: fit-content; margin:auto; margin-bottom: 10px;">{{ item.count }}</h3>
</div>
</div>
</div>
<div class="item-box" style="margin-top: 10px;">
<h2 class="item-box-title">late game</h2>
<div style="display: flex; width: fit-content; height: fit-content; margin:auto;">
<div style="margin-left: 5px; margin-right: 5px;" v-for="item in builds.lateGame.slice(0, 7)" >
<img class="item-img" width="64" height="64" :alt="item.data" :src="CDRAGON_BASE + mapPath(itemMap.get(item.data).iconPath)" />
<h3 style="width: fit-content; margin:auto; margin-bottom: 10px;">{{ item.count }}</h3>
</div>
</div>
</div>
</div>
</template>
<style>
.item-img {
border: 1px solid var(--color-on-surface);
}
.item-box {
border: 1px solid var(--color-on-surface);
border-radius: 8px;
width: 600px;
height: fit-content;
margin: auto;
}
.item-box-title {
font-variant: small-caps;
text-align: center;
margin-bottom: 10px;
}
</style>