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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
<div class="startpage"> <div class="startpage">
<TitleBox /> <TitleBox />
<PlayButton class="startpage__buttonline" /> <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"> <div class="startpage__copyright">
v{{ $config.version }}, © 2021-2022, Settel v{{ $config.version }}, © 2021-2022, Settel
</div> </div>

View File

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