knowyt/client/src/components/admin/AdminTileGameinfo.vue
2022-03-01 09:41:30 +01:00

46 lines
934 B
Vue

<template>
<AdminTile class="admin-tile-gameinfo" title="Game">
<table>
<tr>
<td>Name:</td>
<td>{{ gameinfo.name }}</td>
<td><div class="admin-tile-gameinfo__edit-game-name" @click="editName()"></div></td>
</tr>
<tr>
<td># Players:</td>
<td colspan="2">{{ players.length }}</td>
</tr>
</table>
</AdminTile>
</template>
<script>
export default {
props: ['gameinfo', 'players'],
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 })
}
},
},
}
</script>
<style lang="scss">
.admin-tile-gameinfo {
&__edit-game-name {
cursor: pointer;
&:hover {
color: #a0a0a0;
}
&::after {
content: '✎';
}
}
}
</style>