2022-08-29 15:28:38 +00:00
|
|
|
<template>
|
2022-08-29 20:57:34 +00:00
|
|
|
<div class="playground__container">
|
|
|
|
<div class="playground__area">
|
|
|
|
<div class="playground__sources">
|
2022-08-30 16:26:40 +00:00
|
|
|
<SourceCard v-for="source in round.sources" :key="source.id" :source="source" :selectable="selectable"
|
|
|
|
:selected="selection == source.id" @click="selectSource(source)" />
|
2022-08-29 20:57:34 +00:00
|
|
|
</div>
|
|
|
|
<div class="playground__spacer" />
|
|
|
|
<div class="playground__quote">
|
|
|
|
<QuoteCard :quote="quote" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="playground__players-list">
|
2022-08-31 08:57:25 +00:00
|
|
|
<PlayerList :show-score="true" :show-checkbox="playerListShowCheckbox" />
|
2022-08-29 20:57:34 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-08-29 15:28:38 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2022-08-31 08:57:25 +00:00
|
|
|
import { ref, computed } from 'vue'
|
2022-08-30 16:26:40 +00:00
|
|
|
import type { Quote, Source } from '@/composables/engine.d'
|
2022-08-29 20:57:34 +00:00
|
|
|
import { useRoundStore } from '@/stores/RoundStore'
|
2022-08-30 16:26:40 +00:00
|
|
|
import useEngine from '@/composables/useEngine'
|
2022-08-31 08:57:25 +00:00
|
|
|
import { useGameinfoStore } from "@/stores/GameinfoStore"
|
2022-08-30 16:26:40 +00:00
|
|
|
|
2022-08-29 20:57:34 +00:00
|
|
|
const round = useRoundStore().round
|
2022-08-30 16:26:40 +00:00
|
|
|
const quote = { quote: round.quote } as Quote
|
|
|
|
|
|
|
|
const { saveSelection } = useEngine()
|
|
|
|
const selectable = ref(true)
|
2022-08-29 21:29:46 +00:00
|
|
|
const selection = ref('')
|
2022-08-30 16:26:40 +00:00
|
|
|
const selectSource = async (source: Source): Promise<void> => {
|
|
|
|
if (selectable.value) {
|
|
|
|
selectable.value = false
|
|
|
|
await saveSelection(source.id)
|
|
|
|
selection.value = source.id
|
|
|
|
}
|
|
|
|
}
|
2022-08-31 08:57:25 +00:00
|
|
|
|
|
|
|
const game = useGameinfoStore()
|
|
|
|
const playerListShowCheckbox = computed(() => game.state === 'play' && game.phase === 'select-quote')
|
2022-08-29 15:28:38 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
2022-08-29 20:57:34 +00:00
|
|
|
.playground {
|
|
|
|
&__container {
|
|
|
|
display: flex;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
&__area {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
flex-grow: 1;
|
|
|
|
margin: 40px;
|
|
|
|
}
|
|
|
|
|
|
|
|
&__sources {
|
|
|
|
display: flex;
|
|
|
|
flex-wrap: wrap;
|
|
|
|
justify-content: space-around;
|
|
|
|
gap: 24px 36px;
|
|
|
|
}
|
|
|
|
|
|
|
|
&__spacer {
|
|
|
|
flex-grow: 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
&__quote {
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
flex-grow: 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
&__players-list {
|
|
|
|
width: 200px;
|
2022-08-30 16:26:40 +00:00
|
|
|
margin: 16px 16px 0 64px;
|
2022-08-29 20:57:34 +00:00
|
|
|
}
|
|
|
|
}
|
2022-08-29 15:28:38 +00:00
|
|
|
</style>
|