UNPKG

modaq

Version:

Quiz Bowl Reader using TypeScript, React, and MobX

241 lines 9.93 kB
"use strict"; 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; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.DialogState = void 0; const mobx_1 = require("mobx"); const mobx_sync_1 = require("mobx-sync"); const AddQuestionsDialogState_1 = require("./AddQuestionsDialogState"); const CustomizeGameFormatState_1 = require("./CustomizeGameFormatState"); require("./IGameFormat"); const IMessageDialogState_1 = require("./IMessageDialogState"); const RenamePlayerDialogState_1 = require("./RenamePlayerDialogState"); require("./TeamState"); const ReorderPlayersDialogState_1 = require("./ReorderPlayersDialogState"); const FontDialogState_1 = require("./FontDialogState"); const ModalVisibilityStatus_1 = require("./ModalVisibilityStatus"); const RenameTeamDialogState_1 = require("./RenameTeamDialogState"); const ImportFromQBJDialogState_1 = require("./ImportFromQBJDialogState"); class DialogState { constructor() { Object.defineProperty(this, "addQuestions", { enumerable: true, configurable: true, writable: true, value: void 0 }); Object.defineProperty(this, "customizeGameFormat", { enumerable: true, configurable: true, writable: true, value: void 0 }); Object.defineProperty(this, "fontDialog", { enumerable: true, configurable: true, writable: true, value: void 0 }); Object.defineProperty(this, "importFromQBJDialog", { enumerable: true, configurable: true, writable: true, value: void 0 }); Object.defineProperty(this, "messageDialog", { enumerable: true, configurable: true, writable: true, value: void 0 }); Object.defineProperty(this, "renamePlayerDialog", { enumerable: true, configurable: true, writable: true, value: void 0 }); Object.defineProperty(this, "renameTeamDialog", { enumerable: true, configurable: true, writable: true, value: void 0 }); Object.defineProperty(this, "reorderPlayersDialog", { enumerable: true, configurable: true, writable: true, value: void 0 }); Object.defineProperty(this, "visibleDialog", { enumerable: true, configurable: true, writable: true, value: void 0 }); mobx_1.makeAutoObservable(this); this.addQuestions = undefined; this.customizeGameFormat = undefined; this.fontDialog = undefined; this.importFromQBJDialog = undefined; this.messageDialog = undefined; this.renamePlayerDialog = undefined; this.renameTeamDialog = undefined; this.reorderPlayersDialog = undefined; this.visibleDialog = ModalVisibilityStatus_1.ModalVisibilityStatus.None; } hideAddQuestionsDialog() { this.addQuestions = undefined; if (this.visibleDialog === ModalVisibilityStatus_1.ModalVisibilityStatus.AddQuestions) { this.hideModalDialog(); } } hideCustomizeGameFormatDialog() { this.customizeGameFormat = undefined; if (this.visibleDialog === ModalVisibilityStatus_1.ModalVisibilityStatus.CustomizeGameFormat) { this.hideModalDialog(); } } hideModalDialog() { this.visibleDialog = ModalVisibilityStatus_1.ModalVisibilityStatus.None; } hideFontDialog() { this.fontDialog = undefined; if (this.visibleDialog === ModalVisibilityStatus_1.ModalVisibilityStatus.Font) { this.hideModalDialog(); } } hideImportFromQBJDialog() { this.importFromQBJDialog = undefined; if (this.visibleDialog === ModalVisibilityStatus_1.ModalVisibilityStatus.ImportFromQBJ) { this.hideModalDialog(); } } hideMessageDialog() { this.messageDialog = undefined; if (this.visibleDialog === ModalVisibilityStatus_1.ModalVisibilityStatus.Message) { this.hideModalDialog(); } } hideRenamePlayerDialog() { this.renamePlayerDialog = undefined; if (this.visibleDialog === ModalVisibilityStatus_1.ModalVisibilityStatus.RenamePlayer) { this.hideModalDialog(); } } hideRenameTeamDialog() { this.renameTeamDialog = undefined; if (this.visibleDialog === ModalVisibilityStatus_1.ModalVisibilityStatus.RenameTeam) { this.hideModalDialog(); } } hideReorderPlayersDialog() { this.reorderPlayersDialog = undefined; if (this.visibleDialog === ModalVisibilityStatus_1.ModalVisibilityStatus.ReorderPlayers) { this.hideModalDialog(); } } showAddQuestionsDialog() { this.addQuestions = new AddQuestionsDialogState_1.AddQuestionDialogState(); this.visibleDialog = ModalVisibilityStatus_1.ModalVisibilityStatus.AddQuestions; } showCustomizeGameFormatDialog(gameFormat) { this.customizeGameFormat = new CustomizeGameFormatState_1.CustomizeGameFormatState(gameFormat); this.visibleDialog = ModalVisibilityStatus_1.ModalVisibilityStatus.CustomizeGameFormat; } showExportToJsonDialog() { this.visibleDialog = ModalVisibilityStatus_1.ModalVisibilityStatus.ExportToJson; } showFontDialog(existingFontFamily, existingFontSize, existingTextColor, existingPronunciationGuideColor) { this.fontDialog = new FontDialogState_1.FontDialogState(existingFontFamily, existingFontSize, existingTextColor, existingPronunciationGuideColor); this.visibleDialog = ModalVisibilityStatus_1.ModalVisibilityStatus.Font; } showHelpDialog() { this.visibleDialog = ModalVisibilityStatus_1.ModalVisibilityStatus.Help; } showImportGameDialog() { this.visibleDialog = ModalVisibilityStatus_1.ModalVisibilityStatus.ImportGame; } showImportFromQBJDialog() { this.importFromQBJDialog = new ImportFromQBJDialogState_1.ImportFromQBJDialogState(); this.visibleDialog = ModalVisibilityStatus_1.ModalVisibilityStatus.ImportFromQBJ; } showRenamePlayerDialog(player) { this.renamePlayerDialog = new RenamePlayerDialogState_1.RenamePlayerDialogState(player); this.visibleDialog = ModalVisibilityStatus_1.ModalVisibilityStatus.RenamePlayer; } showRenameTeamDialog(initialTeamName) { this.renameTeamDialog = new RenameTeamDialogState_1.RenameTeamDialogState(initialTeamName); this.visibleDialog = ModalVisibilityStatus_1.ModalVisibilityStatus.RenameTeam; } showReorderPlayersDialog(players) { this.reorderPlayersDialog = new ReorderPlayersDialogState_1.ReorderPlayersDialogState(players); this.visibleDialog = ModalVisibilityStatus_1.ModalVisibilityStatus.ReorderPlayers; } showScoresheetDialog() { this.visibleDialog = ModalVisibilityStatus_1.ModalVisibilityStatus.Scoresheet; } showOKMessageDialog(title, message, onOK) { this.messageDialog = { title, message, type: IMessageDialogState_1.MessageDialogType.OK, onOK, }; this.visibleDialog = ModalVisibilityStatus_1.ModalVisibilityStatus.Message; } showOKCancelMessageDialog(title, message, onOK) { this.messageDialog = { title, message, type: IMessageDialogState_1.MessageDialogType.OKCancel, onOK, }; this.visibleDialog = ModalVisibilityStatus_1.ModalVisibilityStatus.Message; } showYesNoCancelMessageDialog(title, message, onYes, onNo) { this.messageDialog = { title, message, type: IMessageDialogState_1.MessageDialogType.YesNocCancel, onOK: onYes, onNo: onNo, }; this.visibleDialog = ModalVisibilityStatus_1.ModalVisibilityStatus.Message; } showNewGameDialog() { this.visibleDialog = ModalVisibilityStatus_1.ModalVisibilityStatus.NewGame; } } __decorate([ mobx_sync_1.ignore ], DialogState.prototype, "addQuestions", void 0); __decorate([ mobx_sync_1.ignore ], DialogState.prototype, "customizeGameFormat", void 0); __decorate([ mobx_sync_1.ignore ], DialogState.prototype, "fontDialog", void 0); __decorate([ mobx_sync_1.ignore ], DialogState.prototype, "importFromQBJDialog", void 0); __decorate([ mobx_sync_1.ignore ], DialogState.prototype, "messageDialog", void 0); __decorate([ mobx_sync_1.ignore ], DialogState.prototype, "renamePlayerDialog", void 0); __decorate([ mobx_sync_1.ignore ], DialogState.prototype, "renameTeamDialog", void 0); __decorate([ mobx_sync_1.ignore ], DialogState.prototype, "reorderPlayersDialog", void 0); __decorate([ mobx_sync_1.ignore ], DialogState.prototype, "visibleDialog", void 0); exports.DialogState = DialogState; //# sourceMappingURL=DialogState.js.map