diff --git a/site/src/App.vue b/site/src/App.vue index 8424cb6..2ca525f 100644 --- a/site/src/App.vue +++ b/site/src/App.vue @@ -7,7 +7,7 @@ - + diff --git a/site/src/components/GameStatus.vue b/site/src/components/GameStatus.vue index 090ccb8..918fe55 100644 --- a/site/src/components/GameStatus.vue +++ b/site/src/components/GameStatus.vue @@ -16,27 +16,23 @@ import { computed, ref, watch } from 'vue'; import type { Game } from '@/lib/game'; export interface Props { - game: Game | undefined; + game: Game; } const props = defineProps(); // TODO(zeph): simplify this condition, this should just come in the game state -const gameOn = computed(() => (props?.game?.round ?? 0 < 3) || (props?.game?.players?.every((p) => p.hp > 0))) +const gameOn = computed(() => props.game.round < 3 || props.game.players.every((p) => p.hp > 0)) const roundChips = computed(() => [ - { text: "I", variant: props?.game?.round === 1 ? 'elevated' : undefined }, - { text: "II", variant: props?.game?.round === 2 ? 'elevated' : undefined }, - { text: "III", variant: props?.game?.round === 3 ? 'elevated' : undefined }, + { text: "I", variant: props.game.round === 1 ? 'elevated' : undefined }, + { text: "II", variant: props.game.round === 2 ? 'elevated' : undefined }, + { text: "III", variant: props.game.round === 3 ? 'elevated' : undefined }, ] as const) // TODO(zeph): this probably should just be handled by the server and sent in the dto -const game = computed(() => props.game); const msg = ref(''); -watch(game, (now, was) => { - if (now == null) { - return; - } +watch(props.game, (now, was) => { if (now.live != null && was?.live == null) { msg.value = `THE SHOTGUN CONTAINS ${now.live} LIVE AND ${now.blank} BLANK SHELLS`; } else if (was == null) {