diff --git a/src/component/modal/AlignSpectraModal.tsx b/src/component/panels/MultipleSpectraAnalysisPanel/AlignSpectra.tsx similarity index 73% rename from src/component/modal/AlignSpectraModal.tsx rename to src/component/panels/MultipleSpectraAnalysisPanel/AlignSpectra.tsx index 263f565d9..b626c2a91 100644 --- a/src/component/modal/AlignSpectraModal.tsx +++ b/src/component/panels/MultipleSpectraAnalysisPanel/AlignSpectra.tsx @@ -1,24 +1,22 @@ /** @jsxImportSource @emotion/react */ +import { css } from '@emotion/react'; import { Formik } from 'formik'; import { xFindClosestIndex } from 'ml-spectra-processing'; import { Spectrum1D } from 'nmr-load-save'; import { useEffect, useState } from 'react'; import * as Yup from 'yup'; -import { REFERENCES } from '../../data/constants/References'; -import { CalibrateOptions } from '../../data/data1d/Spectrum1D/getReferenceShift'; -import { useDispatch } from '../context/DispatchContext'; -import Button from '../elements/Button'; -import CloseButton from '../elements/CloseButton'; -import { InputStyle } from '../elements/Input'; -import Label, { LabelStyle } from '../elements/Label'; -import Message from '../elements/Message'; -import Select from '../elements/Select'; -import FormikInput from '../elements/formik/FormikInput'; -import useSpectraByActiveNucleus from '../hooks/useSpectraPerNucleus'; -import Events from '../utility/Events'; - -import { ModalStyles } from './ModalStyle'; +import { REFERENCES } from '../../../data/constants/References'; +import { CalibrateOptions } from '../../../data/data1d/Spectrum1D/getReferenceShift'; +import { useDispatch } from '../../context/DispatchContext'; +import Button from '../../elements/Button'; +import { InputStyle } from '../../elements/Input'; +import Label, { LabelStyle } from '../../elements/Label'; +import Message from '../../elements/Message'; +import Select from '../../elements/Select'; +import FormikInput from '../../elements/formik/FormikInput'; +import useSpectraByActiveNucleus from '../../hooks/useSpectraPerNucleus'; +import Events from '../../utility/Events'; const labelStyle: LabelStyle = { label: { flex: 4, fontWeight: '500' }, @@ -34,9 +32,9 @@ const inputStyle: InputStyle = { const baseList = [{ key: 1, value: 'manual', label: 'Manual' }]; -interface AlignSpectraModalProps { - onClose?: (element?: string) => void; +interface AlignSpectraProps { nucleus: any; + onClose: () => void; } const DEFAULT_OPTIONS: CalibrateOptions = { @@ -93,10 +91,7 @@ function getList(nucleus) { return baseList.concat(list as any); } -function AlignSpectraModal({ - onClose = () => null, - nucleus, -}: AlignSpectraModalProps) { +function AlignSpectra({ onClose = () => null, nucleus }: AlignSpectraProps) { const spectra = useSpectraByActiveNucleus(); const dispatch = useDispatch(); const [options, setOptions] = useState(DEFAULT_OPTIONS); @@ -104,7 +99,6 @@ function AlignSpectraModal({ function submitHandler(inputOptions) { const options = checkOptions(inputOptions); setOptions(options); - try { checkSpectra(options, spectra as Spectrum1D[]); @@ -143,8 +137,32 @@ function AlignSpectraModal({ } const List = getList(nucleus); + const styles = css` + max-height: 100%; + padding: 10px 0 5px 20px; + display: flex; + flex-direction: column; + flex: 1; + + .body { + overflow: auto; + padding: 10px 10px 25px 0; + } + + .header { + padding: 5px 0; + font-size: 15px; + font-weight: bold; + } + + .footer { + display: flex; + padding-top: 5px; + } + `; + return ( -
+
{({ submitForm }) => ( <> -
- Spectra calibration - -
-
+
+
+ Spectra calibration +
{error && {error}}