Skip to content

Commit

Permalink
refactor: use ActiveSpectrum type from mmr-load-save
Browse files Browse the repository at this point in the history
  • Loading branch information
hamed-musallam committed Nov 29, 2023
1 parent 9c9b1e3 commit a2e11c6
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 24 deletions.
3 changes: 1 addition & 2 deletions src/component/1d/FooterBanner.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** @jsxImportSource @emotion/react */
import { css } from '@emotion/react';
import { xFindClosestIndex } from 'ml-spectra-processing';
import { Spectrum1D } from 'nmr-load-save';
import { ActiveSpectrum, Spectrum1D } from 'nmr-load-save';
import { memo } from 'react';
import { BsCursor } from 'react-icons/bs';
import { IoPulseSharp } from 'react-icons/io5';
Expand All @@ -14,7 +14,6 @@ import { useScaleChecked } from '../context/ScaleContext';
import { useActiveSpectrum } from '../hooks/useActiveSpectrum';
import { useFormatNumberByNucleus } from '../hooks/useFormatNumberByNucleus';
import useSpectrum from '../hooks/useSpectrum';
import { ActiveSpectrum } from '../reducer/Reducer';

const styles = css`
display: flex;
Expand Down
3 changes: 1 addition & 2 deletions src/component/modal/MultipletAnalysisModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
import { css } from '@emotion/react';
import { xGetFromToIndex, xyToXYObject } from 'ml-spectra-processing';
import { analyseMultiplet } from 'multiplet-analysis';
import { Spectrum } from 'nmr-load-save';
import { ActiveSpectrum, Spectrum } from 'nmr-load-save';
import { useState, useEffect } from 'react';
import { Plot, LineSeries, Axis } from 'react-plot';
import { Modal } from 'react-science/ui';

import { isSpectrum2D } from '../../data/data2d/Spectrum2D';
import { ActiveSpectrum } from '../reducer/Reducer';

const styles = css`
button:focus {
Expand Down
4 changes: 2 additions & 2 deletions src/component/panels/SpectrumsPanel/SpectraPanelHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SvgNmrSameTop, SvgNmrResetScale } from 'cheminfo-font';
import { Spectrum, Spectrum2D } from 'nmr-load-save';
import { ActiveSpectrum, Spectrum, Spectrum2D } from 'nmr-load-save';
import { memo, useCallback } from 'react';
import {
FaCreativeCommonsSamplingPlus,
Expand All @@ -15,7 +15,7 @@ import { useAlert } from '../../elements/popup/Alert';
import { useModal } from '../../elements/popup/Modal';
import { useActiveSpectra } from '../../hooks/useActiveSpectra';
import useSpectrum from '../../hooks/useSpectrum';
import { ActiveSpectrum, DisplayerMode } from '../../reducer/Reducer';
import { DisplayerMode } from '../../reducer/Reducer';
import { getSpectraByNucleus } from '../../utility/getSpectraByNucleus';
import DefaultPanelHeader from '../header/DefaultPanelHeader';
import { SpectraAutomaticPickingButton } from '../header/SpectraAutomaticPickingButton';
Expand Down
2 changes: 1 addition & 1 deletion src/component/panels/SpectrumsPanel/SpectraTable.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import lodashGet from 'lodash/get';
import {
ActiveSpectrum,
JpathTableColumn,
PredefinedSpectraColumn,
PredefinedTableColumn,
Expand All @@ -18,7 +19,6 @@ import ReactTable, { Column } from '../../elements/ReactTable/ReactTable';
import { useAlert } from '../../elements/popup/Alert';
import { usePanelPreferences } from '../../hooks/usePanelPreferences';
import ExportAsJcampModal from '../../modal/ExportAsJcampModal';
import { ActiveSpectrum } from '../../reducer/Reducer';

import ColorIndicator from './base/ColorIndicator';
import ShowHideSpectrumButton, {
Expand Down
3 changes: 1 addition & 2 deletions src/component/panels/SpectrumsPanel/SpectrumsTabs.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @jsxImportSource @emotion/react */
import { css } from '@emotion/react';
import { Spectrum } from 'nmr-load-save';
import { ActiveSpectrum, Spectrum } from 'nmr-load-save';
import { useState, useMemo, memo, useCallback } from 'react';

import { useChartData } from '../../context/ChartContext';
Expand All @@ -9,7 +9,6 @@ import { getModifiers } from '../../context/KeyModifierContext';
import IsotopesViewer from '../../elements/IsotopesViewer';
import Tab from '../../elements/Tab/Tab';
import Tabs from '../../elements/Tab/Tabs';
import { ActiveSpectrum } from '../../reducer/Reducer';
import groupByInfoKey from '../../utility/GroupByInfoKey';

import { SpectraTable } from './SpectraTable';
Expand Down
4 changes: 2 additions & 2 deletions src/component/panels/SummaryPanel/utilities/Utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ import {
Correlation,
Link,
} from 'nmr-correlation';
import { Spectrum2D, Spectrum } from 'nmr-load-save';
import { Spectrum2D, Spectrum, ActiveSpectrum } from 'nmr-load-save';

import DefaultPathLengths from '../../../../data/constants/DefaultPathLengths';
import {
findSignal2D,
findSpectrum,
} from '../../../../data/utilities/FindUtilities';
import isDefaultPathLength from '../../../modal/editZone/validation/isDefaultPathLength';
import { ActiveSpectrum, DisplayerMode } from '../../../reducer/Reducer';
import { DisplayerMode } from '../../../reducer/Reducer';
import { ErrorColors } from '../CorrelationTable/Constants';

function getAtomType(nucleus: string): string {
Expand Down
6 changes: 0 additions & 6 deletions src/component/reducer/Reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@ import * as ToolsActions from './actions/ToolsActions';
import * as ZonesActions from './actions/ZonesActions';
import { ZoomHistory } from './helper/ZoomHistoryManager';

export interface ActiveSpectrum {
id: string;
index: number;
selected: boolean;
}

export type DisplayerMode = '1D' | '2D';

export interface Pivot {
Expand Down
14 changes: 7 additions & 7 deletions src/component/reducer/actions/FiltersActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ import { v4 } from '@lukeed/uuid';
import { NmrData2DFt } from 'cheminfo-types';
import { current, Draft } from 'immer';
import { xFindClosestIndex } from 'ml-spectra-processing';
import { Spectrum, Spectrum1D, Spectrum2D } from 'nmr-load-save';
import {
ActiveSpectrum,
Spectrum,
Spectrum1D,
Spectrum2D,
} from 'nmr-load-save';
import {
Filters,
FiltersManager,
Expand All @@ -20,12 +25,7 @@ import { get2DXScale, get2DYScale } from '../../2d/utilities/scale';
import { options as Tools } from '../../toolbar/ToolTypes';
import { getSpectraByNucleus } from '../../utility/getSpectraByNucleus';
import nucleusToString from '../../utility/nucleusToString';
import {
ActiveSpectrum,
getInitialState,
State,
TraceDirection,
} from '../Reducer';
import { getInitialState, State, TraceDirection } from '../Reducer';
import zoomHistoryManager from '../helper/ZoomHistoryManager';
import { getActiveSpectrum } from '../helper/getActiveSpectrum';
import getRange from '../helper/getRange';
Expand Down

0 comments on commit a2e11c6

Please sign in to comment.