39 lines
1.7 KiB
Vue
39 lines
1.7 KiB
Vue
<script setup lang="ts">
|
|
const route = useRoute()
|
|
const championAlias = route.params.alias as string
|
|
|
|
const { data : championData } : {data : Ref<ChampionData>} = await useFetch("/api/champion/" + championAlias.toLowerCase())
|
|
const championId = championData.value.id
|
|
|
|
const laneState = ref(0)
|
|
const state = ref("runes")
|
|
const lane = ref(championData.value.lanes[laneState.value])
|
|
function updateState(newState : string, newLane : number) {
|
|
state.value = newState
|
|
laneState.value = newLane
|
|
lane.value = championData.value.lanes[laneState.value]
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<Head>
|
|
<Title>{{ championData.name }} - BuildPath</Title>
|
|
</Head>
|
|
|
|
<SideBar :champion-name="championData.name"
|
|
:champion-lanes="championData.lanes"
|
|
@state-change="updateState"/>
|
|
|
|
<!-- <div style="display: flex; width: fit-content; margin: auto; margin-left: 330px;"> -->
|
|
<div style="margin-top: 64px; margin-left: 339px;">
|
|
<ChampionTitle v-if="championData.gameCount > 0" :champion-id="championId" :winrate="lane.winrate" :pickrate="lane.pickrate" :game-count="lane.count" />
|
|
<RuneSelector v-if="state == 'runes' && championData.gameCount > 0" style="margin: auto; margin-top: 40px;" :runes="lane.runes!!" />
|
|
<ItemViewer v-if="state == 'items' && championData.gameCount > 0" style="margin:auto; margin-top: 40px;" :builds="lane.builds!!" />
|
|
<h2 v-if="championData.gameCount == 0" style="margin: auto; margin-top: 20px; width: fit-content;">Sorry, there is no data for this champion :(</h2>
|
|
</div>
|
|
<!-- <ItemViewer v-if="championData.gameCount > 0" style="margin-top: 64px; margin-left: 64px;" :builds="championData.builds" /> -->
|
|
<!-- </div> -->
|
|
</template>
|
|
|
|
<style>
|
|
</style> |