<commit_before>import React from 'react';
import autoBind from 'react-autobind';
import bem from 'js/bem';
import {
  t,
  formatTime
} from 'js/utils';
import {ASSET_TYPES} from 'js/constants';

class AssetInfoBox extends React.Component {
  constructor(props){
    super(props);
    this.state = {
      isPublic: false,
      areDetailsVisible: false
    };
    autoBind(this);
  }

  componentDidMount() {
    console.debug('AssetInfoBox did mount', this.props);
  }

  toggleDetails() {
    this.setState({areDetailsVisible: !this.state.areDetailsVisible});
  }

  makePublic() {
    // 1. check if all required properties filled up
    // 2. make public
    this.setState({isPublic: true});
  }

  makePrivate() {
    // 1. make private
    this.setState({isPublic: false});
  }

  render() {
    if (!this.props.asset) {
      return null;
    }

    return (
      <bem.FormView__cell m='box'>
        <bem.FormView__cell m={['columns', 'padding']}>
          <bem.FormView__cell m={['date', 'column-1']}>
            <bem.FormView__cellLabel>
              {t('Last Modified')}
            </bem.FormView__cellLabel>

            {formatTime(this.props.asset.date_modified)}
          </bem.FormView__cell>

          <bem.FormView__cell m={['questions', 'column-1']}>
            <bem.FormView__cellLabel>
              {t('Questions')}
            </bem.FormView__cellLabel>

            {this.props.asset.summary.row_count || 0}
          </bem.FormView__cell>

          <bem.FormView__cell m={['buttons', 'column-1']}>
            {!this.state.isPublic &&
              <button
                className='mdl-button mdl-button--raised mdl-button--colored'
                onClick={this.makePublic}
              >
                {t('Make public')}
              </button>
            }
            {this.state.isPublic &&
              <button
                className='mdl-button mdl-button--raised mdl-button--colored'
                onClick={this.makePrivate}
              >
                {t('Make private')}
              </button>
            }
          </bem.FormView__cell>
        </bem.FormView__cell>

        <bem.FormView__cell m={['columns', 'padding', 'bordertop']}>
          <bem.FormView__cell m={['organization', 'column-1']}>
            <bem.FormView__cellLabel>
              {t('Organization')}
            </bem.FormView__cellLabel>

            {this.props.asset.settings.organization || t('n/a')}
          </bem.FormView__cell>

          <bem.FormView__cell m={['tags', 'column-1']}>
            <bem.FormView__cellLabel>
              {t('Tags')}
            </bem.FormView__cellLabel>

            {this.props.asset.settings.tags && this.props.asset.settings.tags.join(', ') || t('n/a')}
          </bem.FormView__cell>

          <bem.FormView__cell m={['sector', 'column-1']}>
            <bem.FormView__cellLabel>
              {t('Sector')}
            </bem.FormView__cellLabel>

            {this.props.asset.settings.sector && this.props.asset.settings.sector.value || t('n/a')}
          </bem.FormView__cell>

          <bem.FormView__cell m={['country', 'column-1']}>
            <bem.FormView__cellLabel>
              {t('Country')}
            </bem.FormView__cellLabel>

            {this.props.asset.settings.country && this.props.asset.settings.country.value || t('n/a')}
          </bem.FormView__cell>
        </bem.FormView__cell>

        {this.state.areDetailsVisible &&
          <React.Fragment>
            <bem.FormView__cell m={['columns', 'padding', 'bordertop']}>
              <bem.FormView__cell m={['languages', 'column-1']}>
                <bem.FormView__cellLabel>
                  {t('Languages')}
                </bem.FormView__cellLabel>

                langs
              </bem.FormView__cell>
<commit_msg>display languages in asset info box<commit_after>import React from 'react';
import autoBind from 'react-autobind';
import bem from 'js/bem';
import {
  t,
  formatTime
} from 'js/utils';
import {ASSET_TYPES} from 'js/constants';

class AssetInfoBox extends React.Component {
  constructor(props){
    super(props);
    this.state = {
      isPublic: false,
      areDetailsVisible: false
    };
    autoBind(this);
  }

  componentDidMount() {
    console.debug('AssetInfoBox did mount', this.props);
  }

  toggleDetails() {
    this.setState({areDetailsVisible: !this.state.areDetailsVisible});
  }

  makePublic() {
    // 1. check if all required properties filled up
    // 2. make public
    this.setState({isPublic: true});
  }

  makePrivate() {
    // 1. make private
    this.setState({isPublic: false});
  }

  render() {
    if (!this.props.asset) {
      return null;
    }

    return (
      <bem.FormView__cell m='box'>
        <bem.FormView__cell m={['columns', 'padding']}>
          <bem.FormView__cell m={['date', 'column-1']}>
            <bem.FormView__cellLabel>
              {t('Last Modified')}
            </bem.FormView__cellLabel>

            {formatTime(this.props.asset.date_modified)}
          </bem.FormView__cell>

          <bem.FormView__cell m={['questions', 'column-1']}>
            <bem.FormView__cellLabel>
              {t('Questions')}
            </bem.FormView__cellLabel>

            {this.props.asset.summary.row_count || 0}
          </bem.FormView__cell>

          <bem.FormView__cell m={['buttons', 'column-1']}>
            {!this.state.isPublic &&
              <button
                className='mdl-button mdl-button--raised mdl-button--colored'
                onClick={this.makePublic}
              >
                {t('Make public')}
              </button>
            }
            {this.state.isPublic &&
              <button
                className='mdl-button mdl-button--raised mdl-button--colored'
                onClick={this.makePrivate}
              >
                {t('Make private')}
              </button>
            }
          </bem.FormView__cell>
        </bem.FormView__cell>

        <bem.FormView__cell m={['columns', 'padding', 'bordertop']}>
          <bem.FormView__cell m={['organization', 'column-1']}>
            <bem.FormView__cellLabel>
              {t('Organization')}
            </bem.FormView__cellLabel>

            {this.props.asset.settings.organization || t('n/a')}
          </bem.FormView__cell>

          <bem.FormView__cell m={['tags', 'column-1']}>
            <bem.FormView__cellLabel>
              {t('Tags')}
            </bem.FormView__cellLabel>

            {this.props.asset.settings.tags && this.props.asset.settings.tags.join(', ') || t('n/a')}
          </bem.FormView__cell>

          <bem.FormView__cell m={['sector', 'column-1']}>
            <bem.FormView__cellLabel>
              {t('Sector')}
            </bem.FormView__cellLabel>

            {this.props.asset.settings.sector && this.props.asset.settings.sector.value || t('n/a')}
          </bem.FormView__cell>

          <bem.FormView__cell m={['country', 'column-1']}>
            <bem.FormView__cellLabel>
              {t('Country')}
            </bem.FormView__cellLabel>

            {this.props.asset.settings.country && this.props.asset.settings.country.value || t('n/a')}
          </bem.FormView__cell>
        </bem.FormView__cell>

        {this.state.areDetailsVisible &&
          <React.Fragment>
            <bem.FormView__cell m={['columns', 'padding', 'bordertop']}>
              <bem.FormView__cell m={['languages', 'column-1']}>
                <bem.FormView__cellLabel>
                  {t('Languages')}
                </bem.FormView__cellLabel>

                {this.props.asset.content.translations && this.props.asset.content.translations.join(', ') || t('n/a')}
              </bem.FormView__cell>

{'fraction_non_alphanumeric': 0.15202177293934682, 'fraction_numerical': 0.003110419906687403, 'mean_word_length': 1.9175803402646503, 'pattern_counts': {'":': 0, '<': 85, '<?xml version=': 0, '>': 85, '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': '6977044', 'n_tokens_mistral': 2467, 'n_tokens_neox': 2384, 'n_words': 349}