Files
freeCodeCamp/common/app/routes/challenges/views/project/Project.jsx

82 lines
1.6 KiB
JavaScript
Raw Normal View History

2016-06-03 18:37:53 -07:00
import React, { PropTypes } from 'react';
import { createSelector } from 'reselect';
import { connect } from 'react-redux';
import Youtube from 'react-youtube';
import PureComponent from 'react-pure-render/component';
import { Col, Row } from 'react-bootstrap';
2016-10-29 00:46:45 +01:00
2016-06-07 20:41:42 -07:00
import SidePanel from './Side-Panel.jsx';
import ToolPanel from './Tool-Panel.jsx';
import BugModal from '../../Bug-Modal.jsx';
2016-06-03 18:37:53 -07:00
import { challengeSelector } from '../../redux/selectors';
const mapStateToProps = createSelector(
challengeSelector,
(
{
challenge: {
id,
description,
2016-06-07 20:41:42 -07:00
challengeSeed: [ videoId = '' ] = []
2016-10-29 00:46:45 +01:00
} = {},
title
2016-06-07 20:41:42 -07:00
}
2016-06-03 18:37:53 -07:00
) => ({
id,
videoId,
title,
2016-06-07 20:41:42 -07:00
description
2016-06-03 18:37:53 -07:00
})
);
2017-01-12 06:54:43 +00:00
const propTypes = {
description: PropTypes.arrayOf(PropTypes.string),
id: PropTypes.string,
isCompleted: PropTypes.bool,
title: PropTypes.string,
videoId: PropTypes.string
};
2016-06-03 18:37:53 -07:00
export class Project extends PureComponent {
render() {
const {
id,
title,
videoId,
isCompleted,
2016-06-07 20:41:42 -07:00
description
2016-06-03 18:37:53 -07:00
} = this.props;
return (
<Row>
2016-06-03 18:37:53 -07:00
<Col md={ 4 }>
2016-06-07 20:41:42 -07:00
<SidePanel
description={ description }
isCompleted={ isCompleted }
title={ title }
/>
2016-06-03 18:37:53 -07:00
</Col>
<Col
md={ 8 }
xs={ 12 }
2016-06-07 20:41:42 -07:00
>
<Youtube
id={ id }
videoId={ videoId }
/>
2016-06-03 18:37:53 -07:00
<br />
2016-06-07 20:41:42 -07:00
<ToolPanel />
2016-06-03 18:37:53 -07:00
<br />
<BugModal />
2016-06-03 18:37:53 -07:00
</Col>
</Row>
2016-06-03 18:37:53 -07:00
);
}
}
2017-01-12 06:54:43 +00:00
Project.displayName = 'Project';
Project.propTypes = propTypes;
2016-06-03 18:37:53 -07:00
export default connect(
2016-06-07 20:41:42 -07:00
mapStateToProps
2016-06-03 18:37:53 -07:00
)(Project);