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

46 lines
934 B
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>
</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>