modaq
Version:
Quiz Bowl Reader using TypeScript, React, and MobX
23 lines • 884 B
JavaScript
;
// For now this just uses a message dialog, but we want the logic someplace where we can test it
Object.defineProperty(exports, "__esModule", { value: true });
exports.submit = void 0;
require("../../state/TeamState");
const AppState_1 = require("../../state/AppState");
function submit() {
const appState = AppState_1.AppState.instance;
const players = [...appState.game.players];
if (players.length < 2) {
return;
}
const firstPlayer = players[0];
const otherPlayerIndex = players.findIndex((player) => player.teamName !== firstPlayer.teamName);
if (otherPlayerIndex === -1) {
return;
}
players[0] = players[otherPlayerIndex];
players[otherPlayerIndex] = firstPlayer;
appState.game.setPlayers(players);
}
exports.submit = submit;
//# sourceMappingURL=ReorderTeamsDialogController.js.map