// ============================================================================== // Copyright (C) 2019 - Philip Paquette, Steven Bocco // // This program is free software: you can redistribute it and/or modify it under // the terms of the GNU Affero General Public License as published by the Free // Software Foundation, either version 3 of the License, or (at your option) any // later version. // // This program is distributed in the hope that it will be useful, but WITHOUT // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more // details. // // You should have received a copy of the GNU Affero General Public License along // with this program. If not, see . // ============================================================================== import React from "react"; import {FancyBox} from "../../components/fancyBox"; import PropTypes from "prop-types"; import {UTILS} from "../../../diplomacy/utils/utils"; import {ArrowLeftIcon} from "@primer/octicons-react"; const DEADLINES = [ [0, '(no deadline)'], [60, '1 min'], [60 * 5, '5 min'], [60 * 30, '30 min'], [60 * 60 * 2, '2 hrs'], [60 * 60 * 24, '24 hrs'], ]; export class PanelChooseSettings extends React.Component { constructor(props) { super(props); this.onCheckNoPress = this.onCheckNoPress.bind(this); this.onSelectDeadline = this.onSelectDeadline.bind(this); this.onSetRegistrationPassword = this.onSetRegistrationPassword.bind(this); this.onSetGameID = this.onSetGameID.bind(this); } onCheckNoPress(event) { this.props.onUpdateParams({no_press: event.target.checked}); } onSelectDeadline(event) { this.props.onUpdateParams({deadline: parseInt(event.target.value)}); } onSetRegistrationPassword(event) { this.props.onUpdateParams({registration_password: event.target.value}); } onSetGameID(event) { let gameID = event.target.value; if (!gameID) gameID = UTILS.createGameID(this.props.username); this.props.onUpdateParams({game_id: gameID}); } render() { return (
); } } PanelChooseSettings.propTypes = { backward: PropTypes.func.isRequired, forward: PropTypes.func.isRequired, cancel: PropTypes.func.isRequired, params: PropTypes.object.isRequired, onUpdateParams: PropTypes.func.isRequired, username: PropTypes.string.isRequired };