<commit_before>import PropTypes from 'prop-types';
import React from 'react';
import { connect } from 'react-redux';
import { compose } from 'redux';

import translate from 'core/i18n/translate';
import Card from 'ui/components/Card';
import {
  ADDON_TYPE_EXTENSION,
  ADDON_TYPE_DICT,
  ADDON_TYPE_LANG,
  ADDON_TYPE_THEME,
} from 'core/constants';

import './styles.scss';


export class SearchContextCardBase extends React.Component {
  static propTypes = {
    count: PropTypes.number,
    filters: PropTypes.object,
    i18n: PropTypes.object.isRequired,
    loading: PropTypes.bool.isRequired,
  }

  static defaultProps = {
    count: 0,
    filters: {},
  }

  render() {
    const { count, filters, i18n, loading } = this.props;
    const { query } = filters;
    const { addonType } = filters;

    let searchText;

    if (!loading && query && addonType) {
      if (addonType === ADDON_TYPE_EXTENSION) {
        searchText = i18n.sprintf(i18n.ngettext(
          '%(count)s extension found for "%(query)s"',
          '%(count)s extensions found for "%(query)s"',
          count), { count: i18n.formatNumber(count), query }
        );
      } else if (addonType === ADDON_TYPE_DICT) {
        searchText = i18n.sprintf(i18n.ngettext(
          '%(count)s dictionary found for "%(query)s"',
          '%(count)s dictionaries found for "%(query)s"',
          count), { count: i18n.formatNumber(count), query }
        );
      } else if (addonType === ADDON_TYPE_LANG) {
        searchText = i18n.sprintf(i18n.ngettext(
          '%(count)s language pack found for "%(query)s"',
          '%(count)s language packs found for "%(query)s"',
          count), { count: i18n.formatNumber(count), query }
        );
      } else if (addonType === ADDON_TYPE_THEME) {
        searchText = i18n.sprintf(i18n.ngettext(
          '%(count)s theme found for "%(query)s"',
          '%(count)s themes found for "%(query)s"',
          count), { count: i18n.formatNumber(count), query }
        );
      }
    } else if (!loading && query) {
      searchText = i18n.sprintf(i18n.ngettext(
        '%(count)s result for "%(query)s"',
        '%(count)s results for "%(query)s"',
        count), { count: i18n.formatNumber(count), query }
      );
    } else if (loading && query) {
      searchText = i18n.sprintf(i18n.gettext(
        'Searching for "%(query)s"'), { query });
    } else if (loading) {
      searchText = i18n.gettext('Loading add-ons');
    } else if (!loading && count === 0) {
      searchText = i18n.gettext('No add-ons found');<commit_msg>Add else block for searchText<commit_after>import PropTypes from 'prop-types';
import React from 'react';
import { connect } from 'react-redux';
import { compose } from 'redux';

import translate from 'core/i18n/translate';
import Card from 'ui/components/Card';
import {
  ADDON_TYPE_EXTENSION,
  ADDON_TYPE_DICT,
  ADDON_TYPE_LANG,
  ADDON_TYPE_THEME,
} from 'core/constants';

import './styles.scss';


export class SearchContextCardBase extends React.Component {
  static propTypes = {
    count: PropTypes.number,
    filters: PropTypes.object,
    i18n: PropTypes.object.isRequired,
    loading: PropTypes.bool.isRequired,
  }

  static defaultProps = {
    count: 0,
    filters: {},
  }

  render() {
    const { count, filters, i18n, loading } = this.props;
    const { query } = filters;
    const { addonType } = filters;

    let searchText;

    if (!loading && query && addonType) {
      if (addonType === ADDON_TYPE_EXTENSION) {
        searchText = i18n.sprintf(i18n.ngettext(
          '%(count)s extension found for "%(query)s"',
          '%(count)s extensions found for "%(query)s"',
          count), { count: i18n.formatNumber(count), query }
        );
      } else if (addonType === ADDON_TYPE_DICT) {
        searchText = i18n.sprintf(i18n.ngettext(
          '%(count)s dictionary found for "%(query)s"',
          '%(count)s dictionaries found for "%(query)s"',
          count), { count: i18n.formatNumber(count), query }
        );
      } else if (addonType === ADDON_TYPE_LANG) {
        searchText = i18n.sprintf(i18n.ngettext(
          '%(count)s language pack found for "%(query)s"',
          '%(count)s language packs found for "%(query)s"',
          count), { count: i18n.formatNumber(count), query }
        );
      } else if (addonType === ADDON_TYPE_THEME) {
        searchText = i18n.sprintf(i18n.ngettext(
          '%(count)s theme found for "%(query)s"',
          '%(count)s themes found for "%(query)s"',
          count), { count: i18n.formatNumber(count), query }
        );
      } else {
        searchText = i18n.sprintf(i18n.ngettext(
          '%(count)s result for "%(query)s"',
          '%(count)s results for "%(query)s"',
          count), { count: i18n.formatNumber(count), query }
        );
      }
    } else if (!loading && query) {
      searchText = i18n.sprintf(i18n.ngettext(
        '%(count)s result for "%(query)s"',
        '%(count)s results for "%(query)s"',
        count), { count: i18n.formatNumber(count), query }
      );
    } else if (loading && query) {
      searchText = i18n.sprintf(i18n.gettext(
        'Searching for "%(query)s"'), { query });
    } else if (loading) {
      searchText = i18n.gettext('Loading add-ons');
    } else if (!loading && count === 0) {
      searchText = i18n.gettext('No add-ons found');
{'fraction_non_alphanumeric': 0.14974855652821756, 'fraction_numerical': 0.018252933507170794, 'mean_word_length': 2.768421052631579, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5208024', 'n_tokens_mistral': 1826, 'n_tokens_neox': 1783, 'n_words': 410}