mirror of
https://github.com/anatolykopyl/vk-bingo.git
synced 2026-03-26 12:54:25 +00:00
Style fixes
This commit is contained in:
@@ -313,7 +313,7 @@ const client = new MongoClient(process.env.URI, { useUnifiedTopology: true });
|
|||||||
});
|
});
|
||||||
|
|
||||||
emitter.on("end", () => {
|
emitter.on("end", () => {
|
||||||
res.write(`event: end\n\n`);
|
res.write(`data: {}\nevent: end\n\n`);
|
||||||
res.end();
|
res.end();
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,12 @@
|
|||||||
],
|
],
|
||||||
"rules": {
|
"rules": {
|
||||||
"vue/multi-word-component-names": 0
|
"vue/multi-word-component-names": 0
|
||||||
|
},
|
||||||
|
"globals": {
|
||||||
|
"defineProps": "readonly",
|
||||||
|
"defineEmits": "readonly",
|
||||||
|
"defineExpose": "readonly",
|
||||||
|
"withDefaults": "readonly"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
|
|||||||
@@ -27,8 +27,10 @@
|
|||||||
|
|
||||||
:root {
|
:root {
|
||||||
--clr-bg: #ffd537;
|
--clr-bg: #ffd537;
|
||||||
|
--clr-bg-secondary: #fbf2cf;
|
||||||
--clr-accent: #37ffac;
|
--clr-accent: #37ffac;
|
||||||
--clr-text: #141414;
|
--clr-text: #141414;
|
||||||
|
--clr-text-secondary: rgb(20, 20, 20, .5);
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
|
|||||||
42
frontend/src/components/Countdown.vue
Normal file
42
frontend/src/components/Countdown.vue
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<template>
|
||||||
|
<div class="bar">
|
||||||
|
<div
|
||||||
|
class="fill"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.bar {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fill {
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 16px;
|
||||||
|
background: white;
|
||||||
|
animation: move 5s linear;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes move {
|
||||||
|
from {
|
||||||
|
transform: translateX(-100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
transform: translateX(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="end">
|
<div class="end">
|
||||||
<button
|
<button
|
||||||
@click="endGame"
|
|
||||||
class="endButton"
|
class="endButton"
|
||||||
|
@click="endGame"
|
||||||
>
|
>
|
||||||
Закончить игру
|
Закончить игру
|
||||||
</button>
|
</button>
|
||||||
@@ -32,6 +32,7 @@ function endGame() {
|
|||||||
background: none;
|
background: none;
|
||||||
border: none;
|
border: none;
|
||||||
font: inherit;
|
font: inherit;
|
||||||
|
color: var(--clr-text);
|
||||||
padding: 8px 12px;
|
padding: 8px 12px;
|
||||||
border-bottom: 1px dotted var(--clr-text);
|
border-bottom: 1px dotted var(--clr-text);
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,8 @@
|
|||||||
|
|
||||||
<EndGame />
|
<EndGame />
|
||||||
|
|
||||||
|
<Countdown v-if="correctAnswer" />
|
||||||
|
|
||||||
<square-loader
|
<square-loader
|
||||||
v-if="!card"
|
v-if="!card"
|
||||||
:color="'white'"
|
:color="'white'"
|
||||||
@@ -51,6 +53,7 @@ import Result from './Result.vue'
|
|||||||
import EndGame from './EndGame.vue'
|
import EndGame from './EndGame.vue'
|
||||||
import useStore from '@/store'
|
import useStore from '@/store'
|
||||||
import useServerEvents from '@/composables/useServerEvents'
|
import useServerEvents from '@/composables/useServerEvents'
|
||||||
|
import Countdown from '@/components/Countdown.vue'
|
||||||
|
|
||||||
import SquareLoader from 'vue-spinner/src/SquareLoader.vue'
|
import SquareLoader from 'vue-spinner/src/SquareLoader.vue'
|
||||||
|
|
||||||
|
|||||||
@@ -28,11 +28,14 @@ export default {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped lang="scss">
|
||||||
.result {
|
.result {
|
||||||
padding: 30px 40px;
|
padding: 30px 40px;
|
||||||
border-radius: 32px;
|
border-radius: 32px;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
|
font-weight: 600;
|
||||||
|
border: 3px solid var(--clr-text);
|
||||||
|
@include filled-shadow(16);
|
||||||
}
|
}
|
||||||
|
|
||||||
.correct {
|
.correct {
|
||||||
|
|||||||
@@ -4,11 +4,16 @@
|
|||||||
|
|
||||||
<div class="auth">
|
<div class="auth">
|
||||||
<p>{{ question }}</p>
|
<p>{{ question }}</p>
|
||||||
|
|
||||||
<input
|
<input
|
||||||
v-model="answer"
|
v-model="answer"
|
||||||
placeholder="Ответ"
|
placeholder="Ответ"
|
||||||
class="input"
|
class="input"
|
||||||
|
:class="{
|
||||||
|
'-wrong': wrongPassword
|
||||||
|
}"
|
||||||
>
|
>
|
||||||
|
|
||||||
<input
|
<input
|
||||||
v-if="mode === 'player'"
|
v-if="mode === 'player'"
|
||||||
v-model="username"
|
v-model="username"
|
||||||
@@ -19,6 +24,7 @@
|
|||||||
<button
|
<button
|
||||||
v-if="mode === 'player'"
|
v-if="mode === 'player'"
|
||||||
class="login"
|
class="login"
|
||||||
|
:disabled="!username || !answer"
|
||||||
@click="loginPlayer"
|
@click="loginPlayer"
|
||||||
>
|
>
|
||||||
Войти как игрок
|
Войти как игрок
|
||||||
@@ -26,6 +32,7 @@
|
|||||||
<button
|
<button
|
||||||
v-else
|
v-else
|
||||||
class="login"
|
class="login"
|
||||||
|
:disabled="!answer"
|
||||||
@click="loginScreen"
|
@click="loginScreen"
|
||||||
>
|
>
|
||||||
Войти как большой экран
|
Войти как большой экран
|
||||||
@@ -56,6 +63,7 @@ const store = useStore()
|
|||||||
const mode = ref("player")
|
const mode = ref("player")
|
||||||
const answer = ref()
|
const answer = ref()
|
||||||
const username = ref()
|
const username = ref()
|
||||||
|
const wrongPassword = ref()
|
||||||
|
|
||||||
function switchMode() {
|
function switchMode() {
|
||||||
mode.value = mode.value === 'player' ? 'screen' : 'player'
|
mode.value = mode.value === 'player' ? 'screen' : 'player'
|
||||||
@@ -68,24 +76,32 @@ async function loginPlayer() {
|
|||||||
|
|
||||||
store.username = username.value
|
store.username = username.value
|
||||||
|
|
||||||
await axios
|
try {
|
||||||
.post(import.meta.env.VITE_APP_BACKEND + '/auth', {
|
await axios
|
||||||
"pass": answer.value,
|
.post(import.meta.env.VITE_APP_BACKEND + '/auth', {
|
||||||
"username": username.value,
|
"pass": answer.value,
|
||||||
})
|
"username": username.value,
|
||||||
|
})
|
||||||
|
|
||||||
router.push('/game')
|
router.push('/game')
|
||||||
|
} catch {
|
||||||
|
wrongPassword.value = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loginScreen() {
|
async function loginScreen() {
|
||||||
store.username = undefined
|
store.username = undefined
|
||||||
|
|
||||||
await axios
|
try {
|
||||||
.post(import.meta.env.VITE_APP_BACKEND + '/auth', {
|
await axios
|
||||||
"pass": answer.value,
|
.post(import.meta.env.VITE_APP_BACKEND + '/auth', {
|
||||||
})
|
"pass": answer.value,
|
||||||
|
})
|
||||||
|
|
||||||
router.push('/screen')
|
router.push('/screen')
|
||||||
|
} catch {
|
||||||
|
wrongPassword.value = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -126,6 +142,10 @@ async function loginScreen() {
|
|||||||
&:focus {
|
&:focus {
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.-wrong {
|
||||||
|
border-color: red;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.login {
|
.login {
|
||||||
@@ -140,6 +160,11 @@ async function loginScreen() {
|
|||||||
border: 2px solid var(--clr-text);
|
border: 2px solid var(--clr-text);
|
||||||
@include filled-shadow(4);
|
@include filled-shadow(4);
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
|
|
||||||
|
&:disabled {
|
||||||
|
cursor: default;
|
||||||
|
color: var(--clr-text-secondary);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.switchMode {
|
.switchMode {
|
||||||
@@ -154,6 +179,9 @@ async function loginScreen() {
|
|||||||
left: 0;
|
left: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
transform: translate(-50%, 50%);
|
transform: translate(-50%, 50%);
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@include filled-shadow(4);
|
@include filled-shadow(4);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,33 +1,29 @@
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
class="answer"
|
class="answer"
|
||||||
:style="{
|
|
||||||
transform: `translate(${-50}%, ${-50}%) rotate(${position.rotation}deg)`
|
|
||||||
}"
|
|
||||||
>
|
>
|
||||||
{{ props.answer }}
|
{{ props.answer }}
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive } from 'vue'
|
|
||||||
|
|
||||||
const props = defineProps(["answer"])
|
const props = defineProps(["answer"])
|
||||||
const position = reactive({
|
|
||||||
rotation: Math.random() * 20 - 10,
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.answer {
|
.answer {
|
||||||
position: fixed;
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
background: var(--clr-accent);
|
background: var(--clr-accent);
|
||||||
border-radius: 32px;
|
border-radius: 32px;
|
||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
padding: 32px;
|
padding: 32px;
|
||||||
border: 3px solid var(--clr-text);
|
|
||||||
top: 50%;
|
|
||||||
left: 50%;
|
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
|
border: 3px solid var(--clr-text);
|
||||||
|
@include filled-shadow(16);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
28
frontend/src/views/Screen/FunFact.vue
Normal file
28
frontend/src/views/Screen/FunFact.vue
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<template>
|
||||||
|
<div class="funFact">
|
||||||
|
{{ fact }}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
const facts = [
|
||||||
|
"Дима – главный источник мемов. Он скинул в конфу 2552 пикчи, это 47% от общего числа!",
|
||||||
|
"Всего в конфу было скинуто 5420 картинок!",
|
||||||
|
"Раньше флекспатруль носил название dayzspeak.ts3.pw",
|
||||||
|
"Конфе с мемами больше семи лет!"
|
||||||
|
]
|
||||||
|
|
||||||
|
const fact = facts[Math.floor(Math.random() * facts.length)];
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.funFact {
|
||||||
|
position: fixed;
|
||||||
|
padding: 32px;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
text-align: right;
|
||||||
|
width: 200px;
|
||||||
|
color: var(--clr-text-secondary);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -3,10 +3,22 @@
|
|||||||
v-if="card && !loading"
|
v-if="card && !loading"
|
||||||
class="bigScreen"
|
class="bigScreen"
|
||||||
>
|
>
|
||||||
<img
|
<div class="leftWrapper">
|
||||||
class="image"
|
<div class="left">
|
||||||
:src="card.image"
|
<Answer
|
||||||
>
|
v-if="correctAnswer"
|
||||||
|
:answer="correctAnswer"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<img
|
||||||
|
class="image"
|
||||||
|
:class="{
|
||||||
|
'-scoot': correctAnswer
|
||||||
|
}"
|
||||||
|
:src="card.image"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="answersState">
|
<div class="answersState">
|
||||||
<div class="users -unanwsered">
|
<div class="users -unanwsered">
|
||||||
@@ -26,7 +38,7 @@
|
|||||||
v-if="score[user.name]"
|
v-if="score[user.name]"
|
||||||
class="score"
|
class="score"
|
||||||
:class="{
|
:class="{
|
||||||
'-leader': leader === user.name
|
'-leader': score[user.name] === maxScore
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
{{ score[user.name] }}
|
{{ score[user.name] }}
|
||||||
@@ -56,7 +68,7 @@
|
|||||||
v-if="score[user.name]"
|
v-if="score[user.name]"
|
||||||
class="score"
|
class="score"
|
||||||
:class="{
|
:class="{
|
||||||
'-leader': leader === user.name
|
'-leader': score[user.name] === maxScore
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
{{ score[user.name] }}
|
{{ score[user.name] }}
|
||||||
@@ -65,11 +77,6 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Answer
|
|
||||||
v-if="correctAnswer"
|
|
||||||
:answer="correctAnswer"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<square-loader
|
<square-loader
|
||||||
@@ -77,6 +84,9 @@
|
|||||||
:color="'white'"
|
:color="'white'"
|
||||||
class="loader"
|
class="loader"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<Countdown v-if="correctAnswer" />
|
||||||
|
<!-- <FunFact /> -->
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
@@ -85,8 +95,10 @@ import { ref, onMounted, computed } from 'vue'
|
|||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import useServerEvents from '@/composables/useServerEvents'
|
import useServerEvents from '@/composables/useServerEvents'
|
||||||
import Answer from './Answer.vue'
|
import Answer from './Answer.vue'
|
||||||
|
// import FunFact from './FunFact.vue'
|
||||||
|
|
||||||
import SquareLoader from 'vue-spinner/src/SquareLoader.vue'
|
import SquareLoader from 'vue-spinner/src/SquareLoader.vue'
|
||||||
|
import Countdown from '@/components/Countdown.vue'
|
||||||
|
|
||||||
const { addAnswerListener, addUserlistListener, addRevealListener, addEndListener } = useServerEvents()
|
const { addAnswerListener, addUserlistListener, addRevealListener, addEndListener } = useServerEvents()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
@@ -122,10 +134,11 @@ const unansweredPlayers = computed(() => {
|
|||||||
return users.value.filter((user) => !user.selected)
|
return users.value.filter((user) => !user.selected)
|
||||||
})
|
})
|
||||||
|
|
||||||
const leader = computed(() => {
|
const maxScore = computed(() => {
|
||||||
return Object.keys(score.value).sort((a, b) => {
|
const leader = Object.keys(score.value).sort((a, b) => {
|
||||||
return score.value[b] - score.value[a]
|
return score.value[b] - score.value[a]
|
||||||
})[0]
|
})[0]
|
||||||
|
return score.value[leader]
|
||||||
})
|
})
|
||||||
|
|
||||||
addAnswerListener((data) => {
|
addAnswerListener((data) => {
|
||||||
@@ -192,22 +205,45 @@ onMounted(() => {
|
|||||||
color: var(--clr-text);
|
color: var(--clr-text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.leftWrapper {
|
||||||
|
position: relative;
|
||||||
|
height: 100%;
|
||||||
|
max-width: 60%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.left {
|
||||||
|
position: relative;
|
||||||
|
max-height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
.image {
|
.image {
|
||||||
display: block;
|
display: block;
|
||||||
max-width: 60%;
|
max-width: 100%;
|
||||||
max-height: 100%;
|
max-height: 100%;
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
margin-top: auto;
|
|
||||||
margin-bottom: auto;
|
|
||||||
background: var(--clr-text);
|
background: var(--clr-text);
|
||||||
border: 3px solid var(--clr-text);
|
border: 3px solid var(--clr-text);
|
||||||
@include filled-shadow(16);
|
@include filled-shadow(16);
|
||||||
border-radius: 64px;
|
border-radius: 64px;
|
||||||
animation-name: rock;
|
// animation-name: rock;
|
||||||
animation-duration: 5s;
|
// animation-duration: 5s;
|
||||||
animation-direction: alternate;
|
// animation-direction: alternate;
|
||||||
animation-iteration-count: infinite;
|
// animation-iteration-count: infinite;
|
||||||
animation-timing-function: ease-in-out;
|
// animation-timing-function: ease-in-out;
|
||||||
|
transition: transform 1s;
|
||||||
|
|
||||||
|
&.-scoot {
|
||||||
|
transform: translateY(150px);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes rock {
|
@keyframes rock {
|
||||||
@@ -236,6 +272,7 @@ onMounted(() => {
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
|
margin-bottom: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user.-correct {
|
.user.-correct {
|
||||||
|
|||||||
Reference in New Issue
Block a user