<commit_before>import { Route, Routes } from 'react-router-dom';
import withRouter from '../util/withRouter';
import React from 'react';
import createReactClass from 'create-react-class';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import { getCampaign } from '../../actions/campaign_view_actions';
import CampaignAlerts from '../alerts/campaign_alerts.jsx';
import CampaignOresPlot from './campaign_ores_plot.jsx';
import CampaignOverviewHandler from './campaign_overview_handler';
import CampaignNavbar from '../common/campaign_navbar';
import CampaignStats from './campaign_stats';
import WikidataOverviewStats from '../common/wikidata_overview_stats';

export const Campaign = createReactClass({
  displayName: 'Campaign',

  propTypes: {
    campaign: PropTypes.object.isRequired,
    match: PropTypes.object,
  },

  componentDidMount() {
    const campaignSlug = this.props.router.params.campaign_slug;
    return this.props.getCampaign(campaignSlug);
  },

  render() {
    if (this.props.campaign.loading) {
      return <div />;
    }

    let campaignHandler;
    if (window.location.href.match(/overview/)) {
      campaignHandler = (
        <div className="high-modal">
          <CampaignOverviewHandler {...this.props} />
        </div>
        );
    }

    return (
      <div>
        <CampaignNavbar
          campaign={this.props.campaign}
        />
        <div className="container campaign_main">
          <section className="overview container">
            <CampaignStats campaign={this.props.campaign} />
            {this.props.campaign.course_stats && <WikidataOverviewStats
              statistics={this.props.campaign.course_stats['www.wikidata.org']}
            />}
          </section>
          {campaignHandler}
          <Routes>
            <Route path=":campaign_slug/ores_plot" element={<CampaignOresPlot />} />
            <Route path=":campaign_slug/alerts" element={<CampaignAlerts />} />
          </Routes>
        </div>
      </div >
    );
  }
});

const mapStateToProps = state => ({
  campaign: state.campaign,
});

const mapDispatchToProps = {
  getCampaign
};

export default withRouter(connect(mapStateToProps, mapDispatchToProps)(Campaign));<commit_msg>fix routes<commit_after>import { Route, Routes } from 'react-router-dom';
import withRouter from '../util/withRouter';
import React from 'react';
import createReactClass from 'create-react-class';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import { getCampaign } from '../../actions/campaign_view_actions';
import CampaignAlerts from '../alerts/campaign_alerts.jsx';
import CampaignOresPlot from './campaign_ores_plot.jsx';
import CampaignOverviewHandler from './campaign_overview_handler';
import CampaignNavbar from '../common/campaign_navbar';
import CampaignStats from './campaign_stats';
import WikidataOverviewStats from '../common/wikidata_overview_stats';

export const Campaign = createReactClass({
  displayName: 'Campaign',

  propTypes: {
    campaign: PropTypes.object.isRequired,
    match: PropTypes.object,
  },

  componentDidMount() {
    const campaignSlug = this.props.router.params.campaign_slug;
    return this.props.getCampaign(campaignSlug);
  },

  render() {
    if (this.props.campaign.loading) {
      return <div />;
    }

    let campaignHandler;
    if (window.location.href.match(/overview/)) {
      campaignHandler = (
        <div className="high-modal">
          <CampaignOverviewHandler {...this.props} />
        </div>
        );
    }

    return (
      <div>
        <CampaignNavbar
          campaign={this.props.campaign}
        />
        <div className="container campaign_main">
          <section className="overview container">
            <CampaignStats campaign={this.props.campaign} />
            {this.props.campaign.course_stats && <WikidataOverviewStats
              statistics={this.props.campaign.course_stats['www.wikidata.org']}
            />}
          </section>
          {campaignHandler}
          <Routes>
            <Route path="ores_plot" element={<CampaignOresPlot />} />
            <Route path="alerts" element={<CampaignAlerts />} />
          </Routes>
        </div>
      </div >
    );
  }
});

const mapStateToProps = state => ({
  campaign: state.campaign,
});

const mapDispatchToProps = {
  getCampaign
};

export default withRouter(connect(mapStateToProps, mapDispatchToProps)(Campaign));
{'fraction_non_alphanumeric': 0.13036637446617216, 'fraction_numerical': 0.0, 'mean_word_length': 3.06021897810219, 'pattern_counts': {'":': 2, '<': 41, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6610318', 'n_tokens_mistral': 1306, 'n_tokens_neox': 1259, 'n_words': 248}