import { getSamplesProfiledStatus } from 'pages/patientView/PatientViewPageUtils'; import * as React from 'react'; import { FunctionComponent } from 'react'; import SampleManager from 'pages/patientView/SampleManager'; import { IGenePanelDataByProfileIdAndSample } from 'shared/lib/isSampleProfiled'; import { MolecularProfile } from 'cbioportal-ts-api-client'; import { AlterationTypeText } from 'shared/constants'; interface ISampleNotProfiledAlertProps { sampleManager: SampleManager; genePanelDataByMolecularProfileIdAndSampleId: IGenePanelDataByProfileIdAndSample; molecularProfiles: MolecularProfile[]; } const SampleNotProfiledAlert: FunctionComponent = ({ sampleManager, genePanelDataByMolecularProfileIdAndSampleId, molecularProfiles, }) => { const messages = molecularProfiles.reduce( (aggr: JSX.Element[], profile) => { const { notProfiledIds } = getSamplesProfiledStatus( sampleManager!.getActiveSampleIdsInOrder(), genePanelDataByMolecularProfileIdAndSampleId, profile.molecularProfileId ); if (notProfiledIds.length) { aggr.push(

{notProfiledIds.length > 1 ? 'Samples' : 'Sample'} {notProfiledIds.map(id => ( {sampleManager?.getComponentForSample(id)} ))}{' '} not profiled for{' '} {AlterationTypeText[profile.molecularAlterationType]}

); } return aggr; }, [] ); if (messages.length) { return (
{messages}
); } else { return null; } }; export default SampleNotProfiledAlert;