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