feat : guess word

This commit is contained in:
2024-12-30 20:15:02 +01:00
parent 08daf733d1
commit 9eaf7009c6
12 changed files with 304 additions and 54 deletions
+5 -1
View File
@@ -7,8 +7,12 @@ const userStore = useUserStore();
const lobbyStore = useLobbyStore();
const currentGames = computed(() => {
const self = userStore.self;
if (!self) {
return [];
}
const games = Object.values(lobbyStore.games).filter((g) =>
g.players.some((p) => p.user.id == userStore.self?.id)
g.players.some((p) => p.userId == self.id)
);
return games;
});
+6 -1
View File
@@ -17,7 +17,12 @@ const game = lobbyStore.games[props.id];
<template>
{{ game.id }}
{{ game.players.map((p) => p.user.username) }}
<User
v-for="player in game.players"
:key="player.id"
:id="player.userId"
></User>
{{ game.started }}
{{ game }}
<NuxtLink :to="'/game/' + id"
+9 -2
View File
@@ -14,6 +14,8 @@ const userStore = useUserStore();
const word = wordStore.words[props.id];
const disabled = computed(() => word.loading || !userStore.self);
async function changeWordState() {
if (word.loading) {
return;
@@ -38,6 +40,11 @@ async function deleteWord() {
word.loading = false;
}
}
onMounted(() => {
setInterval(() => {
console.log(disabled.value);
}, 1000);
});
</script>
<template>
@@ -46,11 +53,11 @@ async function deleteWord() {
<input
type="checkbox"
:checked="word.enabled"
:disabled="word.loading || !userStore.self"
:disabled="disabled"
@click.prevent="changeWordState"
/>
<input
:disabled="word.loading || !userStore.self"
:disabled="disabled"
type="button"
@click="deleteWord"
value="Delete"