feat: warn, if connection to server is lost

This commit is contained in:
Settel 2022-03-15 08:06:20 +01:00
parent 0d3661a4bc
commit d46c51b35c

View File

@ -15,6 +15,10 @@
<Final v-if="gameState === 'final'" /> <Final v-if="gameState === 'final'" />
</div> </div>
</div> </div>
<div v-if="connectionLost" class="page-play__error-box">
<div>connection to server lost</div>
<button @click="reload">reload</button>
</div>
<div v-if="showDebugPanel" class="page-play__container-debug"> <div v-if="showDebugPanel" class="page-play__container-debug">
<EngineDebug /> <EngineDebug />
</div> </div>
@ -40,6 +44,14 @@ export default {
gamePhase() { gamePhase() {
return this.$store.state.game.phase return this.$store.state.game.phase
}, },
connectionLost() {
return this.$store.state.engine.version == -1
},
},
methods: {
reload() {
window.location.reload()
},
}, },
} }
</script> </script>
@ -80,5 +92,21 @@ export default {
font-size: 24px; font-size: 24px;
color: #ffffff; color: #ffffff;
} }
&__error-box {
position: absolute;
left: 30%;
top: 10%;
width: 40%;
height: 5em;
padding: 1em;
border: 1px solid #ffffff;
border-radius: 20px;
background-color: #804040;
color: #ffffff;
text-align: center;
button {
margin: 1em;
}
}
} }
</style> </style>