trc-client-core
Version:
The core of the TRC Client
34 lines (30 loc) • 974 B
JSX
import React from 'react';
import {History} from 'react-router';
import LaunchElearningView from 'trc-client-core/src/course/LaunchElearningView';
import Loader from 'trc-client-core/src/components/Loader';
var CourseLaunchView = React.createClass({
displayName: 'CourseLaunchView',
mixins: [
History
],
statics: {
willTransitionFrom: function (transition) {
if (!confirm('Are you sure you want to leave this module')) {
transition.abort();
}
}
},
render: function () {
if(!this.props.course) {
return <Loader/>;
}
if (this.props.course.get('type') === 'E_LEARNING') {
return <LaunchElearningView course={this.props.course.toJS()}/>;
} else {
this.history.pushState(null, `/course/${this.props.course.id}`);
// WTF?
return <Loader/>;
}
}
});
module.exports = CourseLaunchView;