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

67 lines
1.4 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>
2022-04-12 12:16:03 +00:00
<tr>
<td>Created:</td>
<td colspan="2">{{ $formatter.date(gameinfo.created) }}</td>
</tr>
2022-03-01 06:56:01 +00:00
<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-04-12 12:27:49 +00:00
<tr v-if="!showId">
<td colspan="3" @click="showId=true">&nbsp;</td>
</tr>
<tr v-if="showId">
<td colspan="3">{{ gameinfo.id }}</td>
</tr>
2022-03-01 06:56:01 +00:00
</table>
</AdminTile>
</template>
<script>
export default {
props: ['gameinfo', 'players'],
2022-04-12 12:27:49 +00:00
data() {
return {
showId: false,
}
},
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>