Add TFT items

This commit is contained in:
BlossomiShymae
2024-09-13 11:13:49 -05:00
parent 14ce67aa5e
commit be4084b79a
2 changed files with 55 additions and 0 deletions

View File

@@ -60,6 +60,11 @@
<MaterialIcon name="penguin" :size="24" /> Companions <MaterialIcon name="penguin" :size="24" /> Companions
</NuxtLink> </NuxtLink>
</li> </li>
<li>
<NuxtLink class="nav-link" to="/tft-items">
<MaterialIcon name="magic-staff" :size="24" /> Items
</NuxtLink>
</li>
</ul> </ul>
</div> </div>
</li> </li>

50
pages/tft-items/index.vue Normal file
View File

@@ -0,0 +1,50 @@
<template>
<div class="d-flex flex-column gap-2">
<h1>TFT Items</h1>
<div class="overflow-hidden rounded border border-light border-opacity-25 p-4">
<table class="sortable table table-borderless">
<thead>
<tr>
<th scope="col">Guid</th>
<th scope="col">Icon</th>
<th scope="col">Name</th>
<th scope="col">Name Id</th>
</tr>
</thead>
<tbody>
<tr v-for="tftItem in tftItems" :key="tftItem.guid" style="postion: relative;">
<th scope="row">
<NuxtLink class="text-decoration-none text-light stretched-link" :to="`/tft-items/overview/${tftItem.guid}`">
{{ tftItem.guid }}
</NuxtLink>
</th>
<th scope="row">
<img class="rounded" :src="tftItem.getSquareIcon('latest')" width="32" height="32" loading="lazy" onerror="this.onerror = null; this.src = '/clean-cuts/img/error.png'"/>
</th>
<th scope="row">
<span class="text-decoration-none text-light fw-normal">{{ tftItem.name }}</span>
</th>
<th scope="row">
{{ tftItem.nameId }}
</th>
</tr>
</tbody>
</table>
</div>
</div>
</template>
<script setup lang="ts">
import useClient from '~/composables/useClient';
import useLocale from '~/composables/useLocale';
const { client } = useClient();
const { currentLocale } = useLocale();
const getTftItems = async() => await client.tftItems.listAsync({ locale: currentLocale.value, version: "latest"});
const tftItems = ref(await getTftItems());
watch(currentLocale, async() => {
tftItems.value = await getTftItems();
});
</script>