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! Play!
</NuxtLink> </NuxtLink>
<div class="playbutton__logout" @click="logout"> <div class="playbutton__logout" @click="logout">
Logout logout/switch session
</div> </div>
</template> </template>
<form v-else v-on:submit="login"> <form v-else v-on:submit="login">

View File

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

View File

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