Skip to content

Commit

Permalink
feat: show/hide kind column in ranges panels
Browse files Browse the repository at this point in the history
close #1562
  • Loading branch information
hamed-musallam committed May 20, 2022
1 parent 5da8f24 commit 6c3899b
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 9 deletions.
6 changes: 6 additions & 0 deletions src/component/panels/RangesPanel/RangesPreferences.tsx
Expand Up @@ -77,6 +77,12 @@ const formatFields: NucleusPreferenceField[] = [
checkControllerName: 'coupling.show',
formatControllerName: 'coupling.format',
},
{
id: 8,
label: 'Kind :',
checkControllerName: 'showKind',
hideFormatField: true,
},
];

function RangesPreferences(props, ref) {
Expand Down
2 changes: 1 addition & 1 deletion src/component/panels/RangesPanel/RangesTable.tsx
Expand Up @@ -115,7 +115,7 @@ function RangesTable({
<FaLink style={{ fontSize: 10 }} />
</th>
<th>Σ</th>
<th>Kind</th>
{preferences.showKind && <th>Kind</th>}
<th>{''}</th>
</tr>
</thead>
Expand Down
1 change: 1 addition & 0 deletions src/component/panels/RangesPanel/RangesTableRow.tsx
Expand Up @@ -265,6 +265,7 @@ function RangesTableRow({
onHoverSignal={onHoverSignal}
onHoverRange={onHoverRange}
rowSpanTags={rowSpanTags}
showKind={preferences.showKind}
/>
</tr>
);
Expand Down
20 changes: 12 additions & 8 deletions src/component/panels/RangesPanel/TableColumns/ActionsColumn.tsx
Expand Up @@ -44,26 +44,30 @@ interface ActionsColumnProps {
onMouseEnter: () => void;
onMouseLeave: () => void;
};
showKind: boolean;
}

function ActionsColumn({
rowData,
onHoverSignal,
rowSpanTags,
showKind,
}: ActionsColumnProps) {
const { editRange, deleteRange, changeRangeSignalKind, zoomRange } =
useEditRangeModal(rowData);

return (
<Fragment>
<td {...onHoverSignal}>
<Select
onChange={changeRangeSignalKind}
data={SignalKinds}
defaultValue={rowData.tableMetaInfo.signal.kind}
style={selectBoxStyle}
/>
</td>
{showKind && (
<td {...onHoverSignal}>
<Select
onChange={changeRangeSignalKind}
data={SignalKinds}
defaultValue={rowData.tableMetaInfo.signal.kind}
style={selectBoxStyle}
/>
</td>
)}
<td {...rowSpanTags} css={styles}>
<button type="button" className="delete-button" onClick={deleteRange}>
<FaRegTrashAlt />
Expand Down
Expand Up @@ -36,6 +36,7 @@ const getRangeDefaultValues = (
deltaHz: { show: false, format: '0.00' },
coupling: { show: true, format: '0.00' },
jGraphTolerance: nucleus === '1H' ? 0.2 : nucleus === '13C' ? 2 : 0, //J Graph tolerance for: 1H: 0.2Hz 13C: 2Hz
showKind: true,
};

return getPreferences(preferences, nucleus);
Expand Down
1 change: 1 addition & 0 deletions src/component/workspaces/Workspace.ts
Expand Up @@ -42,6 +42,7 @@ interface RangesNucleusPreferences {
deltaHz: ColumnPreferences;
coupling: ColumnPreferences;
jGraphTolerance: number;
showKind: boolean;
}

interface PeaksNucleusPreferences {
Expand Down

0 comments on commit 6c3899b

Please sign in to comment.