Skip to content

Commit f7c0333

Browse files
authored
fix: empty NMRshiftDB signals layout (#299)
- Show a clear empty-state message instead of blank space. - Let the section height grow automatically when signals are present.
1 parent cd1fcd9 commit f7c0333

1 file changed

Lines changed: 24 additions & 6 deletions

File tree

src/components/panel/info.js

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,16 @@ const styles = () => ({
6969
},
7070
rowOddSim: {
7171
backgroundColor: '#fff',
72-
height: 108,
72+
height: 'auto',
73+
minHeight: 36,
7374
lineHeight: '24px',
74-
overflowY: 'hidden',
75+
overflow: 'visible',
7576
overflowWrap: 'word-break',
7677
},
78+
simPlaceholder: {
79+
color: 'rgba(0, 0, 0, 0.54)',
80+
fontStyle: 'italic',
81+
},
7782
tHead: {
7883
fontWeight: 'bold',
7984
float: 'left',
@@ -110,8 +115,13 @@ const simTitle = () => (
110115
'Simulated signals from NMRshiftDB'
111116
);
112117

113-
const simContent = (nmrSimPeaks) => (
114-
nmrSimPeaks && nmrSimPeaks.sort((a, b) => a - b).join(', ')
118+
const simContent = (nmrSimPeaks) => {
119+
if (!Array.isArray(nmrSimPeaks) || nmrSimPeaks.length === 0) return '';
120+
return [...nmrSimPeaks].sort((a, b) => a - b).join(', ');
121+
};
122+
123+
const simPlaceholder = () => (
124+
'No simulated signals available.'
115125
);
116126

117127
const normalizeQuillValue = (val) => {
@@ -300,6 +310,7 @@ const InfoPanel = ({
300310
if (integration) {
301311
originStack = integration.originStack; // eslint-disable-line
302312
}
313+
const simulatedSignals = simContent(simulationSt.nmrSimPeaks);
303314

304315
return (
305316
<Accordion
@@ -413,8 +424,15 @@ const InfoPanel = ({
413424
{ simTitle() }
414425
</div>
415426
<div className={classNames(classes.rowRoot, classes.rowOddSim)}>
416-
<span className={classNames(classes.tTxt, classes.tTxtSim, 'txt-sv-panel-txt')}>
417-
{ simContent(simulationSt.nmrSimPeaks) }
427+
<span
428+
className={classNames(
429+
classes.tTxt,
430+
classes.tTxtSim,
431+
!simulatedSignals && classes.simPlaceholder,
432+
'txt-sv-panel-txt',
433+
)}
434+
>
435+
{ simulatedSignals || simPlaceholder() }
418436
</span>
419437
</div>
420438
</>

0 commit comments

Comments
 (0)