This repository has been archived by the owner on Jun 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Choose your own adventure MVP/React skeleton #63
Merged
Merged
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
86fdf27
Created files needed
maoivy a83ff6b
Update chooseAdventure.js
maoivy 4748ce3
Merge branch 'master' into cyoa-skeleton
maoivy 30510f9
added the view
Mayowa99 9dbb50c
changed name
maoivy d05f37d
added stageview
maoivy b9c8243
added button and stuff
maoivy 5d361b1
add proptypes for intro
maoivy ce1a864
Update stageView.js
maoivy 8f00c93
Switched to using a dictionary rather than direct references
Dylan-Weber 037e6e6
Merge branch 'cyoa-skeleton' of https://github.com/dhmit/democracy_af…
Dylan-Weber 0d17c5a
Commit after merge + minor newline changes
Dylan-Weber 55609cf
updated the intro view
Mayowa99 9fdbc5e
Merge branch 'cyoa-skeleton' of https://github.com/dhmit/democracy_af…
Mayowa99 92fc4a2
Implemented first steps of stageview
Dylan-Weber eaf9a1a
Merge branch 'cyoa-skeleton' of https://github.com/dhmit/democracy_af…
Dylan-Weber feb541a
changed some skeleton stuff
maoivy 8575a51
Merge branch 'cyoa-skeleton' of https://github.com/dhmit/democracy_af…
maoivy b8bd724
Fixed the error on my end
Dylan-Weber b8bdaad
Merge branch 'cyoa-skeleton' of https://github.com/dhmit/democracy_af…
Dylan-Weber 5f47419
Refactored stuff, moved get started button
maoivy 1d531cc
Removed unecessary spacing
Dylan-Weber 37ac9d1
Added connections to end view and success total calc
maoivy f9966ae
Merge branch 'cyoa-skeleton' of https://github.com/dhmit/democracy_af…
maoivy a9c72e6
Changed setActiveStage to setStage
Dylan-Weber 7a20ca7
Added restart adventure
maoivy b58cd4b
Temp commit. Started adding updateHistory
Dylan-Weber 156da6c
Merge branch 'cyoa-skeleton' of https://github.com/dhmit/democracy_af…
Dylan-Weber 019d916
Added history
Dylan-Weber df15283
Added history to overview
maoivy 71eb60a
Designed front page
Mayowa99 77f6970
Merge branch 'cyoa-skeleton' of https://github.com/dhmit/democracy_af…
Mayowa99 4e969b1
add assets dir for images
ryaanahmed dbd4d23
Merge branch 'cyoa-skeleton' of github.com:dhmit/democracy_africa int…
ryaanahmed 3341387
move sample.jpg to new structure
ryaanahmed 3e24732
Merge branch 'master' into cyoa-skeleton
ryaanahmed ff5a07e
Merge branch 'master' into cyoa-skeleton
ryaanahmed 299cb1b
Add edx view, add success detail, change calc to multipliers
maoivy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -141,7 +141,6 @@ frontend/node_modules | |
# production | ||
build/ | ||
static/ | ||
assets/ | ||
|
||
# misc | ||
.DS_Store | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 @@ | ||
Images go here! |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 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 |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import React from 'react'; | ||
import IntroView from './introView.js'; | ||
import StageView from './stageView.js'; | ||
import EndView from './endView.js'; | ||
|
||
|
||
/** | ||
* Component for displaying choose your own adventure skeleton | ||
*/ | ||
export class ChooseAdventureView extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
view: 'intro', | ||
history: [], | ||
successTotal: 1, | ||
}; | ||
} | ||
|
||
componentDidMount() { | ||
// do your fetch and set initial state | ||
} | ||
|
||
setView = (view) => { | ||
this.setState({ view: view, }); | ||
}; | ||
|
||
updateHistory = (option) => { | ||
this.setState((prevState) => ({ | ||
history: prevState.history.concat(option), | ||
})); | ||
}; | ||
|
||
updateSuccess = (successFactor) => { | ||
this.setState((prevState) => ({ | ||
successTotal: prevState.successTotal * successFactor, | ||
})); | ||
}; | ||
|
||
resetProgress = () => { | ||
this.setState({ | ||
successTotal: 1, | ||
history: [], | ||
}); | ||
}; | ||
|
||
|
||
render() { | ||
const desc = 'example paragraph: Paragraphs are the building blocks of papers. Many ' + | ||
'students ' + | ||
'define paragraphs in terms of length: a paragraph is a group of at least five ' + | ||
'sentences, ' + | ||
'a paragraph is half a page long, etc. In reality, though, the unity and coherence ' + | ||
'of ' + | ||
'ideas among sentences is what constitutes a paragraph. A paragraph is defined as ' + | ||
'“a ' + | ||
'group of sentences or a single sentence that forms a unit” (Lunsford and Connors ' + | ||
'116). ' + | ||
'Length and appearance do not determine whether a section in a paper is a paragraph. ' + | ||
'For instance, in some styles of writing, particularly journalistic styles, a ' + | ||
'paragraph ' + | ||
'can be just one sentence long. Ultimately, a paragraph is a sentence or group of ' + | ||
'sentences that support one main idea. In this handout, we will refer to this as the ' + | ||
'“controlling idea,” because it controls what happens in the rest of the paragraph.'; | ||
console.log("rerendering"); | ||
return ( | ||
<div> | ||
{this.state.view === 'intro' && <IntroView desc={desc} setView={this.setView} />} | ||
{this.state.view === 'stage' && | ||
<StageView setView={this.setView} | ||
updateSuccess={this.updateSuccess} | ||
updateHistory={this.updateHistory} | ||
/>} | ||
{this.state.view === 'end' && <EndView | ||
successTotal={this.state.successTotal} | ||
history={this.state.history} | ||
setView={this.setView} | ||
resetProgress={this.resetProgress} | ||
/>} | ||
</div> | ||
); | ||
|
||
} | ||
} |
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,7 @@ | ||
.intro_desc{ | ||
|
||
} | ||
|
||
.cyoa-button{ | ||
position: center; | ||
} |
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,44 @@ | ||
import React from 'react'; | ||
import * as PropTypes from 'prop-types'; | ||
|
||
/** | ||
* Component for displaying choose your own adventure skeleton | ||
*/ | ||
|
||
class EndView extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
} | ||
|
||
resetAdventure = () => { | ||
this.props.setView('stage'); | ||
this.props.resetProgress(); | ||
}; | ||
|
||
render() { | ||
const choices = this.props.history.map((option, k) => ( | ||
<div key={k}> | ||
Choosing to {option.text} has a {option.successFactor} chance of success. | ||
<br /> | ||
{option.successDetail} | ||
</div> | ||
)); | ||
return ( | ||
<div> | ||
<div>You had {this.props.successTotal} chance of succeeding.</div> | ||
{choices} | ||
<button onClick={() => this.resetAdventure()}>Try again</button> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
EndView.propTypes = { | ||
setView: PropTypes.func, | ||
history: PropTypes.array, | ||
successTotal: PropTypes.number, | ||
resetProgress: PropTypes.func, | ||
}; | ||
|
||
|
||
export default EndView; |
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,44 @@ | ||
import React from 'react'; | ||
import * as PropTypes from "prop-types"; | ||
|
||
|
||
/** | ||
* Component for displaying choose your own adventure skeleton | ||
*/ | ||
|
||
class IntroView extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
} | ||
|
||
render() { | ||
return ( | ||
<div> | ||
<div className='row'> | ||
<div className={'col-6'}> | ||
{this.props.desc} | ||
</div> | ||
<img className= 'col-6' src='/static/img/sample.jpg' alt="Sample" /> | ||
|
||
</div> | ||
|
||
<button className='col-5 cyoa-button' onClick={() => this.props.setView('stage')}> | ||
Get started | ||
</button> | ||
</div> | ||
|
||
|
||
|
||
|
||
|
||
); | ||
|
||
} | ||
} | ||
|
||
IntroView.propTypes = { | ||
desc: PropTypes.string, | ||
setView: PropTypes.func, | ||
}; | ||
|
||
export default IntroView; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i know this is just mvp / prototyping code but whoa there unnecessary whitespace