2022-09-04 18:06:26 +00:00
|
|
|
<template>
|
|
|
|
<ModalDialog v-if="show" :title="title" @close="emit('close')">
|
|
|
|
<label class="player-dialog__label">Name</label>
|
2022-09-06 11:37:14 +00:00
|
|
|
<input class="player-dialog__input" v-model="player.name" size="40" />
|
2022-09-04 18:06:26 +00:00
|
|
|
<label class="player-dialog__label">Score</label>
|
2022-09-06 11:37:14 +00:00
|
|
|
<input class="player-dialog__input" v-model="player.score" size="40" maxlength="4" />
|
2022-09-04 18:06:26 +00:00
|
|
|
<label class="player-dialog__label">Authcode</label>
|
2022-09-06 11:37:14 +00:00
|
|
|
<input class="player-dialog__input" v-model="player.authcode" size="40" maxlength="6" />
|
2022-09-04 18:06:26 +00:00
|
|
|
<div class="player-dialog__id-container" @click="showId = true">
|
2022-09-06 11:37:14 +00:00
|
|
|
<span class="player-dialog__id" :class="{ 'player-dialog__id__show': showId }">{{ player.id }}</span>
|
2022-09-04 18:06:26 +00:00
|
|
|
</div>
|
|
|
|
<template v-slot:footer>
|
2022-09-06 13:42:36 +00:00
|
|
|
<Button v-for="button in buttons" :key="button.id" class="player-dialog__button" :border="['primary', 'caution'].indexOf(button.type) >= 0"
|
2022-09-06 11:37:14 +00:00
|
|
|
@click="emit('submit', button.id)">{{ button.name }}</Button>
|
2022-09-04 18:06:26 +00:00
|
|
|
</template>
|
|
|
|
</ModalDialog>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
import { ref, watch } from 'vue'
|
|
|
|
import { PlayerEdit } from '@/composables/engine.d'
|
2022-09-06 13:42:36 +00:00
|
|
|
import type { Button } from '@/components/admin/PlayerModal'
|
2022-09-06 11:37:14 +00:00
|
|
|
|
2022-09-04 18:06:26 +00:00
|
|
|
const props = defineProps<{
|
|
|
|
title: string
|
|
|
|
show: boolean
|
2022-09-06 11:37:14 +00:00
|
|
|
buttons: Array<Button>
|
2022-09-04 18:06:26 +00:00
|
|
|
player: PlayerEdit
|
|
|
|
}>()
|
|
|
|
|
|
|
|
const emit = defineEmits(['close', 'submit'])
|
|
|
|
const showId = ref(false)
|
|
|
|
watch([props], () => { showId.value = false }) // reset visibility each time the dialog is shown
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
@import '~/assets/css/components';
|
|
|
|
|
|
|
|
.player-dialog {
|
|
|
|
&__label {
|
|
|
|
display: block;
|
|
|
|
margin: 16px 0 4px 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
&__input {
|
|
|
|
border: 1px solid white;
|
|
|
|
background-color: $modal-dialog-background-color;
|
|
|
|
color: $modal-dialog-text-color;
|
|
|
|
border-radius: 4px;
|
|
|
|
}
|
|
|
|
|
|
|
|
&__id-container {
|
|
|
|
margin: 16px 0 0 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
&__id {
|
|
|
|
visibility: hidden;
|
|
|
|
|
|
|
|
&__show {
|
|
|
|
visibility: visible;
|
|
|
|
}
|
|
|
|
}
|
2022-09-06 11:37:14 +00:00
|
|
|
|
|
|
|
&__button ~ &__button {
|
|
|
|
margin-left: 16px;
|
|
|
|
}
|
2022-09-04 18:06:26 +00:00
|
|
|
}
|
|
|
|
</style>
|