trc-client-core
Version:
The core of the TRC Client
57 lines (51 loc) • 3.4 kB
JSX
import React from 'react';
import {Route, IndexRoute} from 'react-router';
import Markdown from 'trc-client-core/src/components/Markdown';
import Permissions from 'trc-client-core/src/user/Permissions';
import TechnicalHandler from 'react-router-proxy!trc-client-core/src/technical/TechnicalHandler';
import TechnicalVideoView from 'react-router-proxy!trc-client-core/src/technical/TechnicalVideoView';
import FixItRightView from 'react-router-proxy!trc-client-core/src/technical/FixItRightView';
import TechnicalHomePageView from 'react-router-proxy!trc-client-core/src/technical/TechnicalHomePageView';
import TechnicalCoursesView from 'react-router-proxy!trc-client-core/src/technical/TechnicalCoursesView';
import ToyotaNetworkTraining from 'react-router-proxy!trc-client-core/src/technical/ToyotaNetworkTraining';
import TechnicalCertifiedStaff from 'react-router-proxy!trc-client-core/src/technical/TechnicalCertifiedStaff';
import TechnicalAdvisorInformation from 'react-router-proxy!trc-client-core/src/technical/TechnicalAdvisorInformation';
import ToyotaNetworkTrainingHomeCopy from 'trc-client-core/src/copy/technical/toyotaNetworkTrainingHome.md';
import ToyotaNetworkTrainingInformationCopy from 'trc-client-core/src/copy/technical/toyotaNetworkTrainingInformation.md';
import WorkplaceMentorProgramCopy from 'trc-client-core/src/copy/technical/workplaceMentorProgram.md';
import TechnicalAdvisorInformationCopy from 'trc-client-core/src/copy/technical/technicalAdvisorInformationCopy.md';
import TechnicalLearningPlan from 'react-router-proxy!trc-client-core/src/learningPlan/TechnicalLearningPlan';
function markdownFactory(markdown) {
return React.createClass({
render: () => <Markdown ref="markdown" className="margin-bottom2" html={markdown}/>
});
}
function certifiedStaff() {
if (Permissions.get('TECHNICAL_ADMIN')) {
return <Route path="certified-staff" component={TechnicalCertifiedStaff} />;
}
}
var routes;
if(Permissions.get('TECHNICAL')) {
routes = (
<Route path="technical" component={TechnicalHandler}>
<IndexRoute component={TechnicalHomePageView}/>
<Route path="career-plan(/:participantId)" component={TechnicalLearningPlan} />
<Route name="Fix It Right" path="fixitright" component={FixItRightView}>
<Route name="Fix It Right Videos" path=":section/:vimeoId" component={FixItRightView}/>
</Route>
<Route name="Technical Training Videos" path="videos" component={TechnicalVideoView}/>
<Route path="available_training" component={TechnicalCoursesView}/>
{certifiedStaff()}
<Route name="toyota network training" path="toyota-network-training" component={ToyotaNetworkTraining}>
<Route path="information" component={markdownFactory(ToyotaNetworkTrainingInformationCopy)}/>
<Route path="workplace-mentor-program" component={markdownFactory(WorkplaceMentorProgramCopy)}/>
<IndexRoute component={markdownFactory(ToyotaNetworkTrainingHomeCopy)}/>
</Route>
<Route name="technical advisor information" path="technical-advisor-information" component={TechnicalAdvisorInformation}>
<IndexRoute component={markdownFactory(TechnicalAdvisorInformationCopy)}/>
</Route>
</Route>
);
}
export default routes;