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 { Button, ButtonGroup, Col } from 'react-bootstrap'; import { challengeSelector } from '../../redux/selectors'; const bindableActions = {}; const mapStateToProps = createSelector( challengeSelector, state => state.app.windowHeight, state => state.app.navHeight, state => state.app.isSignedIn, state => state.challengesApp.tests, state => state.challengesApp.output, ( { challenge: { id, title, description, challengeSeed: [ videoId = ''] = [] } = {} }, windowHeight, navHeight, isSignedIn, tests, output ) => ({ id, videoId, title, description, height: windowHeight - navHeight - 20, tests, output, isSignedIn }) ); export class Project extends PureComponent { static displayName = 'Project'; static propTypes = { id: PropTypes.string, videoId: PropTypes.string, title: PropTypes.string, description: PropTypes.arrayOf(PropTypes.string), isCompleted: PropTypes.bool, isSignedIn: PropTypes.bool }; renderIcon(isCompleted) { if (!isCompleted) { return null; } return ( ); } renderDescription(title = '', description = []) { return description .map((line, index) => (
)); } render() { const { id, title, videoId, isCompleted, description, isSignedIn } = this.props; const buttonCopy = isSignedIn ? "I've completed this challenge" : 'Go to my next challenge'; return (