<commit_before>import React from 'react';
import { PropTypes } from 'prop-types';
import { withStyles } from '@material-ui/core/styles';
import List from '@material-ui/core/List';
import Tag from '../../models/Tag';
import TagListItemView from './widgets/TagListItemView';
import TagListFilterButtonsView from './widgets/TagListFilterButtonsView';
import { tagListStyles } from './styles/TagListStyles';

const mapTagToTagListItem = (tag, selectedTag, onSelectTag) => (
  <TagListItemView tag={tag} key={tag.name} onSelectTag={onSelectTag} isSelected={tag === selectedTag} />
);

const renderList = (tags, selectedTag, onSelectTag) => (
  <List component="ul">{tags.map(tag => mapTagToTagListItem(tag, selectedTag, onSelectTag))}</List>
);

const TagListView = props => (
  <div className={props.classes.xbddTagListContainer}>
    <TagListFilterButtonsView filterStates={props.filterStates} onFilterButtonClick={props.onFilterButtonClick} />
    <div className={props.classes.xbddTagList}>{renderList(props.tags, props.selectedTag, props.onSelectTag)}</div>
  </div>
);

TagListView.propTypes = {
  tags: PropTypes.arrayOf(PropTypes.instanceOf(Tag)),
  selectedTag: PropTypes.instanceOf(Tag),
  filterStates: PropTypes.shape({}).isRequired,
  onSelectTag: PropTypes.func,
  onFilterButtonClick: PropTypes.func,
  classes: PropTypes.shape({
    xbddTagListContainer: PropTypes.string,
    xbddTagList: PropTypes.string,
  }).isRequired,
};

TagListView.defaultProps = {
  tags: [],
  selectedTag: null,
  onSelectTag: () => {},
  onFilterButtonClick: () => {},
};

export default withStyles(tagListStyles)(TagListView);
<commit_msg>Handle the case when no tags match the selected filters. Previously an empty box would show, now it will hide the results container.<commit_after>import React from 'react';
import { PropTypes } from 'prop-types';
import { withStyles } from '@material-ui/core/styles';
import List from '@material-ui/core/List';
import Tag from '../../models/Tag';
import TagListItemView from './widgets/TagListItemView';
import TagListFilterButtonsView from './widgets/TagListFilterButtonsView';
import { tagListStyles } from './styles/TagListStyles';

const mapTagToTagListItem = (tag, selectedTag, onSelectTag) => (
  <TagListItemView tag={tag} key={tag.name} onSelectTag={onSelectTag} isSelected={tag === selectedTag} />
);

const renderList = (className, tags, selectedTag, onSelectTag) => {
  if (!tags.length) {
    return null;
  }
  return (
    <div className={className}>
      <List component="ul">{tags.map(tag => mapTagToTagListItem(tag, selectedTag, onSelectTag))}</List>
    </div>
  );
};

const TagListView = props => (
  <div className={props.classes.xbddTagListContainer}>
    <TagListFilterButtonsView filterStates={props.filterStates} onFilterButtonClick={props.onFilterButtonClick} />
    {renderList(props.classes.xbddTagList, props.tags, props.selectedTag, props.onSelectTag)}
  </div>
);

TagListView.propTypes = {
  tags: PropTypes.arrayOf(PropTypes.instanceOf(Tag)),
  selectedTag: PropTypes.instanceOf(Tag),
  filterStates: PropTypes.shape({}).isRequired,
  onSelectTag: PropTypes.func,
  onFilterButtonClick: PropTypes.func,
  classes: PropTypes.shape({
    xbddTagListContainer: PropTypes.string,
    xbddTagList: PropTypes.string,
  }).isRequired,
};

TagListView.defaultProps = {
  tags: [],
  selectedTag: null,
  onSelectTag: () => {},
  onFilterButtonClick: () => {},
};

export default withStyles(tagListStyles)(TagListView);

{'fraction_non_alphanumeric': 0.14240506329113925, 'fraction_numerical': 0.0, 'mean_word_length': 5.597722960151803, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 31, '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': '5277276', 'n_tokens_mistral': 1050, 'n_tokens_neox': 1068, 'n_words': 217}