From 1bc273571f8b23ca6e6c20cdc00e1dd50bad9f83 Mon Sep 17 00:00:00 2001 From: vhaudiquet Date: Fri, 29 Nov 2024 21:40:28 +0100 Subject: [PATCH] Added basic tierlist (fix #4) --- frontend/components/ChampionSelector.vue | 6 +- frontend/pages/tierlist/[lane].vue | 141 +++++++++++++++++++++++ 2 files changed, 144 insertions(+), 3 deletions(-) create mode 100644 frontend/pages/tierlist/[lane].vue diff --git a/frontend/components/ChampionSelector.vue b/frontend/components/ChampionSelector.vue index 100bd0b..3d42efd 100644 --- a/frontend/components/ChampionSelector.vue +++ b/frontend/components/ChampionSelector.vue @@ -6,8 +6,8 @@ const champions = championsData.value.slice(1).sort((a, b) => { return 0; }) -const {data: championsLanes} : {data: Ref} = await useFetch("/api/champions") -const lanesMap = new Map() +const {data: championsLanes} : {data: Ref>} = await useFetch("/api/champions") +const lanesMap : Map> = new Map() for(let champion of championsLanes.value) { lanesMap.set(champion.alias, champion.lanes) } @@ -39,7 +39,7 @@ function filterToLane(filter: number) { function onLaneFilterChange(newValue: number) { if(newValue != -1) { filteredChampions.value = champions.filter((champion) => { - const lanes : Array = lanesMap.get(champion.alias.toLowerCase()) + const lanes : Array | undefined = lanesMap.get(champion.alias.toLowerCase()) if(lanes == undefined) return false; return lanes.reduce((acc : boolean, current : {data:string, count:number}) => diff --git a/frontend/pages/tierlist/[lane].vue b/frontend/pages/tierlist/[lane].vue new file mode 100644 index 0000000..b952382 --- /dev/null +++ b/frontend/pages/tierlist/[lane].vue @@ -0,0 +1,141 @@ + + + + + \ No newline at end of file