Skip to content
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

Merged
merged 1 commit into from Dec 5, 2016
Merged

Reactified Success Modal #11253

merged 1 commit into from Dec 5, 2016

Conversation

Bouncey
Copy link
Member

@Bouncey Bouncey commented Oct 17, 2016

Pre-Submission Checklist

  • Your pull request targets the staging branch of FreeCodeCamp.
  • Branch starts with either fix/, feature/, or translate/ (e.g. fix/signin-issue)
  • You have only one commit (if not, squash them into one commit).
  • All new and existing tests pass the command npm run test-challenges. Use git commit --amend to amend any fixes.

Type of Change

  • Small bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds new functionality)
  • Breaking change (fix or feature that would change existing functionality)
  • Add new translation (feature adding new translations)

Checklist:

Description

Added a react version of the current success modal

@BerkeleyTrue BerkeleyTrue added the status: waiting review To be applied to PR's that are ready for QA, especially when additional review is pending. label Oct 17, 2016
@camperbot
Copy link
Contributor

@Bouncey updated the pull request.

@Bouncey
Copy link
Member Author

Bouncey commented Oct 18, 2016

This is ready for QA

@SandraMonroe
Copy link

Can you please remove my information, wi don't want to this is way out of my league 
Thanks in advance Sandra Monroe 
Sent from Yahoo Mail on Android

On Tue, Oct 18, 2016 at 6:15 AM, Stuart Taylornotifications@github.com wrote:
this is ready for QA


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

@dhcodes
Copy link
Contributor

dhcodes commented Oct 18, 2016

@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.

@ghost
Copy link

ghost commented Oct 18, 2016

❤️

@camperbot
Copy link
Contributor

@Bouncey updated the pull request.

@Bouncey
Copy link
Member Author

Bouncey commented Oct 18, 2016

Now with Ctrl + Enter to advance to the next challenge, else it just wouldn't be the same modal

👍

modalTitle,
onModalExit
} = this.props;
let _buttonText = (buttonText) ? buttonText : 'Submit',

This comment was marked as off-topic.

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.

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.

This comment was marked as off-topic.

if (this.props.onModalClick) {
return this.props.onModalClick();
}
throw new Error('Expected an "onClick" handler for "onModalClick"');

This comment was marked as off-topic.

@@ -0,0 +1,45 @@
.success {

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@@ -0,0 +1,69 @@
import React, { PropTypes } from 'react';

This comment was marked as off-topic.

This comment was marked as off-topic.

actionCreator: 'submitChallenge',
timeout: 10000
})
return Observable.just(

This comment was marked as off-topic.

@camperbot
Copy link
Contributor

@Bouncey updated the pull request.

timeout: 10000
})
);
return Observable.just(null);

This comment was marked as off-topic.

@camperbot
Copy link
Contributor

@Bouncey updated the pull request.

