feat: gamemaster: reload button

This commit is contained in:
Settel 2022-03-25 11:31:00 +01:00
parent 278dcbc0b0
commit 72ff65790a
3 changed files with 29 additions and 1 deletions

View File

@ -6,7 +6,7 @@
Play!
</NuxtLink>
<div class="playbutton__logout" @click="logout">
Logout
logout/switch session
</div>
</template>
<form v-else v-on:submit="login">

View File

@ -2,6 +2,7 @@
<div class="admin-tile">
<div v-if="title" class="admin-tile__title">
{{ title }}
<slot name="headerAction" />
</div>
<div class="admin-tile__body">
<slot />

View File

@ -1,5 +1,14 @@
<template>
<AdminTile class="admin-tile-players" title="Players">
<template v-slot:headerAction>
<span
v-if="!isReloading"
class="admin-tile-players__action-reload"
@click="reload"
>
</span>
</template>
<table class="admin-tile-players__table">
<tr v-if="players.length">
<th class="admin-tile-players__table-head">Name</th>
@ -25,6 +34,11 @@
<script>
export default {
props: ['gameinfo', 'players'],
data() {
return {
isReloading: false,
}
},
methods: {
editPlayer(player) {
this.$emit('edit', player)
@ -32,12 +46,25 @@ export default {
newPlayer() {
this.$emit('edit', { id: null, name: '', score: 0, authcode: '' })
},
reload() {
this.$emit('reload')
this.isReloading = true
setTimeout(() => { this.isReloading = false }, 500)
}
},
}
</script>
<style lang="scss">
.admin-tile-players {
&__action-reload {
float: right;
cursor: pointer;
&:hover {
color: #c0c0c0;
}
}
&__table {
margin-left: -12px;
border-collapse: separate;