Skip to content

Commit dcaf8f8

Browse files
committed
Make IncompleteGame and LobbyGame look similar
1 parent 39fa211 commit dcaf8f8

File tree

3 files changed

+54
-25
lines changed

3 files changed

+54
-25
lines changed

src/views/lobby/IncompleteGame.vue

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,37 @@
11
<template>
2-
<v-card color="#ddf9fd">
3-
<span>GameId {{ game.gameId }}</span
4-
><br />
5-
<span>Clicks {{ game.clicks }}</span>
6-
<div class="game-player-info">
7-
<div v-for="(info, index) in playerScores" :key="index">
8-
{{ info.player }} ({{ info.score }})
9-
</div>
10-
</div>
11-
<v-btn @click="resume()">Resume</v-btn>
2+
<v-card>
3+
<v-layout column align-space-around justify-center>
4+
<v-layout row align-center justify-center fill-height>
5+
<v-layout
6+
v-for="(info, index) in playerScores"
7+
:key="index"
8+
column
9+
align-center
10+
justify-center
11+
:class="{ currentPlayer: game.currentPlayerIndex === index }"
12+
>
13+
<img
14+
style="width: 36px; height: 36px"
15+
:src="users[index].picture"
16+
v-if="users[index] && users[index].picture"
17+
/>
18+
<v-icon large v-else>help</v-icon>
19+
<span>{{ info.player }}</span>
20+
<span>{{ info.score }}</span>
21+
</v-layout>
22+
</v-layout>
23+
<v-tooltip bottom>
24+
<template v-slot:activator="{ on }">
25+
<v-btn @click="resume()" v-on="on">Resume</v-btn>
26+
</template>
27+
<span>GameId {{ game.gameId }}</span>
28+
</v-tooltip>
29+
</v-layout>
1230
</v-card>
1331
</template>
1432
<script>
33+
import { mapState } from "vuex";
34+
1535
export default {
1636
name: "IncompleteGame",
1737
props: ["game"],
@@ -32,7 +52,14 @@ export default {
3252
},
3353
scores() {
3454
return this.game.scores.split(",");
35-
}
55+
},
56+
...mapState("lobby", {
57+
users(state) {
58+
return this.game.players.map(
59+
player => state.onlineUsers[player.playerName]
60+
);
61+
}
62+
})
3663
}
3764
};
3865
</script>

src/views/lobby/Lobby.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<v-layout row wrap align-space-around>
77
<LobbyBox class="xs12" title="Your Games">
88
<SmallBox
9-
class="xs12"
9+
class="xs12 md6"
1010
v-for="game in incompleteGames"
1111
:key="game.gameId"
1212
>
@@ -34,7 +34,7 @@
3434

3535
<LobbyBox class="xs12" title="Other Games" transition="true">
3636
<template v-for="(game, index) in lobbyGames">
37-
<SmallBox class="xs12 md6 lg4" :key="index">
37+
<SmallBox class="xs12 md6" :key="index">
3838
<LobbyGame :game="game" />
3939
</SmallBox>
4040
</template>

src/views/lobby/LobbyGame.vue

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
11
<template>
22
<v-card>
3-
<v-layout column align-space-around justify-center>
4-
<v-layout row align-center justify-center fill-height>
3+
<v-layout row wrap align-center justify-center>
4+
<v-flex xs6 v-for="(info, index) in game.players" :key="index">
55
<v-layout
6-
v-for="(info, index) in game.players"
7-
:key="index"
86
column
97
align-center
108
justify-center
119
:class="{ currentPlayer: game.currentPlayerIndex === index }"
1210
>
1311
<img
14-
style="width: 36px; height: 36px"
12+
style="width: 36px; height: 36px; margin-top: 4px"
1513
:src="users[index].picture"
1614
v-if="users[index] && users[index].picture"
1715
/>
1816
<v-icon large v-else>help</v-icon>
1917
<span>{{ info.playerName }}</span>
2018
<span>{{ info.score }}</span>
2119
</v-layout>
22-
</v-layout>
23-
<v-tooltip bottom>
24-
<template v-slot:activator="{ on }">
25-
<v-btn @click="observe()" v-on="on">Observe</v-btn>
26-
</template>
27-
<span>GameId {{ game.gameId }}</span>
28-
</v-tooltip>
20+
</v-flex>
21+
<v-flex xs12>
22+
<v-tooltip bottom>
23+
<template v-slot:activator="{ on }">
24+
<v-btn style="align-self: center" @click="observe()" v-on="on">
25+
Observe
26+
</v-btn>
27+
</template>
28+
<span>GameId {{ game.gameId }}</span>
29+
</v-tooltip>
30+
</v-flex>
2931
</v-layout>
3032
</v-card>
3133
</template>

0 commit comments

Comments
 (0)