2018-04-13 15:33:03 +01:00
|
|
|
import React, { PureComponent, Fragment } from 'react';
|
|
|
|
|
import PropTypes from 'prop-types';
|
2018-05-08 00:29:45 +01:00
|
|
|
import { bindActionCreators } from 'redux';
|
|
|
|
|
import { connect } from 'react-redux';
|
2018-04-13 15:33:03 +01:00
|
|
|
import { Button } from 'react-bootstrap';
|
|
|
|
|
|
|
|
|
|
// import { submittingSelector } from './redux';
|
2018-05-08 00:29:45 +01:00
|
|
|
import { openModal } from '../redux';
|
|
|
|
|
import { frontEndProject } from '../../../../utils/challengeTypes';
|
2018-04-13 15:33:03 +01:00
|
|
|
|
2018-05-08 00:29:45 +01:00
|
|
|
import ButtonSpacer from '../../../components/util/ButtonSpacer';
|
|
|
|
|
import ProjectForm from './ProjectForm';
|
2018-04-13 15:33:03 +01:00
|
|
|
|
2018-05-08 00:29:45 +01:00
|
|
|
const mapStateToProps = () => ({});
|
2018-04-13 15:33:03 +01:00
|
|
|
|
2018-05-08 00:29:45 +01:00
|
|
|
const mapDispatchToProps = dispatch =>
|
|
|
|
|
bindActionCreators({ openHelpModal: () => openModal('help') }, dispatch);
|
2018-04-13 15:33:03 +01:00
|
|
|
|
|
|
|
|
const propTypes = {
|
|
|
|
|
challengeType: PropTypes.number,
|
|
|
|
|
guideUrl: PropTypes.string,
|
2018-05-08 00:29:45 +01:00
|
|
|
openHelpModal: PropTypes.func.isRequired
|
2018-04-13 15:33:03 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export class ToolPanel extends PureComponent {
|
|
|
|
|
render() {
|
2018-05-08 00:29:45 +01:00
|
|
|
const { guideUrl, challengeType, openHelpModal } = this.props;
|
|
|
|
|
console.log(this.props);
|
2018-04-13 15:33:03 +01:00
|
|
|
|
|
|
|
|
const isFrontEnd = challengeType === frontEndProject;
|
|
|
|
|
return (
|
|
|
|
|
<Fragment>
|
|
|
|
|
<ProjectForm isFrontEnd={isFrontEnd} />
|
|
|
|
|
<ButtonSpacer />
|
|
|
|
|
{guideUrl && (
|
|
|
|
|
<Fragment>
|
|
|
|
|
<Button
|
|
|
|
|
block={true}
|
|
|
|
|
bsStyle='primary'
|
|
|
|
|
className='btn-primary-ghost btn-big'
|
|
|
|
|
href={guideUrl}
|
|
|
|
|
target='_blank'
|
|
|
|
|
>
|
|
|
|
|
Get a hint
|
|
|
|
|
</Button>
|
|
|
|
|
<ButtonSpacer />
|
|
|
|
|
</Fragment>
|
|
|
|
|
)}
|
|
|
|
|
<Button
|
|
|
|
|
block={true}
|
|
|
|
|
bsStyle='primary'
|
|
|
|
|
className='btn-primary-ghost btn-big'
|
2018-05-08 00:29:45 +01:00
|
|
|
onClick={openHelpModal}
|
2018-04-13 15:33:03 +01:00
|
|
|
>
|
|
|
|
|
Ask for help on the forum
|
|
|
|
|
</Button>
|
|
|
|
|
<ButtonSpacer />
|
|
|
|
|
</Fragment>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ToolPanel.displayName = 'ProjectToolPanel';
|
|
|
|
|
ToolPanel.propTypes = propTypes;
|
|
|
|
|
|
2018-05-08 00:29:45 +01:00
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(ToolPanel);
|