import Tooltip from 'rc-tooltip'; import { ArticleAbstract, IndicatorQueryTreatment } from 'oncokb-ts-api-client'; import * as React from 'react'; import ReactTable from 'react-table'; import { getTumorTypeName, getTumorTypeNameWithExclusionInfo, } from '../util/OncoKbUtils'; import OncoKbHelper from './OncoKbHelper'; import { EvidenceReferenceContent } from './oncokbCard/EvidenceReferenceContent'; import mainStyles from './main.module.scss'; import './oncoKbTreatmentTable.scss'; type OncoKbTreatmentTableProps = { variant: string; treatments: IndicatorQueryTreatment[]; }; export const OncoKbTreatmentTable: React.FunctionComponent = ({ variant, treatments, }: OncoKbTreatmentTableProps) => { const levelTooltipContent = (level: string) => { return (
{OncoKbHelper.LEVEL_DESC[level]}
); }; const treatmentTooltipContent = ( abstracts: ArticleAbstract[], pmids: number[], description?: string ) => { return abstracts.length > 0 || pmids.length > 0 ? ( () => (
pmid.toString()), abstracts: abstracts, }} noInfoDisclaimer={ 'Mutation effect information is not available.' } />
) ) : ( ); }; const columns = [ OncoKbHelper.getDefaultColumnDefinition('level'), { ...OncoKbHelper.getDefaultColumnDefinition('alterations'), Cell: (props: { value: string[] }) => { return OncoKbHelper.getAlterationsColumnCell( props.value, variant ); }, }, { id: 'treatment', Header: Drug(s), accessor: 'drugs', Cell: (props: { original: IndicatorQueryTreatment }) => (
{props.original.drugs .map(drug => drug.drugName) .join(' + ')}
), }, { id: 'cancerType', Header: ( Level-associated
cancer type(s)
), accessor: 'levelAssociatedCancerType', minWidth: 120, Cell: (props: { original: IndicatorQueryTreatment }) => (
{getTumorTypeNameWithExclusionInfo( props.original.levelAssociatedCancerType, props.original.levelExcludedCancerTypes )}
), }, { id: 'referenceList', Header: , sortable: false, maxWidth: 25, Cell: (props: { original: IndicatorQueryTreatment }) => (props.original.abstracts.length > 0 || props.original.pmids.length > 0) && ( Number(pmid)), props.original.description )} placement="right" trigger={['hover', 'focus']} destroyTooltipOnHide={true} > ), }, ]; return (
); };