<commit_before>import React, { useContext } from "react";
import { UserContext } from "~/components/common/UserContext";
import { PATHOGEN_LABEL_V0_FEATURE } from "~/components/utils/features";
import BasicPopup from "../../BasicPopup";
import Label from "../../ui/labels/Label";
import { CATEGORIES } from "../../ui/labels/PathogenLabel";

const PathogenPreview = ({ tag2Count }) => {
  const userContext = useContext(UserContext);
  const { allowedFeatures } = userContext || {};

  let tags = Object.keys(tag2Count).sort();
  if (tags.length === 0) {
    return null;
  } else {
    let totalCount = Object.values(tag2Count).reduce((a, b) => a + b);
    let display = (
      <span className="idseq-ui pathogen-preview">
        {tags.map(type => {
          return allowedFeatures.includes(PATHOGEN_LABEL_V0_FEATURE) ? (
            <Label circular color="red" key={type} />
          ) : (
            <Label circular color={CATEGORIES[type]["color"]} key={type} />
          );
        })}
        <span className="pathogen-count">{totalCount}</span>
      </span>
    );
    return allowedFeatures.includes(PATHOGEN_LABEL_V0_FEATURE) ? (
      <BasicPopup
        trigger={display}
        content="Contains flagged pathogen species."
        basic={false}
        inverted={false}
        position="top center"
      />
    ) : (
      <BasicPopup
        trigger={display}
        content="Contains flagged pathogen species"
        basic={false}
      />
    );<commit_msg>[Release fix] Remove duplicate pathogen preview labels<commit_after>import React, { useContext } from "react";
import { UserContext } from "~/components/common/UserContext";
import { PATHOGEN_LABEL_V0_FEATURE } from "~/components/utils/features";
import BasicPopup from "../../BasicPopup";
import Label from "../../ui/labels/Label";
import { CATEGORIES } from "../../ui/labels/PathogenLabel";

const PathogenPreview = ({ tag2Count }) => {
  const userContext = useContext(UserContext);
  const { allowedFeatures } = userContext || {};

  let tags = Object.keys(tag2Count).sort();
  if (tags.length === 0) {
    return null;
  } else {
    let totalCount = Object.values(tag2Count).reduce((a, b) => a + b);
    let display = (
      <span className="idseq-ui pathogen-preview">
        {allowedFeatures.includes(PATHOGEN_LABEL_V0_FEATURE) ? (
          <Label circular color="red" />
        ) : (
          tags.map(type => {
            return (
              <Label circular color={CATEGORIES[type]["color"]} key={type} />
            );
          })
        )}
        <span className="pathogen-count">{totalCount}</span>
      </span>
    );
    return allowedFeatures.includes(PATHOGEN_LABEL_V0_FEATURE) ? (
      <BasicPopup
        trigger={display}
        content="Contains flagged pathogen species."
        basic={false}
        inverted={false}
        position="top center"
      />
    ) : (
      <BasicPopup
        trigger={display}
        content="Contains flagged pathogen species"
        basic={false}
      />
    );
{'fraction_non_alphanumeric': 0.14659166115155525, 'fraction_numerical': 0.004632693580410324, 'mean_word_length': 2.6509661835748792, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 25, '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': '5393309', 'n_tokens_mistral': 882, 'n_tokens_neox': 883, 'n_words': 179}