import * as React from 'react'; import PdbHeaderCache from '../cache/PdbHeaderCache'; import { observer } from 'mobx-react'; import { TableCellStatusIndicator, TableCellStatus, } from 'cbioportal-frontend-commons'; import { generatePdbInfoSummary } from '../lib/PdbUtils'; import TextExpander from './TextExpander'; export interface IPdbChainInfoProps { pdbId: string; chainId: string; cache?: PdbHeaderCache; truncateText?: boolean; summaryFormat?: boolean; } @observer export default class PdbChainInfo extends React.Component< IPdbChainInfoProps, {} > { render() { let pdbInfo = null; let moleculeInfo = null; if (this.props.cache) { const cacheData = this.props.cache.get(this.props.pdbId); if (cacheData === null) { pdbInfo = ( ); moleculeInfo = ( ); } else if (cacheData.status === 'error') { pdbInfo = ( ); moleculeInfo = ( ); } else if (cacheData.data === null) { pdbInfo = ( ); moleculeInfo = ( ); } else { const summary = generatePdbInfoSummary( cacheData.data, this.props.chainId ); pdbInfo = summary.pdbInfo; moleculeInfo = summary.moleculeInfo; } } return (
{this.props.summaryFormat ? 'pdb' : 'PDB'} {!this.props.summaryFormat && ( {this.props.pdbId} )} :
{this.props.truncateText ? ( ) : ( {pdbInfo} )}
{this.props.summaryFormat ? 'chain' : 'Chain'} {!this.props.summaryFormat && ( {this.props.chainId} )} :
{this.props.truncateText ? ( ) : ( {moleculeInfo} )}
); } }