Skip to content

Commit

Permalink
feat: add Matrix generation options per nucleus in the View state
Browse files Browse the repository at this point in the history
  • Loading branch information
hamed-musallam committed Dec 23, 2022
1 parent 72c2fa7 commit 878910a
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/component/reducer/Reducer.ts
Expand Up @@ -9,6 +9,7 @@ import {
MoleculesView,
StateMoleculeExtended,
} from '../../data/molecules/Molecule';
import { MatrixViewState } from '../../data/types/view-state/MatrixViewState';
import { PeaksViewState } from '../../data/types/view-state/PeaksViewState';
import { UsedColors } from '../../types/UsedColors';
import { Spectra } from '../NMRium';
Expand Down Expand Up @@ -96,6 +97,7 @@ export interface ViewState {
molecules: MoleculesView;
ranges: Array<RangeToolState>;
zones: Array<ZoneToolState>;
matrixGeneration: MatrixViewState;
/**
* peaks view property
* where the key is the id of the spectrum
Expand Down Expand Up @@ -168,6 +170,7 @@ export const getInitialState = (): State => ({
zoom: {
levels: {},
},
matrixGeneration: {},
},
verticalAlign: {
align: 'bottom',
Expand Down
22 changes: 22 additions & 0 deletions src/data/types/common/Nucleus.ts
@@ -0,0 +1,22 @@
type Nuclei =
| '1H'
| '2H'
| '3H'
| '3He'
| '7Li'
| '13C'
| '14N'
| '15N'
| '17O'
| '19F'
| '23Na'
| '27Al'
| '29Si'
| '31P'
| '57Fe'
| '63Cu'
| '67Zn'
| '129Xe';

// eslint-disable-next-line @typescript-eslint/ban-types
export type Nucleus = Nuclei | `${Nuclei},${Nuclei}` | (string & {});
29 changes: 29 additions & 0 deletions src/data/types/view-state/MatrixViewState.ts
@@ -0,0 +1,29 @@
import { MatrixFilters } from '../../getDefaultMatrixFilters';
import { Nucleus } from '../common/Nucleus';
import { ExclusionZone } from '../data1d/ExclusionZone';

export interface MatrixOptions {
/**
* Matrix generation filters
* @default []
*
*/
filters: MatrixFilters;
/**
* Exclusion zones
* @default []
*/
exclusionsZones: ExclusionZone[];
/**
* range
*/
range: { from: number; to: number };

/**
* number of points
*/
numberOfPoints: number;
}

// eslint-disable-next-line @typescript-eslint/ban-types
export type MatrixViewState = Record<Nucleus, MatrixOptions> | {};

0 comments on commit 878910a

Please sign in to comment.