<commit_before>/* global Events */
import React from 'react';
import {InputWidget} from '../widgets';
import PropertyRow from './PropertyRow';
import Collapsible from '../Collapsible';
import Mixins from './Mixins';
import {updateEntity} from '../../actions/entity';
import Events from '../../lib/Events';

// @todo Take this out and use updateEntity?
function changeId (entity, componentName, propertyName, value) {
  if (entity.id !== value) {
    entity.id = value;
    Events.emit('entityIdChanged', entity);
  }
}

export const DEFAULT_COMPONENTS = ['visible', 'position', 'scale', 'rotation'];

export class CommonComponents extends React.Component {
  static propTypes = {
    entity: React.PropTypes.object
  };

  constructor (props) {
    super(props);
  }

  componentDidMount () {
    Events.on('selectedEntityComponentChanged', detail => {
      if (DEFAULT_COMPONENTS.indexOf(detail.name) !== -1) {
        this.forceUpdate();
      }
    });
  }

  renderCommonAttributes () {
    const entity = this.props.entity;
    const components = entity ? entity.components : {};
    return Object.keys(components).filter(function (key) {
      return DEFAULT_COMPONENTS.indexOf(key) !== -1;
    }).map(componentName => {
      const componentData = components[componentName];
      const schema = AFRAME.components[componentName].schema;
      return (
        <PropertyRow onChange={updateEntity} key={componentName} name={componentName}
          showHelp={true} schema={schema} data={componentData.data}
          componentname={componentName} entity={entity}/>
      );
    });
  }

  render () {
    const entity = this.props.entity;
    if (!entity) { return <div></div>; }
    return (
      <Collapsible>
        <div className='collapsible-header'>
          <span>Common</span>
        </div>
        <div className='collapsible-content'>
          <div className='row'>
            <span className='text'>ID</span>
            <InputWidget onChange={changeId} entity={entity} name='id' value={entity.id}/>
          </div>
          {this.renderCommonAttributes()}
          <Mixins entity={entity}/>
        </div>
      </Collapsible>
    );
  }
}
<commit_msg>Capitalize 'common' title to match the rest of panels<commit_after>/* global Events */
import React from 'react';
import {InputWidget} from '../widgets';
import PropertyRow from './PropertyRow';
import Collapsible from '../Collapsible';
import Mixins from './Mixins';
import {updateEntity} from '../../actions/entity';
import Events from '../../lib/Events';

// @todo Take this out and use updateEntity?
function changeId (entity, componentName, propertyName, value) {
  if (entity.id !== value) {
    entity.id = value;
    Events.emit('entityIdChanged', entity);
  }
}

export const DEFAULT_COMPONENTS = ['visible', 'position', 'scale', 'rotation'];

export class CommonComponents extends React.Component {
  static propTypes = {
    entity: React.PropTypes.object
  };

  constructor (props) {
    super(props);
  }

  componentDidMount () {
    Events.on('selectedEntityComponentChanged', detail => {
      if (DEFAULT_COMPONENTS.indexOf(detail.name) !== -1) {
        this.forceUpdate();
      }
    });
  }

  renderCommonAttributes () {
    const entity = this.props.entity;
    const components = entity ? entity.components : {};
    return Object.keys(components).filter(function (key) {
      return DEFAULT_COMPONENTS.indexOf(key) !== -1;
    }).map(componentName => {
      const componentData = components[componentName];
      const schema = AFRAME.components[componentName].schema;
      return (
        <PropertyRow onChange={updateEntity} key={componentName} name={componentName}
          showHelp={true} schema={schema} data={componentData.data}
          componentname={componentName} entity={entity}/>
      );
    });
  }

  render () {
    const entity = this.props.entity;
    if (!entity) { return <div></div>; }
    return (
      <Collapsible>
        <div className='collapsible-header'>
          <span>COMMON</span>
        </div>
        <div className='collapsible-content'>
          <div className='row'>
            <span className='text'>ID</span>
            <InputWidget onChange={changeId} entity={entity} name='id' value={entity.id}/>
          </div>
          {this.renderCommonAttributes()}
          <Mixins entity={entity}/>
        </div>
      </Collapsible>
    );
  }
}

{'fraction_non_alphanumeric': 0.14727272727272728, 'fraction_numerical': 0.0009090909090909091, 'mean_word_length': 3.0265324794144557, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 41, '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': '5554620', 'n_tokens_mistral': 1236, 'n_tokens_neox': 1229, 'n_words': 286}