-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
154 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import _ from 'lodash' | ||
import React, { Component } from 'react' | ||
import { connect } from 'react-redux' | ||
import reducers from './reducers.jsx' | ||
import { Link, Redirect } from 'react-router-dom' | ||
|
||
class Welcome extends Component { | ||
constructor(props) { | ||
super(props) | ||
this.state = { | ||
displayName: this.props.displayName, | ||
avatar: this.props.avatar, | ||
redirect: null | ||
} | ||
} | ||
|
||
handleDisplayNameChange(event) { | ||
this.setState({ displayName: event.target.value }) | ||
} | ||
|
||
handleReady() { | ||
// TODO make sure don't submit empty name | ||
this.props.updateDisplayName(this.state.displayName) | ||
this.props.updateCurrentRoom('Vestibule') | ||
this.setState({ redirect: '/party' }) | ||
} | ||
|
||
render() { | ||
if (this.state.redirect) { | ||
return <Redirect to={this.state.redirect}/> | ||
} | ||
return ( | ||
<div className="vestibule"> | ||
<h1>Welcome have fun</h1> | ||
<div className="display-name"> | ||
<input type="text" placeholder="name" name="name" minLength="1" onChange={this.handleDisplayNameChange.bind(this)}/> | ||
<input type="button" onClick={this.handleReady.bind(this)} value="Party!"/> | ||
</div> | ||
<Link to="/about" activeclassname="active">About</Link> | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
export default connect( | ||
state => state, | ||
{ | ||
updateDisplayName: reducers.updateDisplayNameActionCreator, | ||
updateCurrentRoom: reducers.updateCurrentRoomActionCreator | ||
})(Welcome) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
export default { | ||
'Vestibule': { | ||
north: 'Literally Hell', | ||
west: 'Bathroom', | ||
east: 'Room of Disquiet' | ||
}, | ||
'Literally Hell': { | ||
north: 'Sexy Room', | ||
south: 'Vestibule' | ||
}, | ||
'Bathroom': { | ||
east: 'Vestibule' | ||
}, | ||
'Room of Disquiet': { | ||
west: 'Vestibule' | ||
}, | ||
'Sexy Room': { | ||
south: 'Literally Hell' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
import React from 'react' | ||
import { Router, Route } from 'react-router' | ||
import { createBrowserHistory } from 'history' | ||
import Vestibule from './Vestibule.jsx' | ||
import Welcome from './Welcome.jsx' | ||
import About from './About.jsx' | ||
import Map from './Map.jsx' | ||
import Room from './Room.jsx' | ||
|
||
export default ( | ||
<Router history={createBrowserHistory()}> | ||
<Route exact path="/" component={Vestibule} /> | ||
<Route exact path="/" component={Welcome} /> | ||
<Route path="/about" component={About}/> | ||
<Route path="/map" component={Map}/> | ||
<Route path="/room" component={Room}/> | ||
<Route path="/party" component={Room}/> | ||
</Router> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters