<commit_before>import React from 'react';
import SkyLight from 'react-skylight';

class PopupShowCode extends React.Component {
  constructor(props) {
    super(props);

    this.popup = null;

    this.assignPopupRef = this.assignPopupRef.bind(this);
  }
  componentWillReceiveProps(nextProps) {
    if (!this.props.isVisible && nextProps.isVisible) {
      this.show();
    }
  }

  show() {
    if (this.popup) {
      this.popup.show();
    }
  }

  hide() {
    if (this.popup) {
      this.popup.hide();
    }
  }

  assignPopupRef(ref) {
    this.popup = ref;
  }

  render() {
    return (
      <SkyLight
        hideOnOverlayClicked
        dialogStyles={{
          height: 'auto',
        }}
        ref={this.assignRef}
        title="Transpiled code:"
        afterClose={this.props.onClose}
      >
        <textarea
          className="PopupShowCode-codebox"
          value={this.props.code}
          readOnly
        />
        <p>
          This code could be uploaded onto your device.<br />
          Just connect your device via USB and click on &quot;Upload&quot; button.
        </p>
      </SkyLight>
    );
  }
}

PopupShowCode.defaultProps = {
  isVisible: false,
  code: '',<commit_msg>fix(xod-client): fix error in assigning ref in PopupShowCode component<commit_after>import React from 'react';
import SkyLight from 'react-skylight';

class PopupShowCode extends React.Component {
  constructor(props) {
    super(props);

    this.popup = null;

    this.assignPopupRef = this.assignPopupRef.bind(this);
  }
  componentWillReceiveProps(nextProps) {
    if (!this.props.isVisible && nextProps.isVisible) {
      this.show();
    }
  }

  show() {
    if (this.popup) {
      this.popup.show();
    }
  }

  hide() {
    if (this.popup) {
      this.popup.hide();
    }
  }

  assignPopupRef(ref) {
    this.popup = ref;
  }

  render() {
    return (
      <SkyLight
        hideOnOverlayClicked
        dialogStyles={{
          height: 'auto',
        }}
        ref={this.assignPopupRef}
        title="Transpiled code:"
        afterClose={this.props.onClose}
      >
        <textarea
          className="PopupShowCode-codebox"
          value={this.props.code}
          readOnly
        />
        <p>
          This code could be uploaded onto your device.<br />
          Just connect your device via USB and click on &quot;Upload&quot; button.
        </p>
      </SkyLight>
    );
  }
}

PopupShowCode.defaultProps = {
  isVisible: false,
  code: '',
{'fraction_non_alphanumeric': 0.12349639133921411, 'fraction_numerical': 0.0, 'mean_word_length': 2.103233830845771, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '6124986', 'n_tokens_mistral': 796, 'n_tokens_neox': 789, 'n_words': 158}