refactoring

This commit is contained in:
Settel 2021-08-13 00:12:04 +02:00
parent d7220714f0
commit da0760850a
3 changed files with 50 additions and 27 deletions

View File

@ -0,0 +1,33 @@
<template>
<div class="enginedebug">
<pre class="enginedebug__json">{{ userJson }}</pre>
<pre class="enginedebug__json">{{ engineJson }}</pre>
</div>
</template>
<script>
export default {
computed: {
userJson() {
return JSON.stringify(this.$store.state.engine.user, null, 2)
},
engineJson() {
return JSON.stringify(this.$store.state.engine.json, null, 2)
},
}
}
</script>
<style lang="scss">
.enginedebug {
position: absolute;
right: 0;
bottom: 0;
background-color: #002040;
&__json {
margin: 1em 2em;
color: #808080;
}
}
</style>

View File

@ -1,9 +1,7 @@
<template>
<div>
<nav>
<h1 v-if="isGamemaster">Gamemaster</h1>
<nav v-if="isGamemaster" class="gamecontrols">
<button @click="startGame">Start</button>
</nav>
</div>
</template>
<script>
@ -17,5 +15,17 @@ export default {
return user && user.role === 'gamemaster'
},
},
methods: {
startGame() {
alert('start game')
},
},
}
</script>
<style lang="scss">
.gamecontrols {
padding: 8px 1em;
border-bottom: 1px solid #808080;
}
</style>

View File

@ -1,12 +1,7 @@
<template>
<div>
<div>
<GameControls />
</div>
<hr />
<div v-if="userJson">{{ userJson.role }}</div>
<pre class="json">{{ userJson }}</pre>
<pre class="json">{{ engineJson }}</pre>
<EngineDebug />
</div>
</template>
@ -18,20 +13,5 @@ export default {
async beforeDestroy() {
await this.$engine.stop()
},
computed: {
userJson() {
return JSON.stringify(this.$store.state.engine.user, null, 2)
},
engineJson() {
return JSON.stringify(this.$store.state.engine.json, null, 2)
},
}
}
</script>
<style lang="scss">
.json {
margin: 1em 2em;
color: #ffffff;
}
</style>