[fix] Lecture loads
This commit is contained in:
@ -12,11 +12,12 @@ export default React.createClass({
|
||||
displayName: 'Hike',
|
||||
|
||||
propTypes: {
|
||||
showQuestions: PropTypes.bool,
|
||||
currentHike: PropTypes.object
|
||||
dashedName: PropTypes.string,
|
||||
currentHike: PropTypes.object,
|
||||
showQuestions: PropTypes.bool
|
||||
},
|
||||
|
||||
renderBody(showQuestions, currentHike) {
|
||||
renderBody(showQuestions, currentHike, dashedName) {
|
||||
if (showQuestions) {
|
||||
return (
|
||||
<Questions hike={ currentHike }/>
|
||||
@ -30,13 +31,18 @@ export default React.createClass({
|
||||
|
||||
return (
|
||||
<Lecture
|
||||
dashedName={ dashedName }
|
||||
description={ description }
|
||||
id={ id } />
|
||||
);
|
||||
},
|
||||
|
||||
render() {
|
||||
const { currentHike, showQuestions } = this.props;
|
||||
const {
|
||||
currentHike = {},
|
||||
dashedName,
|
||||
showQuestions
|
||||
} = this.props;
|
||||
const { title } = currentHike;
|
||||
|
||||
const videoTitle = <h2>{ title }</h2>;
|
||||
@ -47,7 +53,7 @@ export default React.createClass({
|
||||
<Panel
|
||||
className={ 'text-center' }
|
||||
title={ videoTitle }>
|
||||
{ this.renderBody(showQuestions, currentHike) }
|
||||
{ this.renderBody(showQuestions, currentHike, dashedName) }
|
||||
</Panel>
|
||||
</Row>
|
||||
</Col>
|
||||
|
@ -30,7 +30,8 @@ export default contain(
|
||||
appActions: PropTypes.object,
|
||||
children: PropTypes.element,
|
||||
currentHike: PropTypes.object,
|
||||
hikes: PropTypes.array
|
||||
hikes: PropTypes.array,
|
||||
params: PropTypes.object
|
||||
},
|
||||
|
||||
componentWillMount() {
|
||||
@ -44,22 +45,23 @@ export default contain(
|
||||
);
|
||||
},
|
||||
|
||||
renderChild(children, hikes, currentHike) {
|
||||
renderChild(children, hikes, currentHike, dashedName) {
|
||||
if (!children) {
|
||||
return null;
|
||||
}
|
||||
return React.cloneElement(children, { hikes, currentHike });
|
||||
return React.cloneElement(children, { hikes, currentHike, dashedName });
|
||||
},
|
||||
|
||||
render() {
|
||||
const { hikes, children, currentHike } = this.props;
|
||||
const { dashedName } = this.props.params;
|
||||
const preventOverflow = { overflow: 'hidden' };
|
||||
return (
|
||||
<div>
|
||||
<Row style={ preventOverflow }>
|
||||
{
|
||||
// render sub-route
|
||||
this.renderChild(children, hikes, currentHike) ||
|
||||
this.renderChild(children, hikes, currentHike, dashedName) ||
|
||||
// if no sub-route render hikes map
|
||||
this.renderMap(hikes)
|
||||
}
|
||||
|
@ -11,8 +11,9 @@ export default React.createClass({
|
||||
mixins: [History],
|
||||
|
||||
propTypes: {
|
||||
currentHike: PropTypes.object,
|
||||
params: PropTypes.object
|
||||
dashedName: PropTypes.string,
|
||||
description: PropTypes.array,
|
||||
id: PropTypes.string
|
||||
},
|
||||
|
||||
handleError: debug,
|
||||
@ -29,12 +30,10 @@ export default React.createClass({
|
||||
|
||||
render() {
|
||||
const {
|
||||
challengeSeed = ['1'],
|
||||
id = '1',
|
||||
dashedName,
|
||||
description = []
|
||||
} = this.props.currentHike;
|
||||
const { dashedName } = this.props.params;
|
||||
|
||||
const [ id ] = challengeSeed;
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
<Col xs={ 12 }>
|
||||
|
Reference in New Issue
Block a user