modaq
Version:
Quiz Bowl Reader using TypeScript, React, and MobX
816 lines • 33.2 kB
JavaScript
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.UIState = void 0;
const react_1 = require("@fluentui/react");
const mobx_1 = require("mobx");
const mobx_sync_1 = require("mobx-sync");
const GameFormats = __importStar(require("./GameFormats"));
require("./Events");
const IPendingNewGame_1 = require("./IPendingNewGame");
const PacketState_1 = require("./PacketState");
const TeamState_1 = require("./TeamState");
const SheetState_1 = require("./SheetState");
require("../IStatus");
require("./IPendingSheet");
require("./Cycle");
const DialogState_1 = require("./DialogState");
require("./IGameFormat");
require("./BuzzMenuState");
require("./CustomExport");
const ModalVisibilityStatus_1 = require("./ModalVisibilityStatus");
require("./IPacketParseStatus");
// TODO: Look into breaking this up into individual UI component states. Lots of pendingX fields, which could be in
// their own (see CustomizeGameFormatDialogState)
// Alternatively, keep certain component-local states in the component state, and only store values that could be used
// outside of that component here.
const DefaultFontFamily = "Segoe UI, Times New Roman, -apple-system, BlinkMacSystemFont, Roboto, Helvetica Neue, serif";
class UIState {
constructor() {
Object.defineProperty(this, "buildVersion", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
// TODO: Should we also include the Cycle? This would simplify anything that needs access to the cycle
Object.defineProperty(this, "cycleIndex", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "dialogState", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "fontFamily", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "isEditingCycleIndex", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "selectedWordIndex", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "buzzMenuState", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "customExportOptions", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "customExportIntervalId", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "customExportStatus", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "exportRoundNumber", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
// Default should be to always show bonuses. This setting didn't exist before, so use hide instead of show
Object.defineProperty(this, "hideBonusOnDeadTossup", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "hideNewGame", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "importGameStatus", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "packetFilename", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "packetParseStatus", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "pendingBonusProtestEvent", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "pendingNewGame", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "pendingNewPlayer", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "pendingSheet", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "pendingTossupProtestEvent", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
// Default should be to show the clock. This setting didn't exist before, so use hide instead of show
Object.defineProperty(this, "isClockHidden", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
// Default should be to show the event log. This setting didn't exist before, so use hide instead of show
Object.defineProperty(this, "isEventLogHidden", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
// Default should be to show the export status. This setting didn't exist before, so use hide instead of show
Object.defineProperty(this, "isCustomExportStatusHidden", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
// Default should be to show the packet name. This setting didn't exist before, so use hide instead of show
Object.defineProperty(this, "isPacketNameHidden", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
// Default should be to have it horizontal.
Object.defineProperty(this, "isScoreVertical", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
// Default should be to highlight answered bonuses
Object.defineProperty(this, "noBonusHighlight", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "pronunciationGuideColor", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "questionFontColor", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "questionFontSize", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "sheetsState", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "useDarkMode", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "yappServiceUrl", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
mobx_1.makeAutoObservable(this);
this.buildVersion = undefined;
this.cycleIndex = 0;
this.dialogState = new DialogState_1.DialogState();
this.isEditingCycleIndex = false;
this.selectedWordIndex = -1;
this.buzzMenuState = {
clearSelectedWordOnClose: true,
visible: false,
};
this.customExportOptions = undefined;
this.customExportIntervalId = undefined;
this.customExportStatus = undefined;
this.exportRoundNumber = 1;
this.hideBonusOnDeadTossup = false;
this.hideNewGame = false;
// Default to Fabric UI's default font (Segoe UI), then Times New Roman
this.fontFamily = DefaultFontFamily;
this.isClockHidden = false;
this.isEventLogHidden = false;
this.isPacketNameHidden = false;
this.isCustomExportStatusHidden = false;
this.isScoreVertical = false;
this.importGameStatus = undefined;
this.noBonusHighlight = false;
this.packetFilename = undefined;
this.packetParseStatus = undefined;
this.pendingBonusProtestEvent = undefined;
this.pendingNewGame = undefined;
this.pendingNewPlayer = undefined;
this.pendingSheet = undefined;
this.pendingTossupProtestEvent = undefined;
this.useDarkMode = false;
this.yappServiceUrl = undefined;
// These are defined by the theme if not set explicitly
this.pronunciationGuideColor = undefined;
this.questionFontColor = undefined;
// The default font size is 16px
this.questionFontSize = 16;
this.sheetsState = new SheetState_1.SheetState();
}
// TODO: Feels off. Could generalize to array of teams
addPlayerToFirstTeamInPendingNewGame(player) {
var _a;
if (((_a = this.pendingNewGame) === null || _a === void 0 ? void 0 : _a.type) === IPendingNewGame_1.PendingGameType.Manual) {
this.pendingNewGame.manual.firstTeamPlayers.push(player);
}
}
addPlayerToSecondTeamInPendingNewGame(player) {
var _a;
if (((_a = this.pendingNewGame) === null || _a === void 0 ? void 0 : _a.type) === IPendingNewGame_1.PendingGameType.Manual) {
this.pendingNewGame.manual.secondTeamPlayers.push(player);
}
}
clearPacketStatus() {
this.packetParseStatus = undefined;
}
clearPendingNewGameRegistrationStatus() {
var _a;
if (((_a = this.pendingNewGame) === null || _a === void 0 ? void 0 : _a.type) !== IPendingNewGame_1.PendingGameType.QBJRegistration) {
return;
}
this.pendingNewGame.registration.errorMessage = undefined;
}
createPendingNewGame() {
if (this.pendingNewGame == undefined) {
const firstTeamPlayers = [];
const secondTeamPlayers = [];
for (let i = 0; i < 4; i++) {
firstTeamPlayers.push(new TeamState_1.Player("", "Team 1", /* isStarter */ true));
secondTeamPlayers.push(new TeamState_1.Player("", "Team 2", /* isStarter */ true));
}
this.pendingNewGame = {
packet: new PacketState_1.PacketState(),
type: IPendingNewGame_1.PendingGameType.Manual,
gameFormat: GameFormats.StandardPowersMACFGameFormat,
manual: {
firstTeamPlayers,
secondTeamPlayers,
},
};
}
else {
this.pendingNewGame = Object.assign(Object.assign({}, this.pendingNewGame), { packet: new PacketState_1.PacketState() });
switch (this.pendingNewGame.type) {
case IPendingNewGame_1.PendingGameType.Manual:
this.pendingNewGame = Object.assign(Object.assign({}, this.pendingNewGame), { manual: Object.assign(Object.assign({}, this.pendingNewGame.manual), { cycles: undefined }) });
break;
case IPendingNewGame_1.PendingGameType.QBJRegistration:
this.pendingNewGame = Object.assign(Object.assign({}, this.pendingNewGame), { registration: Object.assign(Object.assign({}, this.pendingNewGame.registration), { cycles: undefined }) });
break;
case IPendingNewGame_1.PendingGameType.TJSheets:
this.pendingNewGame = Object.assign(Object.assign({}, this.pendingNewGame), { tjSheets: Object.assign({}, this.pendingNewGame.tjSheets) });
break;
case IPendingNewGame_1.PendingGameType.UCSDSheets:
this.pendingNewGame = Object.assign(Object.assign({}, this.pendingNewGame), { ucsdSheets: Object.assign({}, this.pendingNewGame.ucsdSheets) });
break;
default:
react_1.assertNever(this.pendingNewGame);
}
}
}
createPendingNewPlayer(teamName) {
this.pendingNewPlayer = new TeamState_1.Player("", teamName, /* isStarter */ false);
this.dialogState.visibleDialog = ModalVisibilityStatus_1.ModalVisibilityStatus.AddPlayer;
}
createPendingSheet() {
var _a, _b;
this.pendingSheet = {
roundNumber: (_a = this.sheetsState.roundNumber) !== null && _a !== void 0 ? _a : 1,
sheetId: (_b = this.sheetsState.sheetId) !== null && _b !== void 0 ? _b : "",
};
this.dialogState.visibleDialog = ModalVisibilityStatus_1.ModalVisibilityStatus.ExportToSheets;
}
removePlayerToFirstTeamInPendingNewGame(player) {
var _a;
if (((_a = this.pendingNewGame) === null || _a === void 0 ? void 0 : _a.type) === IPendingNewGame_1.PendingGameType.Manual) {
this.pendingNewGame.manual.firstTeamPlayers = this.pendingNewGame.manual.firstTeamPlayers.filter((p) => p !== player);
}
}
removePlayerToSecondTeamInPendingNewGame(player) {
var _a;
if (((_a = this.pendingNewGame) === null || _a === void 0 ? void 0 : _a.type) === IPendingNewGame_1.PendingGameType.Manual) {
this.pendingNewGame.manual.secondTeamPlayers = this.pendingNewGame.manual.secondTeamPlayers.filter((p) => p !== player);
}
}
setFontFamily(listedFont) {
// It's possible the listed font has default fonts listed too. Cut them out so that we don't keep compounding
// the default fonts on top.
const commaIndex = listedFont.indexOf(",");
if (commaIndex >= 0) {
listedFont = listedFont.substring(0, commaIndex);
}
this.fontFamily = listedFont + ", " + DefaultFontFamily;
}
setPendingNewGameType(type) {
if (this.pendingNewGame != undefined) {
this.pendingNewGame.type = type;
if (this.pendingNewGame.type === IPendingNewGame_1.PendingGameType.QBJRegistration &&
this.pendingNewGame.registration == undefined) {
this.pendingNewGame.registration = {
firstTeamPlayers: undefined,
players: [],
secondTeamPlayers: undefined,
};
}
else if (this.pendingNewGame.type === IPendingNewGame_1.PendingGameType.TJSheets &&
this.pendingNewGame.tjSheets == undefined) {
this.pendingNewGame.tjSheets = {
firstTeamPlayersFromRosters: undefined,
playersFromRosters: undefined,
rostersUrl: undefined,
secondTeamPlayersFromRosters: undefined,
};
}
else if (this.pendingNewGame.type === IPendingNewGame_1.PendingGameType.UCSDSheets &&
this.pendingNewGame.ucsdSheets == undefined) {
this.pendingNewGame.ucsdSheets = {
firstTeamPlayersFromRosters: undefined,
playersFromRosters: undefined,
rostersUrl: undefined,
secondTeamPlayersFromRosters: undefined,
};
}
}
}
setPendingNewGameCycles(cycles) {
if (this.pendingNewGame == undefined) {
return;
}
if (this.pendingNewGame.type === IPendingNewGame_1.PendingGameType.Manual) {
this.pendingNewGame.manual.cycles = cycles;
}
else if (this.pendingNewGame.type === IPendingNewGame_1.PendingGameType.QBJRegistration) {
this.pendingNewGame.registration.cycles = cycles;
}
}
setPendingNewGameFormat(gameFormat) {
if (this.pendingNewGame == undefined) {
return;
}
this.pendingNewGame.gameFormat = gameFormat;
}
setPendingNewGameRegistrationErrorMessage(message) {
var _a;
if (((_a = this.pendingNewGame) === null || _a === void 0 ? void 0 : _a.type) !== IPendingNewGame_1.PendingGameType.QBJRegistration) {
return;
}
this.pendingNewGame.registration.errorMessage = message;
}
setPendingNewGameRosters(players) {
var _a, _b, _c;
if (((_a = this.pendingNewGame) === null || _a === void 0 ? void 0 : _a.type) == undefined) {
return;
}
if (this.pendingNewGame.type === IPendingNewGame_1.PendingGameType.QBJRegistration) {
const registration = this.pendingNewGame.registration;
registration.players = players;
registration.firstTeamPlayers = [];
registration.secondTeamPlayers = [];
if (players.length < 2) {
return;
}
const firstTeam = players[0].teamName;
const secondTeam = (_c = (_b = players.find((player) => player.teamName !== firstTeam)) === null || _b === void 0 ? void 0 : _b.teamName) !== null && _c !== void 0 ? _c : firstTeam;
if (firstTeam === secondTeam) {
// Handle the unapproved case of one team only gracefully by having both teams refer to the same one
registration.firstTeamPlayers = players;
registration.secondTeamPlayers = players;
return;
}
for (const player of players) {
if (player.teamName === firstTeam) {
registration.firstTeamPlayers.push(player);
}
else if (player.teamName === secondTeam) {
registration.secondTeamPlayers.push(player);
}
}
return;
}
if (this.pendingNewGame.type !== IPendingNewGame_1.PendingGameType.Manual) {
const sheetsState = this.pendingNewGame.type === IPendingNewGame_1.PendingGameType.TJSheets
? this.pendingNewGame.tjSheets
: this.pendingNewGame.ucsdSheets;
sheetsState.playersFromRosters = players;
sheetsState.firstTeamPlayersFromRosters = [];
sheetsState.secondTeamPlayersFromRosters = [];
}
}
setPendingNewGameRostersUrl(url) {
var _a;
if (((_a = this.pendingNewGame) === null || _a === void 0 ? void 0 : _a.type) == undefined) {
return;
}
if (this.pendingNewGame.type === IPendingNewGame_1.PendingGameType.TJSheets) {
this.pendingNewGame.tjSheets.rostersUrl = url;
}
else if (this.pendingNewGame.type === IPendingNewGame_1.PendingGameType.UCSDSheets) {
this.pendingNewGame.ucsdSheets.rostersUrl = url;
}
}
setPendingNewGameFirstTeamPlayers(players) {
var _a;
if (((_a = this.pendingNewGame) === null || _a === void 0 ? void 0 : _a.type) == undefined) {
return;
}
switch (this.pendingNewGame.type) {
case IPendingNewGame_1.PendingGameType.TJSheets:
this.pendingNewGame.tjSheets.firstTeamPlayersFromRosters = players;
break;
case IPendingNewGame_1.PendingGameType.UCSDSheets:
this.pendingNewGame.ucsdSheets.firstTeamPlayersFromRosters = players;
break;
case IPendingNewGame_1.PendingGameType.Manual:
this.pendingNewGame.manual.firstTeamPlayers = players;
break;
case IPendingNewGame_1.PendingGameType.QBJRegistration:
this.pendingNewGame.registration.firstTeamPlayers = players;
break;
default:
react_1.assertNever(this.pendingNewGame);
}
}
setPendingNewGameSecondTeamPlayers(players) {
var _a;
if (((_a = this.pendingNewGame) === null || _a === void 0 ? void 0 : _a.type) == undefined) {
return;
}
switch (this.pendingNewGame.type) {
case IPendingNewGame_1.PendingGameType.TJSheets:
this.pendingNewGame.tjSheets.secondTeamPlayersFromRosters = players;
break;
case IPendingNewGame_1.PendingGameType.UCSDSheets:
this.pendingNewGame.ucsdSheets.secondTeamPlayersFromRosters = players;
break;
case IPendingNewGame_1.PendingGameType.Manual:
this.pendingNewGame.manual.secondTeamPlayers = players;
break;
case IPendingNewGame_1.PendingGameType.QBJRegistration:
this.pendingNewGame.registration.secondTeamPlayers = players;
break;
default:
react_1.assertNever(this.pendingNewGame);
}
}
nextCycle() {
this.setCycleIndex(this.cycleIndex + 1);
}
previousCycle() {
if (this.cycleIndex > 0) {
this.setCycleIndex(this.cycleIndex - 1);
}
}
setCycleIndex(newIndex) {
if (newIndex >= 0) {
this.cycleIndex = newIndex;
// Clear the selected words, since it's not relevant to the next question
this.selectedWordIndex = -1;
}
}
setBuildVersion(version) {
this.buildVersion = version;
}
setCustomExport(customExport) {
this.customExportOptions = customExport;
}
setCustomExportIntervalId(intervalId) {
this.customExportIntervalId = intervalId;
}
setCustomExportStatus(status) {
this.customExportStatus = status;
}
setExportRoundNumber(newRoundNumber) {
this.exportRoundNumber = newRoundNumber;
}
setHideNewGame(value) {
this.hideNewGame = value;
}
setImportGameStatus(status) {
this.importGameStatus = status;
}
setIsEditingCycleIndex(isEditingCycleIndex) {
this.isEditingCycleIndex = isEditingCycleIndex;
}
setPacketFilename(name) {
this.packetFilename = name;
}
setPacketStatus(packetStatus, warnings) {
this.packetParseStatus = {
status: packetStatus,
warnings: warnings !== null && warnings !== void 0 ? warnings : [],
};
}
setPendingBonusProtest(teamName, questionIndex, part) {
this.pendingBonusProtestEvent = {
partIndex: part,
questionIndex,
givenAnswer: "",
reason: "",
teamName,
};
this.dialogState.visibleDialog = ModalVisibilityStatus_1.ModalVisibilityStatus.BonusProtest;
}
setPendingTossupProtest(teamName, questionIndex, position) {
this.pendingTossupProtestEvent = {
position,
questionIndex,
givenAnswer: "",
reason: "",
teamName,
};
this.dialogState.visibleDialog = ModalVisibilityStatus_1.ModalVisibilityStatus.TossupProtest;
}
setPronunciationGuideColor(color) {
this.pronunciationGuideColor = color;
}
setQuestionFontColor(color) {
this.questionFontColor = color;
}
setQuestionFontSize(size) {
this.questionFontSize = size;
}
setSelectedWordIndex(newIndex) {
this.selectedWordIndex = newIndex;
}
setYappServiceUrl(url) {
this.yappServiceUrl = url;
}
toggleBonusHighlight() {
this.noBonusHighlight = !this.noBonusHighlight;
}
toggleClockVisibility() {
this.isClockHidden = !this.isClockHidden;
}
toggleCustomExportStatusVisibility() {
this.isCustomExportStatusHidden = !this.isCustomExportStatusHidden;
}
toggleDarkMode() {
this.useDarkMode = !this.useDarkMode;
}
toggleEventLogVisibility() {
this.isEventLogHidden = !this.isEventLogHidden;
}
toggleHideBonusOnDeadTossup() {
this.hideBonusOnDeadTossup = !this.hideBonusOnDeadTossup;
}
togglePacketNameVisibility() {
this.isPacketNameHidden = !this.isPacketNameHidden;
}
toggleScoreVerticality() {
this.isScoreVertical = !this.isScoreVertical;
}
hideBuzzMenu() {
this.buzzMenuState.visible = false;
}
resetCustomExport() {
this.customExportOptions = undefined;
}
resetFontFamily() {
this.fontFamily = DefaultFontFamily;
}
resetPacketFilename() {
this.packetFilename = undefined;
}
resetPendingBonusProtest() {
this.pendingBonusProtestEvent = undefined;
this.dialogState.visibleDialog = ModalVisibilityStatus_1.ModalVisibilityStatus.None;
}
resetPendingNewGame() {
this.packetParseStatus = undefined;
this.importGameStatus = undefined;
if (this.pendingNewGame != undefined) {
// Clear everything but the game format and info derived from the roster URL
this.pendingNewGame.packet = new PacketState_1.PacketState();
switch (this.pendingNewGame.type) {
case IPendingNewGame_1.PendingGameType.Manual:
this.pendingNewGame.manual.cycles = undefined;
break;
case IPendingNewGame_1.PendingGameType.QBJRegistration:
this.pendingNewGame.registration.cycles = undefined;
this.clearPendingNewGameRegistrationStatus();
break;
case undefined:
case IPendingNewGame_1.PendingGameType.TJSheets:
case IPendingNewGame_1.PendingGameType.UCSDSheets:
// Don't clear the sheets URL or the players
break;
default:
react_1.assertNever(this.pendingNewGame);
}
}
}
resetPendingNewPlayer() {
this.pendingNewPlayer = undefined;
this.dialogState.visibleDialog = ModalVisibilityStatus_1.ModalVisibilityStatus.None;
}
resetPendingSheet() {
this.pendingSheet = undefined;
this.dialogState.visibleDialog = ModalVisibilityStatus_1.ModalVisibilityStatus.None;
}
resetPendingTossupProtest() {
this.pendingTossupProtestEvent = undefined;
this.dialogState.visibleDialog = ModalVisibilityStatus_1.ModalVisibilityStatus.None;
}
resetSheetsId() {
this.sheetsState.sheetId = undefined;
this.sheetsState.sheetType = undefined;
}
showBuzzMenu(clearSelectedWordOnClose) {
this.buzzMenuState.visible = true;
this.buzzMenuState.clearSelectedWordOnClose = clearSelectedWordOnClose;
}
// We have to do this call here because this is where the information is available
showFontDialog() {
this.dialogState.showFontDialog(this.fontFamily, this.questionFontSize, this.questionFontColor, this.pronunciationGuideColor);
}
updatePendingProtestGivenAnswer(givenAnswer) {
if (this.pendingBonusProtestEvent != undefined) {
this.pendingBonusProtestEvent.givenAnswer = givenAnswer;
}
else if (this.pendingTossupProtestEvent != undefined) {
this.pendingTossupProtestEvent.givenAnswer = givenAnswer;
}
}
updatePendingProtestReason(reason) {
if (this.pendingBonusProtestEvent != undefined) {
this.pendingBonusProtestEvent.reason = reason;
}
else if (this.pendingTossupProtestEvent != undefined) {
this.pendingTossupProtestEvent.reason = reason;
}
}
updatePendingBonusProtestPart(part) {
if (this.pendingBonusProtestEvent != undefined) {
const partIndex = typeof part === "string" ? parseInt(part, 10) : part;
this.pendingBonusProtestEvent.partIndex = partIndex;
}
}
updatePendingNewPlayerName(name) {
if (this.pendingNewPlayer == undefined) {
return;
}
this.pendingNewPlayer.name = name;
}
updatePendingNewPlayerTeamName(teamName) {
if (this.pendingNewPlayer == undefined) {
return;
}
this.pendingNewPlayer.teamName = teamName;
}
updatePendingSheetRoundNumber(roundNumber) {
if (this.pendingSheet == undefined) {
return;
}
this.pendingSheet.roundNumber = roundNumber;
}
updatePendingSheetId(sheetId) {
if (this.pendingSheet == undefined) {
return;
}
this.pendingSheet.sheetId = sheetId;
}
}
__decorate([
mobx_sync_1.ignore
], UIState.prototype, "buildVersion", void 0);
__decorate([
mobx_sync_1.ignore
], UIState.prototype, "dialogState", void 0);
__decorate([
mobx_sync_1.ignore
], UIState.prototype, "isEditingCycleIndex", void 0);
__decorate([
mobx_sync_1.ignore
], UIState.prototype, "selectedWordIndex", void 0);
__decorate([
mobx_sync_1.ignore
], UIState.prototype, "buzzMenuState", void 0);
__decorate([
mobx_sync_1.ignore
], UIState.prototype, "customExportOptions", void 0);
__decorate([
mobx_sync_1.ignore
], UIState.prototype, "customExportIntervalId", void 0);
__decorate([
mobx_sync_1.ignore
], UIState.prototype, "customExportStatus", void 0);
__decorate([
mobx_sync_1.ignore
], UIState.prototype, "exportRoundNumber", void 0);
__decorate([
mobx_sync_1.ignore
], UIState.prototype, "hideNewGame", void 0);
__decorate([
mobx_sync_1.ignore
], UIState.prototype, "importGameStatus", void 0);
__decorate([
mobx_sync_1.ignore
], UIState.prototype, "packetParseStatus", void 0);
__decorate([
mobx_sync_1.ignore
], UIState.prototype, "pendingBonusProtestEvent", void 0);
__decorate([
mobx_sync_1.ignore
], UIState.prototype, "pendingNewGame", void 0);
__decorate([
mobx_sync_1.ignore
], UIState.prototype, "pendingNewPlayer", void 0);
__decorate([
mobx_sync_1.ignore
], UIState.prototype, "pendingSheet", void 0);
__decorate([
mobx_sync_1.ignore
], UIState.prototype, "pendingTossupProtestEvent", void 0);
exports.UIState = UIState;
//# sourceMappingURL=UIState.js.map