diff --git a/client/src/components/Playground.vue b/client/src/components/Playground.vue index 7638b4d..b0d1f43 100644 --- a/client/src/components/Playground.vue +++ b/client/src/components/Playground.vue @@ -2,9 +2,9 @@
- + :disabled="disabledMap[source.id]" :index="index" />
@@ -36,7 +36,8 @@ const sources = round.sources as Sources const { saveSelection } = useEngine() const selection = ref('') -const selectable = computed(() => game.phase === 'select-quote' && !selection.value && !round.selections[useUserinfoStore().id]) +const { id } = useUserinfoStore() +const selectable = computed(() => game.phase === 'select-quote' && !selection.value && !round.selections[id]) const selectSource = async (source: Source): Promise => { if (selectable.value) { await saveSelection(source.id) @@ -50,7 +51,7 @@ const showSources = computed(() => ['select-quote', 'reveal-show-count', 'reveal const showQuote = showSources const showSkipButton = computed(() => game.phase === 'select-quote') const badgeMap = computed(() => { - const badgeMap = {} + const badgeMap = {} as { [key: string]: number} if (game.phase === 'reveal-show-count') { for (const id in round.revelation.votes) { badgeMap[id] = round.revelation.votes[id].length @@ -60,7 +61,7 @@ const badgeMap = computed(() => { }) const disabledMap = computed(() => { - const disabledMap = {} + const disabledMap = {} as { [key: string]: boolean} if (game.phase === 'reveal-source') { for (const id in round.revelation.sources) { disabledMap[id] = !round.revelation.sources[id] diff --git a/client/src/components/SourceCard.vue b/client/src/components/SourceCard.vue index 8dbac07..f1c522c 100644 --- a/client/src/components/SourceCard.vue +++ b/client/src/components/SourceCard.vue @@ -15,6 +15,7 @@ import type { Source } from '@/composables/engine.d' const props = defineProps<{ source: Source, + index: number, selectable?: boolean, selected?: boolean, badge?: number, diff --git a/client/src/composables/engine.d.ts b/client/src/composables/engine.d.ts index 52bd7bb..81db37c 100644 --- a/client/src/composables/engine.d.ts +++ b/client/src/composables/engine.d.ts @@ -35,12 +35,10 @@ export type Source = { export type Sources = Array -export type Selection = { - id: string +export type Selections = { + [key: string]: boolean } -export type Selections = Array - export type RevelationVotes = { [key: string]: Array } diff --git a/client/src/stores/RoundStore.ts b/client/src/stores/RoundStore.ts index 4da06e8..7052588 100644 --- a/client/src/stores/RoundStore.ts +++ b/client/src/stores/RoundStore.ts @@ -7,7 +7,7 @@ export const useRoundStore = defineStore('RoundStore', { round: { quote: '', sources: [] as Sources, - selections: [] as Selections, + selections: {} as Selections, revelation: { votes: {} as RevelationVotes, sources: {} as RevelationSources, @@ -20,7 +20,7 @@ export const useRoundStore = defineStore('RoundStore', { round = round || {} as Round this.round.quote = round.quote || '' this.round.sources = round.sources || [] as Sources - this.round.selections = round.selections || [] as Selections + this.round.selections = round.selections || {} as Selections this.round.revelation.votes = round.revelation?.votes || {} as RevelationVotes this.round.revelation.sources = round.revelation?.sources || {} as RevelationSources },