@@ -0,0 +1,45 @@
.success {

This comment was marked as off-topic.

@@ -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.

This comment was marked as off-topic.


// A map of 'keydown' events
let map = {};
let keyBindings = (event) => {

This comment was marked as off-topic.

This comment was marked as off-topic.

return false;
};

let successMessage = randomCompliment();

This comment was marked as off-topic.

This comment was marked as off-topic.


onClickHandler() {
this.props.onModalClick();
}

This comment was marked as off-topic.

block={ true }
bsSize='large'
bsStyle='primary'
onClick={this.onClickHandler.bind(this)}

This comment was marked as off-topic.

</Modal.Body>
<Modal.Footer>
<Button
block={ true }

This comment was marked as off-topic.

@@ -111,6 +141,13 @@ export class Challenge extends PureComponent {
</Col>
{ this.renderPreview(showPreview) }
<BugModal />
<ClassicModal
keyBindings={ keyBindings }

This comment was marked as off-topic.

modalShow={ isChallengePassed }
modalTitle={ successMessage }
onModalClick={ submitChallenge }
onModalExit={ testsInvalid }

This comment was marked as off-topic.

@@ -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.

@@ -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.

@@ -21,6 +21,7 @@ export default createTypes([
'updateHint',
'lockUntrustedCode',
'unlockUntrustedCode',
'testsInvalid',

This comment was marked as off-topic.

@BerkeleyTrue
Copy link
Contributor

I don't think we use modals anywhere else so where I commented isChallengeModalOpen it can just be isModalOpen.

@Bouncey
Copy link
Member Author

Bouncey commented Oct 26, 2016

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 isChallengePassed concern 👍

We are getting there 😄

@BerkeleyTrue
Copy link
Contributor

Oh yeah forget about that bugger. 👍

@camperbot
Copy link
Contributor

@Bouncey updated the pull request.

1 similar comment
@camperbot
Copy link
Contributor

@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.

export default class ClassicModal extends PureComponent {

renderIcon() {
return (

This comment was marked as off-topic.

@@ -81,15 +99,30 @@ export class Challenge extends PureComponent {
);
}

keyBindings(event) {

This comment was marked as off-topic.

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.

@@ -81,15 +99,30 @@ export class Challenge extends PureComponent {
);
}

keyBindings(event) {
const map = this.props.keyMap;

This comment was marked as off-topic.

@camperbot
Copy link
Contributor

@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.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@@ -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.

@camperbot
Copy link
Contributor

@Bouncey updated the pull request.

1 similar comment
@camperbot
Copy link
Contributor

@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.

This comment was marked as off-topic.

</Modal.Header>
<Modal.Body>
<div className='text-center'>
<div className='row' id='checkmark-container'>

This comment was marked as off-topic.

export default class ClassicModal extends PureComponent {

keyBindings(event) {
const map = Object.assign({}, this.props.keyMap);

This comment was marked as off-topic.

@camperbot
Copy link
Contributor

@Bouncey updated the pull request.

<Modal
animation={ false }
dialogClassName='success'
id='complete-courseware-dialog'

This comment was marked as off-topic.

keyboard={ true }
onHide={ close }
onKeyDown={ this.keyBindings.bind(this) }
onKeyUp={ this.keyBindings.bind(this) }

This comment was marked as off-topic.

export default class ClassicModal extends PureComponent {

keyBindings(event) {
const map = Object.assign({}, this.props.keyMap);

This comment was marked as off-topic.

@camperbot
Copy link
Contributor

@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.

@camperbot
Copy link
Contributor

@Bouncey updated the pull request.

1 similar comment
@camperbot
Copy link
Contributor

@Bouncey updated the pull request.

@systimotic
Copy link
Member

@Bouncey Is this ready for another QA by @BerkeleyTrue?

@Bouncey
Copy link
Member Author

Bouncey commented Nov 19, 2016

👍

On Saturday, 19 November 2016, Timo notifications@github.com wrote:

@Bouncey https://github.com/Bouncey Is this ready for another QA by
@BerkeleyTrue https://github.com/BerkeleyTrue?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#11253 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ARtk5uv8kvxazwQAxGYVzYkqNISXkggJks5q_rNPgaJpZM4KZMOY
.

this.keyBindings = this.keyBindings.bind(this);
}

keyBindings(e) {

This comment was marked as off-topic.

@BerkeleyTrue
Copy link
Contributor

Apologies. Looks like I made some review comments but never submitted them.

@camperbot
Copy link
Contributor

@Bouncey updated the pull request.

2 similar comments
@camperbot
Copy link
Contributor

@Bouncey updated the pull request.

@camperbot
Copy link
Contributor

@Bouncey updated the pull request.

@camperbot
Copy link
Contributor

@Bouncey updated the pull request.

@BerkeleyTrue BerkeleyTrue merged commit a70b10b into freeCodeCamp:staging Dec 5, 2016
@BerkeleyTrue BerkeleyTrue removed the status: waiting review To be applied to PR's that are ready for QA, especially when additional review is pending. label Dec 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants