Fix video challenge title
This commit is contained in:
@ -6,6 +6,7 @@ import { createSelector } from 'reselect';
|
|||||||
import Lecture from './Lecture.jsx';
|
import Lecture from './Lecture.jsx';
|
||||||
import Questions from './Questions.jsx';
|
import Questions from './Questions.jsx';
|
||||||
import { resetHike } from '../redux/actions';
|
import { resetHike } from '../redux/actions';
|
||||||
|
import { updateTitle } from '../../../redux/actions';
|
||||||
import { getCurrentHike } from '../redux/selectors';
|
import { getCurrentHike } from '../redux/selectors';
|
||||||
|
|
||||||
const mapStateToProps = createSelector(
|
const mapStateToProps = createSelector(
|
||||||
@ -27,9 +28,15 @@ export class Hike extends React.Component {
|
|||||||
// ui
|
// ui
|
||||||
title: PropTypes.string,
|
title: PropTypes.string,
|
||||||
params: PropTypes.object,
|
params: PropTypes.object,
|
||||||
shouldShowQuestions: PropTypes.bool
|
shouldShowQuestions: PropTypes.bool,
|
||||||
|
updateTitle: PropTypes.func
|
||||||
};
|
};
|
||||||
|
|
||||||
|
componentWillMount() {
|
||||||
|
const { updateTitle } = this.props;
|
||||||
|
updateTitle(this.props.title);
|
||||||
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
this.props.resetHike();
|
this.props.resetHike();
|
||||||
}
|
}
|
||||||
@ -71,4 +78,4 @@ export class Hike extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// export redux aware component
|
// export redux aware component
|
||||||
export default connect(mapStateToProps, { resetHike })(Hike);
|
export default connect(mapStateToProps, { resetHike, updateTitle })(Hike);
|
||||||
|
@ -6,7 +6,6 @@ import { createSelector } from 'reselect';
|
|||||||
// import debug from 'debug';
|
// import debug from 'debug';
|
||||||
|
|
||||||
import HikesMap from './Map.jsx';
|
import HikesMap from './Map.jsx';
|
||||||
import { updateTitle } from '../../../redux/actions';
|
|
||||||
import { fetchHikes } from '../redux/actions';
|
import { fetchHikes } from '../redux/actions';
|
||||||
|
|
||||||
import contain from '../../../utils/professor-x';
|
import contain from '../../../utils/professor-x';
|
||||||
@ -41,15 +40,9 @@ export class Hikes extends PureComponent {
|
|||||||
static propTypes = {
|
static propTypes = {
|
||||||
children: PropTypes.element,
|
children: PropTypes.element,
|
||||||
hikes: PropTypes.array,
|
hikes: PropTypes.array,
|
||||||
params: PropTypes.object,
|
params: PropTypes.object
|
||||||
updateTitle: PropTypes.func
|
|
||||||
};
|
};
|
||||||
|
|
||||||
componentWillMount() {
|
|
||||||
const { updateTitle } = this.props;
|
|
||||||
updateTitle('Hikes');
|
|
||||||
}
|
|
||||||
|
|
||||||
renderMap(hikes) {
|
renderMap(hikes) {
|
||||||
return (
|
return (
|
||||||
<HikesMap hikes={ hikes }/>
|
<HikesMap hikes={ hikes }/>
|
||||||
@ -73,6 +66,6 @@ export class Hikes extends PureComponent {
|
|||||||
|
|
||||||
// export redux and fetch aware component
|
// export redux and fetch aware component
|
||||||
export default compose(
|
export default compose(
|
||||||
connect(mapStateToProps, { fetchHikes, updateTitle }),
|
connect(mapStateToProps, { fetchHikes }),
|
||||||
contain(fetchOptions)
|
contain(fetchOptions)
|
||||||
)(Hikes);
|
)(Hikes);
|
||||||
|
Reference in New Issue
Block a user