<commit_before>React               = require 'react'
ReactDOM            = require 'react-dom'
render              = ReactDOM.render
ReactRouter         = require 'react-router'
Router              = ReactRouter.Router
Route               = ReactRouter.Route
IndexRoute          = ReactRouter.IndexRoute
Redirect            = ReactRouter.Redirect

App                 = require '../components/app'
Course              = require '../components/course'
Wizard              = require '../components/wizard/wizard'
Dates               = require '../components/timeline/meetings'
CourseCreator       = require '../components/course_creator/course_creator'
CourseCreatorButton = require '../components/course_creator/course_creator_button'

OverviewHandler     = require '../components/overview/overview_handler'
TimelineHandler     = require '../components/timeline/timeline_handler'
RevisionsHandler    = require '../components/revisions/revisions_handler'
StudentsHandler     = require '../components/students/students_handler'
ArticlesHandler     = require '../components/articles/articles_handler'
UploadsHandler      = require '../components/uploads/uploads_handler'

RecentActivityHandler = require '../components/activity/recent_activity_handler'
DidYouKnowHandler     = require '../components/activity/did_you_know_handler'
PlagiarismHandler     = require '../components/activity/plagiarism_handler'
RecentEditsHandler     = require '../components/activity/recent_edits_handler'

TrainingApp           = require '../training/components/training_app'
TrainingModuleHandler = require '../training/components/training_module_handler'
TrainingSlideHandler  = require '../training/components/training_slide_handler'

History             = require 'history'
createHistory       = History.createHistory
useBasename         = History.useBasename

history = useBasename(createHistory)(basename: '/')

routes = (
  <Route path='/' component={App}>
    <IndexRoute component={CourseCreatorButton} />
    <Route path='recent-activity' component={RecentActivityHandler}>
      <IndexRoute component={DidYouKnowHandler} />
      <Route path='plagiarism' component={PlagiarismHandler} />
      <Route path='recent-edits' component={RecentEditsHandler} />
    </Route>
    <Route path='courses'>
      <Route path=':course_school/:course_title' component={Course}>
        <Redirect from="overview" to="/courses/:course_school/:course_title" />
        <IndexRoute component={OverviewHandler} />
        <Route path='timeline' component={TimelineHandler}>
          <Route path='wizard' component={Wizard} />
          <Route path='dates' component={Dates} />
        </Route>
        <Route path='activity' component={RevisionsHandler}></Route>
        <Route path='students' component={StudentsHandler}></Route>
        <Route path='articles' component={ArticlesHandler}></Route>
        <Route path='uploads' component={UploadsHandler}></Route>
      </Route>
    </Route>
    <Route path='course_creator' component={CourseCreator} />
    <Route path='training' component={TrainingApp} >
      <Route path=':library_id/:module_id' component={TrainingModuleHandler} />
      <Route path='/training/:library_id/:module_id/:slide_id' component={TrainingSlideHandler} />
    </Route>
  </Route>
)

render((
  <Router history={history}>
    {routes}
  </Router>
), document.getElementById('react_root'))<commit_msg>don't render react if the root isn't there<commit_after>React               = require 'react'
ReactDOM            = require 'react-dom'
render              = ReactDOM.render
ReactRouter         = require 'react-router'
Router              = ReactRouter.Router
Route               = ReactRouter.Route
IndexRoute          = ReactRouter.IndexRoute
Redirect            = ReactRouter.Redirect

App                 = require '../components/app'
Course              = require '../components/course'
Wizard              = require '../components/wizard/wizard'
Dates               = require '../components/timeline/meetings'
CourseCreator       = require '../components/course_creator/course_creator'
CourseCreatorButton = require '../components/course_creator/course_creator_button'

OverviewHandler     = require '../components/overview/overview_handler'
TimelineHandler     = require '../components/timeline/timeline_handler'
RevisionsHandler    = require '../components/revisions/revisions_handler'
StudentsHandler     = require '../components/students/students_handler'
ArticlesHandler     = require '../components/articles/articles_handler'
UploadsHandler      = require '../components/uploads/uploads_handler'

RecentActivityHandler = require '../components/activity/recent_activity_handler'
DidYouKnowHandler     = require '../components/activity/did_you_know_handler'
PlagiarismHandler     = require '../components/activity/plagiarism_handler'
RecentEditsHandler     = require '../components/activity/recent_edits_handler'

TrainingApp           = require '../training/components/training_app'
TrainingModuleHandler = require '../training/components/training_module_handler'
TrainingSlideHandler  = require '../training/components/training_slide_handler'

History             = require 'history'
createHistory       = History.createHistory
useBasename         = History.useBasename

history = useBasename(createHistory)(basename: '/')

routes = (
  <Route path='/' component={App}>
    <IndexRoute component={CourseCreatorButton} />
    <Route path='recent-activity' component={RecentActivityHandler}>
      <IndexRoute component={DidYouKnowHandler} />
      <Route path='plagiarism' component={PlagiarismHandler} />
      <Route path='recent-edits' component={RecentEditsHandler} />
    </Route>
    <Route path='courses'>
      <Route path=':course_school/:course_title' component={Course}>
        <Redirect from="overview" to="/courses/:course_school/:course_title" />
        <IndexRoute component={OverviewHandler} />
        <Route path='timeline' component={TimelineHandler}>
          <Route path='wizard' component={Wizard} />
          <Route path='dates' component={Dates} />
        </Route>
        <Route path='activity' component={RevisionsHandler}></Route>
        <Route path='students' component={StudentsHandler}></Route>
        <Route path='articles' component={ArticlesHandler}></Route>
        <Route path='uploads' component={UploadsHandler}></Route>
      </Route>
    </Route>
    <Route path='course_creator' component={CourseCreator} />
    <Route path='training' component={TrainingApp} >
      <Route path=':library_id/:module_id' component={TrainingModuleHandler} />
      <Route path='/training/:library_id/:module_id/:slide_id' component={TrainingSlideHandler} />
    </Route>
  </Route>
)

el = document.getElementById('react_root')
render((
  <Router history={history}>
    {routes}
  </Router>
), el) if el?
{'fraction_non_alphanumeric': 0.12653419053185272, 'fraction_numerical': 0.0, 'mean_word_length': 3.5361166335321403, 'pattern_counts': {'":': 0, '<': 69, '<?xml version=': 0, '>': 69, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3940213', 'n_tokens_mistral': 1830, 'n_tokens_neox': 1775, 'n_words': 324}