import * as React from 'react';
import { DefaultTooltip } from 'cbioportal-frontend-commons';
import { MolecularProfile, Mutation } from 'cbioportal-ts-api-client';
import { getSampleViewUrl } from '../../../api/urls';
export default class SampleColumnFormatter {
public static getTextValue(data: Mutation[]): string {
return SampleColumnFormatter.getData(data) || '';
}
public static getData(data: Mutation[]) {
if (data.length > 0) {
return data[0].sampleId;
} else {
return null;
}
}
public static renderFunction(
data: Mutation[],
molecularProfileIdToMolecularProfile?: {
[molecularProfileId: string]: MolecularProfile;
}
) {
const sampleId: string = SampleColumnFormatter.getTextValue(data);
let content = {sampleId};
if (molecularProfileIdToMolecularProfile) {
const profile =
molecularProfileIdToMolecularProfile[
data[0].molecularProfileId
];
const studyId = profile && profile.studyId;
if (studyId) {
content = (
{content}
);
}
}
return (
{sampleId}
}
placement="topLeft"
>
{content}
);
}
}