<commit_before>import React from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
import AbbrReplace, { replaceStringAbbr } from 'components/abbr-replace';
import layout from 'styles/layout.scss';
import PreviousSubmissionIcon from 'components/previous-submission-icon';
import ReactTooltip from 'react-tooltip';
import styles from './compare-definition-list-styles.scss';

const FEATURE_ENHANCEMENT_CHANGES =
  process.env.FEATURE_ENHANCEMENT_CHANGES === 'true';

const renderComparisonWithPreviousNDCIcon = value => (
  <div>
    <PreviousSubmissionIcon
      value={value}
      tooltipId="definition-icon"
      className={styles.indicatorIcon}
    />
    <ReactTooltip id="definition-icon" />
  </div>
);

const DefinitionList = ({
  className,
  title: sectionTitle,
  definitions,
  compare,
  comparisonWithPreviousNDC
}) => (
  <dl className={className} key={sectionTitle}>
    {definitions &&
      definitions.map(({ slug, title, descriptions }) => (
        <div className={styles.definitionRow} key={slug}>
          <div
            key={`${slug}-${title}-${sectionTitle}`}
            className={cx(
              layout.content,
              compare ? styles.definitionCompare : styles.definition
            )}
          >
            <dt className={styles.definitionTitle}>
              <AbbrReplace>{title}</AbbrReplace>:
            </dt>
            {descriptions &&
              descriptions.map(({ iso, value }) => (
                <dd key={`${slug}-${iso}`} className={styles.definitionDesc}>
                  {compare && value === '-' ? (
                    <div className={styles.noComparable}>
                      No comparable data available
                    </div>
                  ) : (
                    <div className={styles.value}>
                      {FEATURE_ENHANCEMENT_CHANGES &&
                        comparisonWithPreviousNDC &&
                        renderComparisonWithPreviousNDCIcon(value)}
                      <div
                        // eslint-disable-next-line react/no-danger
                        dangerouslySetInnerHTML={{
                          __html: replaceStringAbbr(value)
                        }}
                      />
                    </div>
                  )}
                </dd>
              ))}
          </div>
        </div>
      ))}
  </dl>
);

DefinitionList.propTypes = {
  className: PropTypes.string,
  title: PropTypes.string,
  definitions: PropTypes.array,
  comparisonWithPreviousNDC: PropTypes.bool,
  compare: PropTypes.bool
};

export default DefinitionList;<commit_msg>Remove compare prop and always use definitionCompare class<commit_after>import React from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
import AbbrReplace, { replaceStringAbbr } from 'components/abbr-replace';
import layout from 'styles/layout.scss';
import PreviousSubmissionIcon from 'components/previous-submission-icon';
import ReactTooltip from 'react-tooltip';
import styles from './compare-definition-list-styles.scss';

const FEATURE_ENHANCEMENT_CHANGES =
  process.env.FEATURE_ENHANCEMENT_CHANGES === 'true';

const renderComparisonWithPreviousNDCIcon = value => (
  <div>
    <PreviousSubmissionIcon
      value={value}
      tooltipId="definition-icon"
      className={styles.indicatorIcon}
    />
    <ReactTooltip id="definition-icon" />
  </div>
);

const CompareDefinitionList = ({
  className,
  title: sectionTitle,
  definitions,
  comparisonWithPreviousNDC
}) => (
  <dl className={className} key={sectionTitle}>
    {definitions &&
      definitions.map(({ slug, title, descriptions }) => (
        <div className={styles.definitionRow} key={slug}>
          <div
            key={`${slug}-${title}-${sectionTitle}`}
            className={cx(layout.content, styles.definitionCompare)}
          >
            <dt className={styles.definitionTitle}>
              <AbbrReplace>{title}</AbbrReplace>:
            </dt>
            {descriptions &&
              descriptions.map(({ iso, value }) => (
                <dd key={`${slug}-${iso}`} className={styles.definitionDesc}>
                  {value === '-' ? (
                    <div className={styles.noComparable}>
                      No comparable data available
                    </div>
                  ) : (
                    <div className={styles.value}>
                      {FEATURE_ENHANCEMENT_CHANGES &&
                        comparisonWithPreviousNDC &&
                        renderComparisonWithPreviousNDCIcon(value)}
                      <div
                        // eslint-disable-next-line react/no-danger
                        dangerouslySetInnerHTML={{
                          __html: replaceStringAbbr(value)
                        }}
                      />
                    </div>
                  )}
                </dd>
              ))}
          </div>
        </div>
      ))}
  </dl>
);

CompareDefinitionList.propTypes = {
  className: PropTypes.string,
  title: PropTypes.string,
  definitions: PropTypes.array,
  comparisonWithPreviousNDC: PropTypes.bool
};

export default CompareDefinitionList;
{'fraction_non_alphanumeric': 0.11690821256038647, 'fraction_numerical': 0.0, 'mean_word_length': 1.9627933600457927, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 53, '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': '2774688', 'n_tokens_mistral': 1335, 'n_tokens_neox': 1323, 'n_words': 247}