<commit_before>import React from 'react';
import { connect } from 'react-redux'
import { BrowserRouter as Router, Switch, Route } from 'react-router-dom'

import { parseAllCards, registerToaster, addComment,
  addCommentThread } from 'redux/actions.js'

import StatusBar from 'StatusBar.js'
import CaseOverview from 'CaseOverview.js'
import CaseElement from 'CaseElement.js'

import { Toaster } from '@blueprintjs/core'

class Case extends React.Component {
  constructor(props) {
    super(props)

    this._subscribe = () => {
      if (typeof App === 'undefined')  return

      App.forum = App.cable.subscriptions  // eslint-disable-line
        .create("ForumChannel", {
          connected: () => {},
          disconnected: () => {},
          received: data => {
            if (data.comment)
              this.props.addComment(JSON.parse(data.comment))
            if (data.comment_thread)
              this.props.addCommentThread(JSON.parse(data.comment_thread))
          },
        })
    }

  }

  componentDidMount() {
    setTimeout( () => this.props.parseAllCards(), 1 )

    this.props.registerToaster(Toaster.create())

    this._subscribe()
  }

  render() {
    return (
      <div id="Case">
        <StatusBar />
        <Router basename={`/cases/${this.props.slug}`}>
          <Switch>
            <Route path="/" exact component={CaseOverview} />
            <Route path="/:position" component={CaseElement} />
          </Switch>
        </Router>
      </div>
    )
  }
}

export default connect(
  (state) => ({slug: state.caseData.slug}),
  { parseAllCards, registerToaster, addComment, addCommentThread },
)(Case)<commit_msg>Fixes basename lack of respect for locales<commit_after>import React from 'react';
import { connect } from 'react-redux'
import { BrowserRouter as Router, Switch, Route } from 'react-router-dom'

import { parseAllCards, registerToaster, addComment,
  addCommentThread } from 'redux/actions.js'

import StatusBar from 'StatusBar.js'
import CaseOverview from 'CaseOverview.js'
import CaseElement from 'CaseElement.js'

import { Toaster } from '@blueprintjs/core'

class Case extends React.Component {
  constructor(props) {
    super(props)

    this._subscribe = () => {
      if (typeof App === 'undefined')  return

      App.forum = App.cable.subscriptions  // eslint-disable-line
        .create("ForumChannel", {
          connected: () => {},
          disconnected: () => {},
          received: data => {
            if (data.comment)
              this.props.addComment(JSON.parse(data.comment))
            if (data.comment_thread)
              this.props.addCommentThread(JSON.parse(data.comment_thread))
          },
        })
    }

  }

  componentDidMount() {
    setTimeout( () => this.props.parseAllCards(), 1 )

    this.props.registerToaster(Toaster.create())

    this._subscribe()
  }

  render() {
    return (
      <div id="Case">
        <StatusBar />
        <Router basename={this.props.basename}>
          <Switch>
            <Route path="/" exact component={CaseOverview} />
            <Route path="/:position" component={CaseElement} />
          </Switch>
        </Router>
      </div>
    )
  }
}

export default connect(
  (state) => ({
    basename: location.pathname.replace(
      RegExp(`${state.caseData.slug}.*`),
      state.caseData.slug
    ),
  }),
  { parseAllCards, registerToaster, addComment, addCommentThread },
)(Case)
{'fraction_non_alphanumeric': 0.1393992417614465, 'fraction_numerical': 0.0005832604257801109, 'mean_word_length': 2.5991605456453306, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 33, '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': '3789709', 'n_tokens_mistral': 1027, 'n_tokens_neox': 1008, 'n_words': 207}