File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -597,15 +597,28 @@ export const Controls: React.FC<ControlsProps> = ({
597597 </ div >
598598 ) }
599599
600- { /* Source / ID */ }
600+ { /* Structure Image or Source */ }
601601 < div
602602 className = { `pt-1 border-t border-neutral-200 dark:border-neutral-800 ${ ( pdbMetadata . formula || pdbMetadata . molecularWeight ) ? 'pl-2 border-l' : '' } ` }
603603 style = { { borderTopStyle : 'dashed' } }
604604 >
605- < span className = { `text-[9px] font-bold uppercase tracking-wider block ${ subtleText } ` } > Source</ span >
606- < span className = { `text-[10px] font-medium block ${ isLightMode ? 'text-neutral-800' : 'text-neutral-200' } ` } >
607- { pdbMetadata . title }
605+ < span className = { `text-[9px] font-bold uppercase tracking-wider block ${ subtleText } ` } >
606+ { pdbMetadata . cid ? 'Structure' : 'Source' }
608607 </ span >
608+
609+ { pdbMetadata . cid ? (
610+ < div className = "mt-1 bg-white p-1 rounded-sm flex justify-center border border-neutral-200" >
611+ < img
612+ src = { `https://pubchem.ncbi.nlm.nih.gov/image/imgsrv.fcgi?cid=${ pdbMetadata . cid } &t=l` }
613+ alt = "2D Structure"
614+ className = "h-20 w-auto object-contain mix-blend-multiply"
615+ />
616+ </ div >
617+ ) : (
618+ < span className = { `text-[10px] font-medium block ${ isLightMode ? 'text-neutral-800' : 'text-neutral-200' } ` } >
619+ { pdbMetadata . title }
620+ </ span >
621+ ) }
609622 </ div >
610623 </ >
611624 ) }
Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ export interface PDBMetadata {
8484 title ?: string ;
8585 formula ?: string ; // Chemical Formula
8686 molecularWeight ?: number ; // Molecular Weight
87+ cid ?: string ; // PubChem CID for 2D Image
8788}
8889
8990export interface LigandInteraction {
Original file line number Diff line number Diff line change @@ -96,7 +96,8 @@ export const fetchPubChemMetadata = async (cid: string): Promise<PDBMetadata | n
9696 depositionDate : 'N/A' ,
9797 title : props . IUPACName || props . Title || `PubChem CID ${ cid } ` ,
9898 formula : props . MolecularFormula ,
99- molecularWeight : props . MolecularWeight ? parseFloat ( props . MolecularWeight ) : undefined
99+ molecularWeight : props . MolecularWeight ? parseFloat ( props . MolecularWeight ) : undefined ,
100+ cid : cid
100101 } ;
101102 } catch ( e ) {
102103 console . warn ( "PubChem metadata fetch failed" , e ) ;
You can’t perform that action at this time.
0 commit comments