Champion page improvements
This commit is contained in:
@@ -11,7 +11,14 @@ const props = defineProps<{
|
||||
const ITEMS_API_URL = CDRAGON_BASE + 'plugins/rcp-be-lol-game-data/global/default/v1/items.json'
|
||||
|
||||
// State
|
||||
const { data: items, pending: loadingItems, error: itemsError } = await useFetch(ITEMS_API_URL)
|
||||
const {
|
||||
data: items,
|
||||
pending: loadingItems,
|
||||
error: itemsError
|
||||
} = useFetch(ITEMS_API_URL, {
|
||||
lazy: true, // Don't block rendering
|
||||
server: false // Client-side only
|
||||
})
|
||||
const itemMap = ref<Map<number, unknown>>(new Map())
|
||||
|
||||
// Initialize item map
|
||||
@@ -107,13 +114,23 @@ const _isLoading = computed(() => loadingItems.value || props.loading)
|
||||
style="margin-left: 5px; margin-right: 5px"
|
||||
>
|
||||
<NuxtImg
|
||||
v-if="item.data != null && item.data != undefined"
|
||||
v-if="item.data != null && item.data != undefined && itemMap.get(item.data)"
|
||||
class="item-img"
|
||||
width="64"
|
||||
height="64"
|
||||
:alt="item.data.toString()"
|
||||
:src="CDRAGON_BASE + mapPath((itemMap.get(item.data) as any).iconPath)"
|
||||
/>
|
||||
<div
|
||||
v-else
|
||||
style="
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
margin: 10px;
|
||||
background: var(--color-surface);
|
||||
border: 1px solid var(--color-on-surface);
|
||||
"
|
||||
></div>
|
||||
<h3 style="width: fit-content; margin: auto; margin-bottom: 10px">
|
||||
{{ ((item.count / builds.tree.count) * 100).toFixed(0) }}%
|
||||
</h3>
|
||||
@@ -129,13 +146,23 @@ const _isLoading = computed(() => loadingItems.value || props.loading)
|
||||
style="margin-left: 5px; margin-right: 5px"
|
||||
>
|
||||
<NuxtImg
|
||||
v-if="item.data != null && item.data != undefined"
|
||||
v-if="item.data != null && item.data != undefined && itemMap.get(item.data)"
|
||||
class="item-img"
|
||||
width="64"
|
||||
height="64"
|
||||
:alt="item.data.toString()"
|
||||
:src="CDRAGON_BASE + mapPath((itemMap.get(item.data) as any).iconPath)"
|
||||
/>
|
||||
<div
|
||||
v-else
|
||||
style="
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
margin: 10px;
|
||||
background: var(--color-surface);
|
||||
border: 1px solid var(--color-on-surface);
|
||||
"
|
||||
></div>
|
||||
<h3 style="width: fit-content; margin: auto; margin-bottom: 10px">
|
||||
{{ ((item.count / builds.tree.count) * 100).toFixed(0) }}%
|
||||
</h3>
|
||||
@@ -153,13 +180,23 @@ const _isLoading = computed(() => loadingItems.value || props.loading)
|
||||
style="margin-left: 5px; margin-right: 5px"
|
||||
>
|
||||
<NuxtImg
|
||||
v-if="item.data != null && item.data != undefined"
|
||||
v-if="item.data != null && item.data != undefined && itemMap.get(item.data)"
|
||||
class="item-img"
|
||||
width="64"
|
||||
height="64"
|
||||
:alt="item.data.toString()"
|
||||
:src="CDRAGON_BASE + mapPath((itemMap.get(item.data) as any).iconPath)"
|
||||
/>
|
||||
<div
|
||||
v-else
|
||||
style="
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
margin: 10px;
|
||||
background: var(--color-surface);
|
||||
border: 1px solid var(--color-on-surface);
|
||||
"
|
||||
></div>
|
||||
<h3 style="width: fit-content; margin: auto; margin-bottom: 10px">
|
||||
{{ ((item.count / builds.tree.count) * 100).toFixed(0) }}%
|
||||
</h3>
|
||||
@@ -181,13 +218,23 @@ const _isLoading = computed(() => loadingItems.value || props.loading)
|
||||
style="margin-left: 5px; margin-right: 5px"
|
||||
>
|
||||
<NuxtImg
|
||||
v-if="item.data != null && item.data != undefined"
|
||||
v-if="item.data != null && item.data != undefined && itemMap.get(item.data)"
|
||||
class="item-img"
|
||||
width="64"
|
||||
height="64"
|
||||
:alt="item.data.toString()"
|
||||
:src="CDRAGON_BASE + mapPath((itemMap.get(item.data) as any).iconPath)"
|
||||
/>
|
||||
<div
|
||||
v-else
|
||||
style="
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
margin: 10px;
|
||||
background: var(--color-surface);
|
||||
border: 1px solid var(--color-on-surface);
|
||||
"
|
||||
></div>
|
||||
<h3 style="width: fit-content; margin: auto; margin-bottom: 10px">
|
||||
{{ ((item.count / builds.tree.count) * 100).toFixed(0) }}%
|
||||
</h3>
|
||||
@@ -205,13 +252,23 @@ const _isLoading = computed(() => loadingItems.value || props.loading)
|
||||
style="margin-left: 5px; margin-right: 5px"
|
||||
>
|
||||
<NuxtImg
|
||||
v-if="item.data != null && item.data != undefined"
|
||||
v-if="item.data != null && item.data != undefined && itemMap.get(item.data)"
|
||||
class="item-img"
|
||||
width="64"
|
||||
height="64"
|
||||
:alt="item.data.toString()"
|
||||
:src="CDRAGON_BASE + mapPath((itemMap.get(item.data) as any).iconPath)"
|
||||
/>
|
||||
<div
|
||||
v-else
|
||||
style="
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
margin: 10px;
|
||||
background: var(--color-surface);
|
||||
border: 1px solid var(--color-on-surface);
|
||||
"
|
||||
></div>
|
||||
<h3 style="width: fit-content; margin: auto; margin-bottom: 10px">
|
||||
{{ ((item.count / builds.tree.count) * 100).toFixed(0) }}%
|
||||
</h3>
|
||||
@@ -225,13 +282,23 @@ const _isLoading = computed(() => loadingItems.value || props.loading)
|
||||
style="margin-left: 5px; margin-right: 5px"
|
||||
>
|
||||
<NuxtImg
|
||||
v-if="item.data != null && item.data != undefined"
|
||||
v-if="item.data != null && item.data != undefined && itemMap.get(item.data)"
|
||||
class="item-img"
|
||||
width="64"
|
||||
height="64"
|
||||
:alt="item.data.toString()"
|
||||
:src="CDRAGON_BASE + mapPath((itemMap.get(item.data) as any).iconPath)"
|
||||
/>
|
||||
<div
|
||||
v-else
|
||||
style="
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
margin: 10px;
|
||||
background: var(--color-surface);
|
||||
border: 1px solid var(--color-on-surface);
|
||||
"
|
||||
></div>
|
||||
<h3 style="width: fit-content; margin: auto; margin-bottom: 10px">
|
||||
{{ ((item.count / builds.tree.count) * 100).toFixed(0) }}%
|
||||
</h3>
|
||||
|
||||
Reference in New Issue
Block a user