import styled from '@emotion/styled'; import type { CorrelationData } from 'nmr-processing'; import { correlationApi } from 'nmr-processing'; import { memo } from 'react'; import { ErrorColors, Errors } from './CorrelationTable/Constants.js'; const Container = styled.div` display: flex; font-size: 15px; font-weight: 300; white-space: nowrap; width: 100%; span { margin-left: 8px; } `; interface OverviewProps { correlationsData: CorrelationData; } function Overview({ correlationsData }: OverviewProps) { const atoms = correlationApi.getAtomCounts(correlationsData.options.mf || ''); const elements = Object.keys(atoms).length > 0 ? ( Object.keys(atoms).map((atomType, i) => { const stateAtomType = correlationsData.state[atomType]; const error = stateAtomType ? stateAtomType.error : undefined; const errorColorIndex = error ? Errors.findIndex((_error) => error[_error] !== undefined) : -1; return ( = 0 ? ErrorColors[errorColorIndex].color : 'black' : 'black', }} > {`${atomType}: ${stateAtomType ? stateAtomType.current : '-'}/${ atoms[atomType] } `} ); }) ) : (

Molecular formula is not set

); return {elements}; } export default memo(Overview);