import React from "react"; import { FaChevronRight, FaChevronDown } from "react-icons/fa"; import Gene from "./gene"; import Truncate from "../util/truncate"; import * as globals from "../../globals"; import GenesetMenus from "./menus/genesetMenus"; import EditGenesetNameDialogue from "./menus/editGenesetNameDialogue"; import HistogramBrush from "../brushableHistogram"; import { diffexpPopNamePrefix1, diffexpPopNamePrefix2 } from "../../globals"; type State = any; class GeneSet extends React.Component<{}, State> { constructor(props: {}) { super(props); this.state = { isOpen: false, }; } onGenesetMenuClick = () => { const { isOpen } = this.state; this.setState({ isOpen: !isOpen }); }; renderGenes() { // @ts-expect-error ts-migrate(2339) FIXME: Property 'setName' does not exist on type 'Readonl... Remove this comment to see the full error message const { setName, setGenes } = this.props; const setGenesNames = [...setGenes.keys()]; return (
{setGenesNames.map((gene) => { const { geneDescription } = setGenes.get(gene); return ( ); })}
); } render() { // @ts-expect-error ts-migrate(2339) FIXME: Property 'setName' does not exist on type 'Readonl... Remove this comment to see the full error message const { setName, genesetDescription, setGenes } = this.props; const { isOpen } = this.state; const genesetNameLengthVisible = 150; /* this magic number determines how much of a long geneset name we see */ const genesetIsEmpty = setGenes.size === 0; let testClass = "geneset-expand"; if (setName.includes(diffexpPopNamePrefix1)) testClass = "pop-1-geneset-expand"; else if (setName.includes(diffexpPopNamePrefix2)) testClass = "pop-2-geneset-expand"; return (
{} } style={{ cursor: "pointer", userSelect: "none", }} onClick={this.onGenesetMenuClick} > {setName} {isOpen ? ( ) : ( )}
{/* @ts-expect-error ts-migrate(2322) FIXME: Type '{ isOpen: any; genesetsEditable: true; genes... Remove this comment to see the full error message */}
{isOpen && genesetIsEmpty && (

No genes to display

)}
{isOpen && !genesetIsEmpty && ( )} {isOpen && !genesetIsEmpty && this.renderGenes()}
); } } export default GeneSet;