@@ -61,9 +61,9 @@ export const useGameStore = defineStore("game", {
6161 initialized : false ,
6262 config : { } , // populated from /api/v1/state on connect
6363 game_state : "uninitialized" ,
64- teams : [ ] ,
65- categories : [ ] ,
66- questions : { } ,
64+ teams : [ ] , // [{tid, name, score}]
65+ categories : [ ] , // ['Cat1', ...]
66+ questions : { } , // { c1q1: { answered: bool, team_scores: {team1: 100} } }
6767 ui_state : {
6868 question : "" ,
6969 team : "" ,
@@ -78,7 +78,8 @@ export const useGameStore = defineStore("game", {
7878 active_question : { } ,
7979 messages : [ ] ,
8080 dailydouble_range : { min : 0 , max : 0 } ,
81- // null outside DD or before the operator has nudged the wager slider.
81+ // {team, amount} as the host moves the wager slider during a DD; null
82+ // outside DD or before the operator has set anything.
8283 dailydouble_wager : null ,
8384 dailydoubleTrigger : 0 ,
8485 socket : null ,
@@ -88,6 +89,12 @@ export const useGameStore = defineStore("game", {
8889 } ) ,
8990
9091 getters : {
92+ // Config getters with sane defaults so components can use them without
93+ // having to guard against the brief window between mount and the first
94+ // /api/v1/state response.
95+ questionsPerCategory : ( s ) : number => s . config . QUESTIONS_PER_CATEGORY ?? 5 ,
96+ scoreTick : ( s ) : number => s . config . SCORE_TICK ?? 100 ,
97+
9198 isInProgress : ( s ) : boolean =>
9299 s . game_state === "in_round" || s . game_state === "in_final" ,
93100 isFinished : ( s ) : boolean => s . game_state === "finished" ,
0 commit comments