Removing unused file.

logins
Thomas Hintz 5 years ago
parent de7cf70319
commit 75c49b272c

@ -1,94 +0,0 @@
// Copyright 2020 Thomas Hintz
//
// This file is part of the Alpha Centauri Farming project.
//
// The Alpha Centauri Farming project is free software: you can
// redistribute it and/or modify it under the terms of the GNU General
// Public License as published by the Free Software Foundation, either
// version 3 of the License, or (at your option) any later version.
//
// The Alpha Centauri Farming project 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 General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with the Alpha Centauri Farming project. If not, see
// <https://www.gnu.org/licenses/>.
import React, { Fragment } from 'react'
import { connect } from 'react-redux'
import { GroupBox, Row, Col } from '../widgets.jsx'
import { startOrJoinGame } from './actions.js'
const JoinGameScreens = { list: 'list', details: 'details' };
class JoinGameComp extends React.Component {
constructor(props) {
super(props);
this.state = {
screen: JoinGameScreens.list,
game: null
};
}
handleClickGame = game => {
this.setState({ screen: JoinGameScreens.details,
game: game
});
}
handleBack = e => {
this.setState({ screen: JoinGameScreens.list });
}
handleJoinAsExisting = e => {
this.props.startOrJoinGame({ type: 'join-as-existing',
playerName: e.target.text,
gameName: this.state.game.name });
}
render() {
return (
<GroupBox title='Join Game'>
<Row>
<Col width='12'>
{this.state.screen === JoinGameScreens.list ?
(<ul>
{this.props.games
.map((g, i) =>
(<li key={i}>
<a href='#' onClick={() => this.handleClickGame(g)}>{g.name}</a>
</li>))}
</ul>)
: (<Fragment>
<p><a href="#" onClick={this.handleBack}>back to games</a></p>
<h3><b>Game:</b> {this.state.game.name}</h3>
<h4>Join as existing player:</h4>
<ul>
{this.state.game.players.map((p, i) =>
(<li key={i}>
<a href='#' onClick={this.handleJoinAsExisting}>
{p}
</a>
</li>))}
</ul>
<NewGame colors={this.state.game.colors}
button={'Join'}
showGameName={false}
gameName={this.state.game.name}
type={'join-game'}
title={'Join as New Player'} />
</Fragment>)}
</Col>
</Row>
</GroupBox>
);
}
}
const JoinGame = connect(
null,
{ startOrJoinGame }
)(JoinGameComp)
Loading…
Cancel
Save