refactor: create game -> create team

This commit is contained in:
Settel 2022-04-12 18:30:49 +02:00
parent c5e0ef4dad
commit 67509d32ec
6 changed files with 25 additions and 24 deletions

View File

@ -1,15 +1,15 @@
<template>
<div class="create-game">
<div v-if="!showModal" class="create-game__button" @click="openModal">
create game
<div class="create-team">
<div v-if="!showModal" class="create-team__button" @click="openModal">
create team
</div>
<template v-if="showModal">
<div class="create-game__backdrop" />
<div class="create-game__modal">
<div class="create-team__backdrop" />
<div class="create-team__modal">
<template v-if="authcode">
<div class="create-game__modal-success-message">
<div class="create-team__modal-success-message">
<p>Deine PIN lautet:</p>
<div class="create-game__modal-pin">
<div class="create-team__modal-pin">
{{ authcode}}
</div>
<p>Schreibe sie Dir am besten gleich auf und logge dich anschließend damit ein.</p>
@ -17,14 +17,15 @@
<PlayButton />
</template>
<template v-else>
<div class="create-game__modal-content">
<div class="create-game__modal-close" @click="closeModal" />
<div class="create-team__modal-content">
<div class="create-team__modal-close" @click="closeModal" />
<p>
Erstellt eine neues, leeres Spiel und einen Useraccount als Gamemaster.
Erstellt eine neues Team und einen ersten Useraccount für Dich
als Gamemaster.
</p>
<table class="create-game__modal-content-table">
<table class="create-team__modal-content-table">
<tr>
<td>Name</td>
<td>Dein Name</td>
<td><input v-model="name" size="16" /></td>
</tr>
<tr>
@ -34,11 +35,11 @@
</table>
</div>
<Button
class="create-game__modal-cta"
class="create-team__modal-cta"
:disabled="name.length == 0 || teamname.length == 0"
@click="createGame"
@click="createTeam"
>
create game
create team
</Button>
</template>
</div>
@ -64,9 +65,9 @@ export default {
closeModal() {
this.showModal = false
},
async createGame() {
async createTeam() {
this.showModal = false
const user = await this.$engine.createGame(this.name, this.teamname)
const user = await this.$engine.createTeam(this.name, this.teamname)
this.showModal = true
this.authcode = user.data.authcode
},
@ -77,7 +78,7 @@ export default {
<style lang="scss">
@import '~/assets/css/components';
.create-game {
.create-team {
&__backdrop {
position: absolute;
left: 0;

View File

@ -7,7 +7,7 @@
<td><div class="admin-tile-gameinfo__edit-game-name" @click="editName()"></div></td>
</tr>
<tr>
<td>Created:</td>
<td>Erstellt:</td>
<td colspan="2">{{ $formatter.date(gameinfo.created) }}</td>
</tr>
<tr>

View File

@ -14,7 +14,7 @@
<th class="admin-tile-players__table-head">Name</th>
<th class="admin-tile-players__table-head">#&nbsp;Quotes</th>
<th class="admin-tile-players__table-head">Score</th>
<th class="admin-tile-players__table-head">Status</th>
<th class="admin-tile-players__table-head">zuletzt eingeloggt</th>
</tr>
<tr
class="admin-tile-players__player"
@ -58,7 +58,7 @@ export default {
},
getPlayerStatus(player) {
if (player.isPlaying && !player.isIdle) {
return 'active'
return 'online'
} else {
if (player.lastLoggedIn) {
return this.$formatter.datetime(player.lastLoggedIn)

View File

@ -2,7 +2,7 @@
<div class="startpage">
<TitleBox />
<PlayButton class="startpage__buttonline" />
<CreateGame v-if="!$store.state.engine.user" class="startpage__creategame" />
<CreateTeam v-if="!$store.state.engine.user" class="startpage__creategame" />
<div class="startpage__copyright">
v{{ $config.version }}, © 2021-2022, Settel
</div>

View File

@ -19,7 +19,7 @@ import getMyQuotes from './getMyQuotes'
import saveQuote from './saveQuote'
import createQuote from './createQuote'
import removeQuote from './removeQuote'
import createGame from './createGame'
import createTeam from './createTeam'
export default (context, inject) => {
const engine = {
@ -49,7 +49,7 @@ export default (context, inject) => {
finishGame,
parseSyncData,
saveSelection,
createGame,
createTeam,
}
inject('engine', engine)