Skip to content

Commit 6e5ffed

Browse files
committed
fix(game): fix end screen wrong player order
1 parent 69031fc commit 6e5ffed

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

pages/play/end.vue

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const statsMap = computed(() => {
2727
return game.value.stats?.reduce((acc, stat) => {
2828
acc[stat.user_id] = stat;
2929
return acc;
30-
}, {} as Record<string,GameStats>);
30+
}, {} as Record<string, GameStats>);
3131
});
3232
3333
const computeGame = (activeGame?: ActiveGame): Game | null => {
@@ -84,16 +84,19 @@ onUnmounted(() => {
8484
<template #content>
8585
<div class="h-full flex flex-col ">
8686
<!-- Text content fixed at top -->
87-
<div class="flex justify-center pt-[5%] pb-[5%]">
88-
<GamePlaylistBox v-if="playlist" :playlist="playlist"/>
89-
</div>
87+
<div class="flex justify-center pt-[5%] pb-[5%]">
88+
<GamePlaylistBox v-if="playlist" :playlist="playlist"/>
89+
</div>
9090

91-
<div class="flex justify-between ">
92-
<ScoreboardUserBox v-for="(player) in game?.players" :key="player.id" :user="player" :scoreboard="{score: statsMap![player.id].score, change: 0}"/>
93-
</div>
91+
<div class="flex justify-between ">
92+
<!-- Stupid fix but it works. We didnt implement a win screen for more than 2 players but didnt want to ditch our approach to theoretically handling larger games. -->
93+
94+
<ScoreboardUserBox v-for="(player) in game?.players.filter((p)=>p.id === user?.id)" :key="player.id" :user="player" :scoreboard="{score: statsMap![player.id].score, change: 0}"/>
95+
<ScoreboardUserBox v-for="(player) in game?.players.filter((p)=>p.id !== user?.id)" :key="player.id" :user="player" :scoreboard="{score: statsMap![player.id].score, change: 0}"/>
96+
</div>
9497

9598
<!-- Spacer to push game rounds to bottom -->
96-
<div class="flex-grow" />
99+
<div class="flex-grow"/>
97100

98101
<!-- Game rounds container aligned to bottom -->
99102
<div class="w-full pb-5">

0 commit comments

Comments
 (0)