<commit_before>import React, {Component} from 'react';
import {connect} from 'react-redux';
import { defineMessages, injectIntl} from "react-intl";
import { NonIdealState } from '@blueprintjs/core';

import Screen from 'src/components/common/Screen';
import Breadcrumbs from 'src/components/common/Breadcrumbs';
import DualPane from 'src/components/common/DualPane';
import CollectionEditContent from './CollectionEditContent';
import CollectionEditInfo from './CollectionEditInfo';

import { fetchCollection } from 'src/actions';

const messages = defineMessages({
  access_error: {
    id: 'collection.edit.access_error',
    defaultMessage: 'You cannot access collection editing.',
  },
});

class CollectionEditScreen extends Component {
  constructor(){
    super();

    this.state = {
      collection: {}
    };

    this.onChangeCollection = this.onChangeCollection.bind(this);
  }

  componentDidMount() {
    const { collectionId } = this.props;
    this.props.fetchCollection({ id: collectionId });
  }

  componentWillReceiveProps(nextProps) {
    if(this.props !== nextProps) {
      this.setState({collection: nextProps.collection});
    }

  }

  onChangeCollection(collection) {
    this.setState({collection})
  }

  render() {
    const { intl, location, collection, session } = this.props;

    if(!session.loggedIn || !collection.writable) {
      return <NonIdealState
        visual="error"
        title={intl.formatMessage(messages.access_error)}/>
    }

    return (
      <Screen>
        <Breadcrumbs collection={{label: 'Collection Settings', links: {ui: 'http://localhost:8080' + location.pathname}}} />
        <DualPane>
          <CollectionEditInfo onChangeCollection={this.onChangeCollection} collection={collection}/>
          <CollectionEditContent collection={this.state.collection}/>
        </DualPane>
      </Screen>

    );
  }
}

const mapStateToProps = (state, ownProps) => {
  const { collectionId } = ownProps.match.params;<commit_msg>fix variable name in collections editor.<commit_after>import React, {Component} from 'react';
import {connect} from 'react-redux';
import { defineMessages, injectIntl} from "react-intl";
import { NonIdealState } from '@blueprintjs/core';

import Screen from 'src/components/common/Screen';
import Breadcrumbs from 'src/components/common/Breadcrumbs';
import DualPane from 'src/components/common/DualPane';
import CollectionEditContent from './CollectionEditContent';
import CollectionEditInfo from './CollectionEditInfo';

import { fetchCollection } from 'src/actions';

const messages = defineMessages({
  access_error: {
    id: 'collection.edit.access_error',
    defaultMessage: 'You cannot edit this collection.',
  },
});

class CollectionEditScreen extends Component {
  constructor(){
    super();

    this.state = {
      collection: {}
    };

    this.onChangeCollection = this.onChangeCollection.bind(this);
  }

  componentDidMount() {
    const { collectionId } = this.props;
    this.props.fetchCollection({ id: collectionId });
  }

  componentWillReceiveProps(nextProps) {
    if(this.props !== nextProps) {
      this.setState({collection: nextProps.collection});
    }

  }

  onChangeCollection(collection) {
    this.setState({collection})
  }

  render() {
    const { intl, location, collection, session } = this.props;

    if(!collection.writeable) {
      return <NonIdealState
        visual="error"
        title={intl.formatMessage(messages.access_error)}/>
    }

    return (
      <Screen>
        <Breadcrumbs collection={{label: 'Collection Settings', links: {ui: 'http://localhost:8080' + location.pathname}}} />
        <DualPane>
          <CollectionEditInfo onChangeCollection={this.onChangeCollection} collection={collection}/>
          <CollectionEditContent collection={this.state.collection}/>
        </DualPane>
      </Screen>

    );
  }
}

const mapStateToProps = (state, ownProps) => {
  const { collectionId } = ownProps.match.params;
{'fraction_non_alphanumeric': 0.12871536523929472, 'fraction_numerical': 0.0020151133501259445, 'mean_word_length': 3.8426829268292684, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 21, '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': '3619917', 'n_tokens_mistral': 1137, 'n_tokens_neox': 1115, 'n_words': 237}