Skip to content

Commit

Permalink
Merge branch 'summer2018-master' of https://github.com/codeandcogniti…
Browse files Browse the repository at this point in the history
…on/koconut into summer2018-master
  • Loading branch information
janeq97 committed Jun 20, 2018
2 parents 22c8dd0 + 2c6f219 commit a807064
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 26 deletions.
6 changes: 3 additions & 3 deletions src/ui/components/ConceptCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ class ConceptCard extends Component {
<Card>
<CardContent>
<div>
<div style={{display: 'flex'}}>
<div style={{display: 'flex', cursor: "pointer"}} onClick={evt => this.handleExpandClick()}>
{this.state.expand ?
<ExpandedIcon style={{cursor: "pointer"}} onClick={evt => this.handleExpandClick()} /> :
<ExpandMoreIcon style={{cursor: 'pointer'}} onClick={evt => this.handleExpandClick()}/>
<ExpandedIcon /> :
<ExpandMoreIcon />
}
<p style={titleStyle}>{this.props.title}</p>
</div>
Expand Down
16 changes: 14 additions & 2 deletions src/ui/components/Navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ import MenuItem from '@material-ui/core/MenuItem/MenuItem';
*/

type Props = {
firebaseUser: ?FirebaseUser
firebaseUser: ?FirebaseUser,
display: string,
switchToWorldView: Function
}

class Navbar extends Component {
Expand Down Expand Up @@ -56,9 +58,19 @@ class Navbar extends Component {
<div>
<AppBar>
<Toolbar>
<Typography style={{flexGrow: 1}} variant={"title"} color={"primary"}>
{this.props.display === "EXERCISE" ?
<div style={{marginRight: 5}}><Button onClick={this.props.switchToWorldView}
aria-owns='menu'
aria-haspopup="true"
id="menu-button"
color={"secondary"}>
Back to World View
</Button></div> : <div></div>
}
<Typography style={{flexGrow: 1}} variant={"title"} color={"secondary"}>
Koconut
</Typography>

{this.props.firebaseUser &&
(<div>
<Button onClick={(e) => this.handleMenuClick(e)}
Expand Down
58 changes: 37 additions & 21 deletions src/ui/containers/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class App extends Component {
submitTryAgain: Function;
switchToSignin: Function;
switchToSignup: Function;
switchToWorldView: Function;
generator: ExerciseGenerator;
theme: mixed;
// updater: ResponseEvaluator;
Expand All @@ -53,7 +54,7 @@ class App extends Component {
display: string, // the current display state
conceptOptions: number, // concept options offered, no options if <= 1
currentConcept: ?string,
firebaseUser: ?FirebaseUser
firebaseUser: any
};
constructor() {
super();
Expand All @@ -77,6 +78,7 @@ class App extends Component {
this.submitTryAgain = this.submitTryAgain.bind(this);
this.switchToSignin = this.switchToSignin.bind(this);
this.switchToSignup = this.switchToSignup.bind(this);
this.switchToWorldView = this.switchToWorldView.bind(this);
}
/**
* Return a generated exercise
Expand Down Expand Up @@ -221,6 +223,14 @@ class App extends Component {
this.setState({display: displayType.signup});
}

/**
* Sets the display state to 'WORLD". This function is passed as a prop
* to the the navigationbar.
*/
switchToWorldView() {
this.setState({display: displayType.world});
}

/**
* Renders the welcome view
* @returns {*}
Expand All @@ -229,9 +239,13 @@ class App extends Component {
return (
<Welcome
callBack={() => {
this.setState({display: displayType.world});
var databaseRef = firebase.database().ref("Users/" + this.state.firebaseUser.uid + "/waiverStatus");
databaseRef.set(true);
if(this.state.firebaseUser) {
this.setState({display: displayType.world});
var databaseRef = firebase.database().
ref("Users/" + this.state.firebaseUser.uid +
"/waiverStatus");
databaseRef.set(true);
}
}}
firebaseUser={this.state.firebaseUser}
app={this}/>
Expand Down Expand Up @@ -302,24 +316,26 @@ class App extends Component {
return (
<div className="App">
<MuiThemeProvider theme={this.theme}>
<Navbar firebaseUser={this.state.firebaseUser} />
<Navbar firebaseUser={this.state.firebaseUser}
switchToWorldView={this.switchToWorldView}
display={this.state.display}/>
<div className="main">
{/*<h1 className="title">*/}
{/*{this.state.display !== displayType.welcome ?*/}
{/*<span className="debug">*/}
{/*<input*/}
{/*type="button"*/}
{/*onClick={() => this.setState(*/}
{/*{*/}
{/*display: displayType.exercise,*/}
{/*exercise: this._getExercise(),*/}
{/*feedback: '',*/}
{/*counter: this.state.counter + 1,*/}
{/*})}*/}
{/*value="next exercise type"*/}
{/*/>*/}
{/*</span> : ''}*/}
{/*</h1>*/}
<h1 className="title">
{this.state.display !== displayType.welcome ?
<span className="debug">
<input
type="button"
onClick={() => this.setState(
{
display: displayType.exercise,
exercise: this._getExercise(),
feedback: '',
counter: this.state.counter + 1,
})}
value="next exercise type"
/>
</span> : ''}
</h1>
{this.renderDisplay()}
</div>
</MuiThemeProvider>
Expand Down

0 comments on commit a807064

Please sign in to comment.