|
|
|
@ -28,67 +28,62 @@ import Welcome from '../welcome/Welcome.jsx'
|
|
|
|
|
import Tractor from '../tractor/Tractor.jsx'
|
|
|
|
|
|
|
|
|
|
import { SCREENS, messagePanelId } from '../../constants.js'
|
|
|
|
|
import { play } from './actions.js'
|
|
|
|
|
|
|
|
|
|
class Chrome extends React.Component {
|
|
|
|
|
render() {
|
|
|
|
|
return (
|
|
|
|
|
<div className='flex-fullcenter'>
|
|
|
|
|
<div className='background-heading'><h1>Alpha Centauri Farming</h1></div>
|
|
|
|
|
{this.props.children}
|
|
|
|
|
<Tractor spikes={this.props.spikes} className={this.props.tractorClass} />
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
const Chrome = ({ children, spikes, tractorClass }) => {
|
|
|
|
|
return (
|
|
|
|
|
<div className='flex-fullcenter'>
|
|
|
|
|
<div className='background-heading'><h1>Alpha Centauri Farming</h1></div>
|
|
|
|
|
{children}
|
|
|
|
|
<Tractor spikes={spikes} className={tractorClass} />
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class App extends React.Component {
|
|
|
|
|
render() {
|
|
|
|
|
let view;
|
|
|
|
|
switch (this.props.screen) {
|
|
|
|
|
const App = ({ screen, logout, createAccount, login, errors }) => {
|
|
|
|
|
let view;
|
|
|
|
|
switch (screen) {
|
|
|
|
|
case SCREENS.intro:
|
|
|
|
|
view = (<Chrome spikes={true} tractorClass='intro'><Welcome /></Chrome>);
|
|
|
|
|
break;
|
|
|
|
|
case SCREENS.start:
|
|
|
|
|
view = (<Chrome><CreateOrJoin signOut={this.props.logout} /></Chrome>);
|
|
|
|
|
break;
|
|
|
|
|
case SCREENS.newGame:
|
|
|
|
|
view = (<Chrome>
|
|
|
|
|
case SCREENS.start:
|
|
|
|
|
view = (<Chrome><CreateOrJoin signOut={logout} /></Chrome>);
|
|
|
|
|
break;
|
|
|
|
|
case SCREENS.newGame:
|
|
|
|
|
view = (<Chrome>
|
|
|
|
|
<div className='view-container'>
|
|
|
|
|
<NewGame colors={['green', 'red', 'blue', 'yellow', 'black']}
|
|
|
|
|
button={'Start'}
|
|
|
|
|
title={'New Game'}
|
|
|
|
|
type={'new-game'}
|
|
|
|
|
showGameName={true}
|
|
|
|
|
createAccount={createAccount}
|
|
|
|
|
login={login}
|
|
|
|
|
errors={errors}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</Chrome>);
|
|
|
|
|
break;
|
|
|
|
|
case SCREENS.joinGame:
|
|
|
|
|
view = (
|
|
|
|
|
<Chrome>
|
|
|
|
|
<div className='view-container'>
|
|
|
|
|
<NewGame colors={['green', 'red', 'blue', 'yellow', 'black']}
|
|
|
|
|
button={'Start'}
|
|
|
|
|
title={'New Game'}
|
|
|
|
|
type={'new-game'}
|
|
|
|
|
showGameName={true}
|
|
|
|
|
createAccount={this.props.createAccount}
|
|
|
|
|
login={this.props.login}
|
|
|
|
|
errors={this.props.errors}
|
|
|
|
|
<JoinGame createAccount={createAccount}
|
|
|
|
|
login={login}
|
|
|
|
|
errors={errors}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</Chrome>);
|
|
|
|
|
break;
|
|
|
|
|
case SCREENS.joinGame:
|
|
|
|
|
view = (
|
|
|
|
|
<Chrome>
|
|
|
|
|
<div className='view-container'>
|
|
|
|
|
<JoinGame createAccount={this.props.createAccount}
|
|
|
|
|
login={this.props.login}
|
|
|
|
|
errors={this.props.errors}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</Chrome>);
|
|
|
|
|
break;
|
|
|
|
|
case SCREENS.play:
|
|
|
|
|
view = (<Board />);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return (
|
|
|
|
|
<Fragment>
|
|
|
|
|
{view}
|
|
|
|
|
<div id={messagePanelId}><MessagePanel /></div>
|
|
|
|
|
</Fragment>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
return (
|
|
|
|
|
<Fragment>
|
|
|
|
|
{view}
|
|
|
|
|
<div id={messagePanelId}><MessagePanel /></div>
|
|
|
|
|
</Fragment>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default connect(
|
|
|
|
|