knowyt/client/src/components/admin/AdminTileGameinfo.vue

52 lines
1.1 KiB
Vue
Raw Normal View History

2022-03-01 06:56:01 +00:00
<template>
2022-03-01 08:41:30 +00:00
<AdminTile class="admin-tile-gameinfo" title="Game">
2022-03-01 06:56:01 +00:00
<table>
<tr>
<td>Name:</td>
<td>{{ gameinfo.name }}</td>
2022-03-01 08:41:30 +00:00
<td><div class="admin-tile-gameinfo__edit-game-name" @click="editName()"></div></td>
2022-03-01 06:56:01 +00:00
</tr>
<tr>
<td># Players:</td>
2022-03-01 08:41:30 +00:00
<td colspan="2">{{ players.length }}</td>
2022-03-01 06:56:01 +00:00
</tr>
<tr>
<td># Quotes played:</td>
<td colspan="2">
{{ gameinfo.numQuotesTotal - gameinfo.numQuotesLeft }} / {{ gameinfo.numQuotesTotal }}
</td>
</tr>
2022-03-01 06:56:01 +00:00
</table>
</AdminTile>
</template>
<script>
export default {
props: ['gameinfo', 'players'],
2022-03-01 08:41:30 +00:00
methods: {
async editName() {
const name = window.prompt('new game name: ')
if (name) {
const g = this.$store.state.engine.user.game
await this.$engine.setGameName({ g, name })
await this.$engine.fetchGameInfo({ g })
}
},
},
2022-03-01 06:56:01 +00:00
}
</script>
2022-03-01 08:41:30 +00:00
<style lang="scss">
.admin-tile-gameinfo {
&__edit-game-name {
cursor: pointer;
&:hover {
color: #a0a0a0;
}
&::after {
content: '✎';
}
}
}
</style>