New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reactified Success Modal #11253
Reactified Success Modal #11253
Conversation
@Bouncey updated the pull request. |
This is ready for QA |
Can you please remove my information, wi don't want to this is way out of my league On Tue, Oct 18, 2016 at 6:15 AM, Stuart Taylornotifications@github.com wrote: — |
@SandraMonroe you are likely receiving notifications based on how you follow freecodecamp. You can go into your settings, then notifications and turn off notifications for repositories that you are "watching". That should keep you from getting emails. |
❤️ |
@Bouncey updated the pull request. |
Now with 👍 |
modalTitle, | ||
onModalExit | ||
} = this.props; | ||
let _buttonText = (buttonText) ? buttonText : 'Submit', |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
let _buttonText = (buttonText) ? buttonText : 'Submit', | ||
_customClass = (customClass) ? customClass : '', | ||
_modalTitle = (modalTitle) ? modalTitle : '', | ||
_onModalExit = (onModalExit) ? onModalExit : this.noOp.bind(this), |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
import PureComponent from 'react-pure-render/component'; | ||
|
||
export default class ClassicModal extends PureComponent { | ||
static propTypes = { |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
if (this.props.onModalClick) { | ||
return this.props.onModalClick(); | ||
} | ||
throw new Error('Expected an "onClick" handler for "onModalClick"'); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@@ -0,0 +1,45 @@ | |||
.success { |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@@ -0,0 +1,69 @@ | |||
import React, { PropTypes } from 'react'; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
actionCreator: 'submitChallenge', | ||
timeout: 10000 | ||
}) | ||
return Observable.just( |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@Bouncey updated the pull request. |
timeout: 10000 | ||
}) | ||
); | ||
return Observable.just(null); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@Bouncey updated the pull request. |
@@ -0,0 +1,45 @@ | |||
.success { |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@@ -81,7 +82,13 @@ const mainReducer = handleActions( | |||
}), | |||
[types.updateTests]: (state, { payload: tests }) => ({ | |||
...state, | |||
tests | |||
tests, | |||
isChallengePassed: (tests.length > 0 && |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
||
// A map of 'keydown' events | ||
let map = {}; | ||
let keyBindings = (event) => { |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
return false; | ||
}; | ||
|
||
let successMessage = randomCompliment(); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
||
onClickHandler() { | ||
this.props.onModalClick(); | ||
} |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
block={ true } | ||
bsSize='large' | ||
bsStyle='primary' | ||
onClick={this.onClickHandler.bind(this)} |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
</Modal.Body> | ||
<Modal.Footer> | ||
<Button | ||
block={ true } |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@@ -111,6 +141,13 @@ export class Challenge extends PureComponent { | |||
</Col> | |||
{ this.renderPreview(showPreview) } | |||
<BugModal /> | |||
<ClassicModal | |||
keyBindings={ keyBindings } |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
modalShow={ isChallengePassed } | ||
modalTitle={ successMessage } | ||
onModalClick={ submitChallenge } | ||
onModalExit={ testsInvalid } |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@@ -22,6 +22,7 @@ export const fetchChallengeCompleted = createAction( | |||
(_, challenge) => challenge, | |||
entities => ({ entities }) | |||
); | |||
export const testsInvalid = createAction(types.testsInvalid); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@@ -42,7 +42,8 @@ const initialUiState = { | |||
isPressed: false, | |||
isCorrect: false, | |||
shouldShakeQuestion: false, | |||
shouldShowQuestions: false | |||
shouldShowQuestions: false, | |||
isChallengePassed: false |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@@ -21,6 +21,7 @@ export default createTypes([ | |||
'updateHint', | |||
'lockUntrustedCode', | |||
'unlockUntrustedCode', | |||
'testsInvalid', |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
I don't think we use modals anywhere else so where I commented |
We use a modal for bug reporting so I will try to avoid name clashes with these store values. Comments regarding the key bindings and modal click handler have already been refactored but not pushed due to the We are getting there 😄 |
Oh yeah forget about that bugger. 👍 |
@Bouncey updated the pull request. |
1 similar comment
@Bouncey updated the pull request. |
show={ show } | ||
> | ||
<Modal.Header className='challenge-list-header' closeButton={ true }> | ||
<Modal.Title>{ this.renderSuccessMessage() }</Modal.Title> |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
export default class ClassicModal extends PureComponent { | ||
|
||
renderIcon() { | ||
return ( |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@@ -81,15 +99,30 @@ export class Challenge extends PureComponent { | |||
); | |||
} | |||
|
|||
keyBindings(event) { |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
keyBindings(event) { | ||
const map = this.props.keyMap; | ||
const { mapKeys, isChallengeModalOpen, submitChallenge } = this.props; | ||
map[event.keyCode] = event.type === 'keydown'; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@@ -81,15 +99,30 @@ export class Challenge extends PureComponent { | |||
); | |||
} | |||
|
|||
keyBindings(event) { | |||
const map = this.props.keyMap; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@Bouncey updated the pull request. |
export default class ClassicModal extends PureComponent { | ||
|
||
keyBindings(event) { | ||
const map = Object.assign({}, this.props.keyMap); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@@ -81,7 +84,21 @@ const mainReducer = handleActions( | |||
}), | |||
[types.updateTests]: (state, { payload: tests }) => ({ | |||
...state, | |||
tests | |||
tests, | |||
isChallengeModalOpen: (tests.length > 0 && |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@Bouncey updated the pull request. |
1 similar comment
@Bouncey updated the pull request. |
<Modal | ||
animation={ false } | ||
dialogClassName='success' | ||
id='complete-courseware-dialog' |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
</Modal.Header> | ||
<Modal.Body> | ||
<div className='text-center'> | ||
<div className='row' id='checkmark-container'> |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
export default class ClassicModal extends PureComponent { | ||
|
||
keyBindings(event) { | ||
const map = Object.assign({}, this.props.keyMap); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@Bouncey updated the pull request. |
<Modal | ||
animation={ false } | ||
dialogClassName='success' | ||
id='complete-courseware-dialog' |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
keyboard={ true } | ||
onHide={ close } | ||
onKeyDown={ this.keyBindings.bind(this) } | ||
onKeyUp={ this.keyBindings.bind(this) } |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
export default class ClassicModal extends PureComponent { | ||
|
||
keyBindings(event) { | ||
const map = Object.assign({}, this.props.keyMap); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@Bouncey updated the pull request. |
keyboard={ true } | ||
onHide={ close } | ||
onKeyDown={ this.keyBindings } | ||
onKeyUp={ this.keyBindings } |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@Bouncey updated the pull request. |
1 similar comment
@Bouncey updated the pull request. |
@Bouncey Is this ready for another QA by @BerkeleyTrue? |
👍 On Saturday, 19 November 2016, Timo notifications@github.com wrote:
|
this.keyBindings = this.keyBindings.bind(this); | ||
} | ||
|
||
keyBindings(e) { |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Apologies. Looks like I made some review comments but never submitted them. |
@Bouncey updated the pull request. |
@Bouncey updated the pull request. |
Pre-Submission Checklist
staging
branch of FreeCodeCamp.fix/
,feature/
, ortranslate/
(e.g.fix/signin-issue
)npm run test-challenges
. Usegit commit --amend
to amend any fixes.Type of Change
Checklist:
Description
Added a react version of the current success modal