Files
freeCodeCamp/common/app/routes/Challenges/Help-Modal.jsx
Mikhail Pontus 3144820405 fix(challenges): Implement Help Dialog
This commit applies changes from 78e86f514f.

It introduces Help dialog which guides the user to review Read-Search-Ask
methodology, ask the question on the forums or in gitter chatroom.

This dialog replaces existing Help button which was leading to Gitter Chatroom.
2017-12-23 14:58:06 +03:00

95 lines
2.5 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { Button, Modal } from 'react-bootstrap';
import ns from './ns.json';
import {
createQuestion,
openHelpChatRoom,
closeHelpModal,
helpModalSelector
} from './redux';
const mapStateToProps = state => ({ isOpen: helpModalSelector(state) });
const mapDispatchToProps = { createQuestion, openHelpChatRoom, closeHelpModal };
const methodologyUrl = 'https://forum.freecodecamp.org/t/the-read-search-ask-methodology-for-getting-unstuck/137307'; // eslint-disable-line max-len
const propTypes = {
closeHelpModal: PropTypes.func,
createQuestion: PropTypes.func,
isOpen: PropTypes.bool,
openHelpChatRoom: PropTypes.func
};
export class HelpModal extends PureComponent {
render() {
const {
isOpen,
closeHelpModal,
openHelpChatRoom,
createQuestion
} = this.props;
return (
<Modal
show={ isOpen }
>
<Modal.Header className={ `${ns}-list-header` }>
Ask for help?
<span
className='close closing-x'
onClick={ closeHelpModal }
>
×
</span>
</Modal.Header>
<Modal.Body className='text-center'>
<h3>
If you've already tried the&nbsp;Read-Search-Ask&nbsp;method,
then you can ask for help on the freeCodeCamp forum.
</h3>
<Button
block={ true }
bsSize='lg'
bsStyle='primary'
href={ methodologyUrl }
onClick={ closeHelpModal }
target='_blank'
>
Learn about the Read-Search-Ask Methodology
</Button>
<Button
block={ true }
bsSize='lg'
bsStyle='primary'
onClick={ createQuestion }
>
Create a help post on the forum
</Button>
<Button
block={ true }
bsSize='lg'
bsStyle='primary'
onClick={ openHelpChatRoom }
>
Ask for help in the Gitter Chatroom
</Button>
<Button
block={ true }
bsSize='lg'
bsStyle='primary'
onClick={ closeHelpModal }
>
Cancel
</Button>
</Modal.Body>
</Modal>
);
}
}
HelpModal.displayName = 'HelpModal';
HelpModal.propTypes = propTypes;
export default connect(mapStateToProps, mapDispatchToProps)(HelpModal);