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

View File

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