nmrium 0.50.0 → 0.51.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/README.md +7 -7
  2. package/lib/component/1d/Chart1D.js +1 -1
  3. package/lib/component/1d/LinesSeries.js +2 -2
  4. package/lib/component/1d/Viewer1D.js +6 -11
  5. package/lib/component/1d/database/DatabaseSpectrum.js +3 -3
  6. package/lib/component/2d/1d-tracer/HorizontalSliceChart.js +6 -2
  7. package/lib/component/2d/1d-tracer/VerticalSliceChart.js +8 -1
  8. package/lib/component/2d/1d-tracer/phase-correction-traces/PhaseTraceWithMouse.js +2 -21
  9. package/lib/component/2d/1d-tracer/phase-correction-traces/PhaseTraces.js +1 -1
  10. package/lib/component/2d/1d-tracer/phase-correction-traces/SpectraPhaseTraces.d.ts +1 -1
  11. package/lib/component/2d/1d-tracer/phase-correction-traces/SpectraPhaseTraces.js +6 -17
  12. package/lib/component/2d/1d-tracer/phase-correction-traces/SpectrumPhaseTrace.d.ts +6 -10
  13. package/lib/component/2d/1d-tracer/phase-correction-traces/SpectrumPhaseTrace.js +62 -13
  14. package/lib/component/2d/1d-tracer/phase-correction-traces/useActivePhaseTraces.d.ts +1 -0
  15. package/lib/component/2d/1d-tracer/phase-correction-traces/useActivePhaseTraces.js +2 -1
  16. package/lib/component/2d/Viewer2D.js +16 -15
  17. package/lib/component/2d/ft/Contours.js +6 -3
  18. package/lib/component/2d/utilities/scale.d.ts +2 -1
  19. package/lib/component/2d/utilities/scale.js +12 -2
  20. package/lib/component/EventsTrackers/BrushTracker.d.ts +5 -3
  21. package/lib/component/EventsTrackers/BrushTracker.js +2 -2
  22. package/lib/component/EventsTrackers/KeysListenerTracker.d.ts +1 -1
  23. package/lib/component/EventsTrackers/KeysListenerTracker.js +29 -15
  24. package/lib/component/context/ToasterContext.d.ts +13 -0
  25. package/lib/component/context/ToasterContext.js +34 -0
  26. package/lib/component/elements/CloseButton.d.ts +2 -2
  27. package/lib/component/elements/CloseButton.js +1 -1
  28. package/lib/component/elements/CounterLabel.d.ts +3 -3
  29. package/lib/component/elements/CounterLabel.js +3 -3
  30. package/lib/component/elements/PreferencesButton.d.ts +2 -2
  31. package/lib/component/elements/PreferencesButton.js +2 -4
  32. package/lib/component/elements/SaveButton.d.ts +2 -2
  33. package/lib/component/elements/SaveButton.js +1 -1
  34. package/lib/component/elements/Select.js +2 -2
  35. package/lib/component/elements/ToolBarButton.d.ts +1 -8
  36. package/lib/component/elements/ToolBarButton.js +2 -11
  37. package/lib/component/elements/ToolbarPopoverItem.d.ts +11 -0
  38. package/lib/component/elements/ToolbarPopoverItem.js +10 -0
  39. package/lib/component/header/AutoPeakPickingOptionPanel.js +6 -3
  40. package/lib/component/header/Header.d.ts +1 -11
  41. package/lib/component/header/Header.js +5 -6
  42. package/lib/component/header/PhaseCorrectionPanel.js +24 -33
  43. package/lib/component/header/PhaseCorrectionTwoDimensionsPanel.d.ts +1 -1
  44. package/lib/component/header/PhaseCorrectionTwoDimensionsPanel.js +96 -42
  45. package/lib/component/header/RangesPickingOptionPanel.js +6 -3
  46. package/lib/component/hooks/useDialogToggle.d.ts +5 -0
  47. package/lib/component/hooks/useDialogToggle.js +16 -0
  48. package/lib/component/hooks/useExport.d.ts +9 -1
  49. package/lib/component/hooks/useExport.js +34 -36
  50. package/lib/component/hooks/useSaveSettings.js +6 -3
  51. package/lib/component/hooks/useToolsFunctions.js +6 -4
  52. package/lib/component/loader/DropZone.js +14 -14
  53. package/lib/component/main/InnerNMRium.js +5 -9
  54. package/lib/component/main/InnerNMRiumContents.d.ts +0 -2
  55. package/lib/component/main/InnerNMRiumContents.js +5 -3
  56. package/lib/component/main/NMRium.js +2 -2
  57. package/lib/component/modal/AboutPredictionModal.js +1 -1
  58. package/lib/component/modal/CopyClipboardModal.js +1 -1
  59. package/lib/component/modal/EditPeakShapeModal.js +1 -1
  60. package/lib/component/modal/ExportAsJcampModal.js +15 -15
  61. package/lib/component/modal/ImportPublicationStringModal.js +5 -3
  62. package/lib/component/modal/LoadJCAMPModal.js +6 -4
  63. package/lib/component/modal/PredictSpectraModal.js +11 -9
  64. package/lib/component/modal/SaveAsModal.d.ts +3 -4
  65. package/lib/component/modal/SaveAsModal.js +27 -27
  66. package/lib/component/modal/aboutUs/AboutUsModal.js +1 -1
  67. package/lib/component/modal/editRange/EditRangeModal.js +2 -2
  68. package/lib/component/modal/editRange/forms/components/DeltaInput.d.ts +2 -3
  69. package/lib/component/modal/editRange/forms/components/DeltaInput.js +2 -3
  70. package/lib/component/modal/editRange/forms/components/InfoBlock.d.ts +1 -0
  71. package/lib/component/modal/editRange/forms/components/{SignalFormInfo.js → InfoBlock.js} +2 -2
  72. package/lib/component/modal/editRange/forms/components/NewSignalTab.d.ts +5 -0
  73. package/lib/component/modal/editRange/forms/components/NewSignalTab.js +85 -0
  74. package/lib/component/modal/editRange/forms/components/SignalTab.d.ts +7 -0
  75. package/lib/component/modal/editRange/forms/components/SignalTab.js +24 -0
  76. package/lib/component/modal/editRange/forms/components/SignalsContent.d.ts +8 -0
  77. package/lib/component/modal/editRange/forms/components/SignalsContent.js +57 -0
  78. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalJCouplingsTable.d.ts +5 -0
  79. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalJCouplingsTable.js +133 -0
  80. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalPeaksTable.d.ts +5 -0
  81. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalPeaksTable.js +141 -0
  82. package/lib/component/modal/editZone/EditZoneModal.js +1 -1
  83. package/lib/component/modal/metaImportation/MetaImportationModal.d.ts +7 -4
  84. package/lib/component/modal/metaImportation/MetaImportationModal.js +23 -13
  85. package/lib/component/modal/metaImportation/utils/mapColumnToSelectItems.js +1 -1
  86. package/lib/component/modal/setting/GeneralSettings.js +7 -4
  87. package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +16 -2
  88. package/lib/component/panels/AutomaticAssignment/useAutoAssignments.js +7 -4
  89. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +20 -6
  90. package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +16 -3
  91. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +14 -10
  92. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +6 -4
  93. package/lib/component/panels/PeaksPanel/PeaksPanel.js +48 -14
  94. package/lib/component/panels/RangesPanel/RangesHeader.js +73 -13
  95. package/lib/component/panels/RangesPanel/RangesPanel.js +4 -4
  96. package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +49 -8
  97. package/lib/component/panels/SpectrumsPanel/SpectraTable.js +11 -5
  98. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +1 -1
  99. package/lib/component/panels/SummaryPanel/SetMolecularFormulaModal.js +1 -1
  100. package/lib/component/panels/SummaryPanel/SetShiftTolerancesModal.js +1 -1
  101. package/lib/component/panels/SummaryPanel/SummaryPanel.js +28 -18
  102. package/lib/component/panels/ZonesPanel/ZonesPanel.js +28 -4
  103. package/lib/component/panels/databasePanel/DatabasePanel.js +37 -19
  104. package/lib/component/panels/databasePanel/DatabaseSearchOptions.d.ts +3 -3
  105. package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +4 -4
  106. package/lib/component/panels/filtersPanel/FilterPanel.js +6 -4
  107. package/lib/component/panels/filtersPanel/FiltersTable.js +27 -23
  108. package/lib/component/panels/header/DefaultPanelHeader.d.ts +10 -6
  109. package/lib/component/panels/header/DefaultPanelHeader.js +26 -10
  110. package/lib/component/panels/header/SpectraAutomaticPickingButton.js +6 -4
  111. package/lib/component/panels/multipleAnalysisPanel/AlignSpectra.js +2 -2
  112. package/lib/component/panels/multipleAnalysisPanel/AnalysisChart.js +3 -3
  113. package/lib/component/panels/multipleAnalysisPanel/MultipleSpectraAnalysisPanel.js +36 -7
  114. package/lib/component/panels/multipleAnalysisPanel/preferences/index.js +4 -2
  115. package/lib/component/panels/predictionPanel/PredictionPanel.js +7 -5
  116. package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +1 -0
  117. package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +5 -1
  118. package/lib/component/reducer/Reducer.d.ts +2 -2
  119. package/lib/component/reducer/Reducer.js +23 -16
  120. package/lib/component/reducer/actions/FiltersActions.d.ts +11 -4
  121. package/lib/component/reducer/actions/FiltersActions.js +243 -91
  122. package/lib/component/reducer/actions/IntegralsActions.d.ts +1 -1
  123. package/lib/component/reducer/actions/IntegralsActions.js +2 -2
  124. package/lib/component/reducer/actions/MoleculeActions.js +0 -1
  125. package/lib/component/reducer/actions/RangesActions.js +16 -6
  126. package/lib/component/reducer/actions/ToolsActions.d.ts +3 -3
  127. package/lib/component/reducer/actions/ToolsActions.js +75 -14
  128. package/lib/component/reducer/helper/Zoom1DManager.d.ts +4 -3
  129. package/lib/component/reducer/helper/Zoom1DManager.js +4 -4
  130. package/lib/component/reducer/helper/ZoomHistoryManager.js +1 -5
  131. package/lib/component/reducer/helper/findStrongestPeak.d.ts +6 -0
  132. package/lib/component/reducer/helper/findStrongestPeak.js +13 -0
  133. package/lib/component/reducer/helper/getTwoDimensionPhaseCorrectionOptions.d.ts +2 -1
  134. package/lib/component/reducer/helper/getTwoDimensionPhaseCorrectionOptions.js +7 -1
  135. package/lib/component/toolbar/ToolBar.js +241 -8
  136. package/lib/component/toolbar/toolbarMenu.d.ts +4 -0
  137. package/lib/component/toolbar/toolbarMenu.js +77 -0
  138. package/lib/component/utility/Events.d.ts +11 -0
  139. package/lib/component/utility/Events.js +22 -0
  140. package/lib/component/utility/booleanToString.d.ts +6 -0
  141. package/lib/component/utility/booleanToString.js +4 -0
  142. package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +0 -33
  143. package/lib/data/data1d/Spectrum1D/ranges/addRange.js +5 -15
  144. package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +6 -4
  145. package/lib/data/data1d/Spectrum1D/ranges/changeRange.js +1 -1
  146. package/lib/data/data1d/Spectrum1D/ranges/detectRange.js +1 -1
  147. package/lib/data/data1d/Spectrum1D/ranges/detectRanges.d.ts +6 -4
  148. package/lib/data/data1d/Spectrum1D/ranges/detectSignals.d.ts +13 -3
  149. package/lib/data/data1d/Spectrum1D/ranges/detectSignals.js +6 -0
  150. package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.d.ts +13 -3
  151. package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.js +78 -18
  152. package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +2 -2
  153. package/lib/data/data1d/spectrumSimulation.d.ts +1 -1
  154. package/lib/data/data2d/Spectrum2D/contours.js +3 -3
  155. package/lib/data/data2d/Spectrum2D/getMissingProjection.js +2 -2
  156. package/lib/data/data2d/Spectrum2D/getSlice.js +3 -3
  157. package/lib/data/getDefaultMatrixFilters.js +2 -2
  158. package/lib/data/matrixGeneration.js +1 -1
  159. package/lib/data/utilities/calculateSanPlot.d.ts +1 -6
  160. package/lib/versionInfo.js +1 -1
  161. package/package.json +31 -30
  162. package/lib/component/elements/DeleteButton.d.ts +0 -6
  163. package/lib/component/elements/DeleteButton.js +0 -8
  164. package/lib/component/elements/DropdownMenu.d.ts +0 -9
  165. package/lib/component/elements/DropdownMenu.js +0 -7
  166. package/lib/component/elements/FilterButton.d.ts +0 -6
  167. package/lib/component/elements/FilterButton.js +0 -8
  168. package/lib/component/elements/popup/Alert/AlertBlock.d.ts +0 -8
  169. package/lib/component/elements/popup/Alert/AlertBlock.js +0 -30
  170. package/lib/component/elements/popup/Alert/Context.d.ts +0 -27
  171. package/lib/component/elements/popup/Alert/Context.js +0 -10
  172. package/lib/component/elements/popup/Alert/ProgressIndicator.d.ts +0 -1
  173. package/lib/component/elements/popup/Alert/ProgressIndicator.js +0 -33
  174. package/lib/component/elements/popup/Alert/Provider.d.ts +0 -19
  175. package/lib/component/elements/popup/Alert/Provider.js +0 -127
  176. package/lib/component/elements/popup/Alert/index.d.ts +0 -3
  177. package/lib/component/elements/popup/Alert/index.js +0 -3
  178. package/lib/component/modal/editRange/forms/components/AddSignalFormTab.d.ts +0 -10
  179. package/lib/component/modal/editRange/forms/components/AddSignalFormTab.js +0 -81
  180. package/lib/component/modal/editRange/forms/components/CouplingsTable.d.ts +0 -13
  181. package/lib/component/modal/editRange/forms/components/CouplingsTable.js +0 -63
  182. package/lib/component/modal/editRange/forms/components/SignalFormInfo.d.ts +0 -1
  183. package/lib/component/modal/editRange/forms/components/SignalFormTab.d.ts +0 -8
  184. package/lib/component/modal/editRange/forms/components/SignalFormTab.js +0 -18
  185. package/lib/component/modal/editRange/forms/components/SignalsForm.d.ts +0 -10
  186. package/lib/component/modal/editRange/forms/components/SignalsForm.js +0 -114
  187. package/lib/component/modal/metaImportation/index.d.ts +0 -2
  188. package/lib/component/modal/metaImportation/index.js +0 -17
  189. package/lib/component/panels/PeaksPanel/PeaksToggleActions.d.ts +0 -12
  190. package/lib/component/panels/PeaksPanel/PeaksToggleActions.js +0 -7
  191. package/lib/component/reducer/helper/getStrongestPeak.d.ts +0 -7
  192. package/lib/component/reducer/helper/getStrongestPeak.js +0 -15
  193. package/lib/component/toolbar/BasicToolBar.d.ts +0 -1
  194. package/lib/component/toolbar/BasicToolBar.js +0 -165
  195. package/lib/component/toolbar/FunctionToolBar.d.ts +0 -3
  196. package/lib/component/toolbar/FunctionToolBar.js +0 -148
@@ -1,22 +1,22 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useCallback, useDeferredValue, useEffect, useRef, useState, } from 'react';
3
- import { stringCapitalize } from '../../utils/stringCapitalize';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
+ /** @jsxImportSource @emotion/react */
3
+ import { css } from '@emotion/react';
4
+ import debounce from 'lodash/debounce';
5
+ import { Filters } from 'nmr-processing';
6
+ import { useCallback, useEffect, useRef, useState } from 'react';
7
+ import { FaRulerHorizontal, FaRulerVertical } from 'react-icons/fa';
8
+ import { MdLooksTwo } from 'react-icons/md';
9
+ import { Toolbar } from 'react-science/ui';
4
10
  import { useActivePhaseTraces } from '../2d/1d-tracer/phase-correction-traces/useActivePhaseTraces';
5
11
  import { useDispatch } from '../context/DispatchContext';
6
12
  import ActionButtons from '../elements/ActionButtons';
7
13
  import Input from '../elements/Input';
8
14
  import InputRange from '../elements/InputRange';
9
15
  import Label from '../elements/Label';
10
- import Select from '../elements/Select';
16
+ import { useFilter } from '../hooks/useFilter';
11
17
  import useSpectrum from '../hooks/useSpectrum';
12
18
  import { headerLabelStyle } from './Header';
13
19
  import { HeaderContainer } from './HeaderContainer';
14
- const selectStyle = {
15
- marginLeft: '5px',
16
- marginRight: '10px',
17
- border: 'none',
18
- height: '20px',
19
- };
20
20
  const inputStyle = {
21
21
  input: {
22
22
  width: '70px',
@@ -26,62 +26,110 @@ const inputStyle = {
26
26
  height: '100%',
27
27
  },
28
28
  };
29
- const TRACE_DIRECTIONS = ['horizontal', 'vertical'].map((key) => ({
30
- label: stringCapitalize(key),
31
- value: key,
32
- }));
33
29
  const emptyData = { datum: {}, filter: null };
30
+ const defaultPhaseOptions = {
31
+ horizontal: { ph0: 0, ph1: 0 },
32
+ vertical: { ph0: 0, ph1: 0 },
33
+ };
34
34
  export default function PhaseCorrectionTwoDimensionsPanel() {
35
- const { ph0, ph1, pivot, activeTraceDirection } = useActivePhaseTraces();
35
+ const { activeTraceDirection, pivot, addTracesToBothDirections } = useActivePhaseTraces();
36
36
  const { data } = useSpectrum(emptyData);
37
- const activeDirection = useDeferredValue(activeTraceDirection);
37
+ const filter = useFilter(Filters.phaseCorrectionTwoDimensions.id);
38
+ const debounceCalculation = useRef(debounce((options) => {
39
+ dispatch({
40
+ type: 'CALCULATE_TOW_DIMENSIONS_MANUAL_PHASE_CORRECTION_FILTER',
41
+ payload: { ...options, applyOn2D: true },
42
+ });
43
+ }, 250));
38
44
  const dispatch = useDispatch();
39
- const [value, setValue] = useState({ ph0: 0, ph1: 0 });
40
- const valueRef = useRef({ ph0: 0, ph1: 0 });
45
+ const [value, setValue] = useState(defaultPhaseOptions);
46
+ const valueRef = useRef(defaultPhaseOptions);
41
47
  const ph0Ref = useRef();
42
48
  const ph1Ref = useRef();
43
49
  useEffect(() => {
44
- if (activeDirection !== activeTraceDirection) {
45
- setValue({ ph0, ph1 });
46
- valueRef.current = { ph0, ph1 };
50
+ if (filter) {
51
+ const { value } = filter;
52
+ const phaseOptions = defaultPhaseOptions;
53
+ for (const direction of Object.keys(value)) {
54
+ const { ph0, ph1 } = value[direction];
55
+ phaseOptions[direction] = { ph0, ph1 };
56
+ }
57
+ setValue(phaseOptions);
58
+ valueRef.current = phaseOptions;
59
+ }
60
+ }, [filter]);
61
+ useEffect(() => {
62
+ if (ph0Ref.current && ph1Ref.current) {
63
+ const { ph0, ph1 } = valueRef.current[activeTraceDirection];
64
+ ph0Ref.current.setValue(ph0);
65
+ ph1Ref.current.setValue(ph1);
47
66
  }
48
- }, [activeDirection, activeTraceDirection, ph0, ph1]);
49
- const calcPhaseCorrectionHandler = useCallback((newValues, filedName) => {
50
- if (filedName === 'ph1' && data.re && pivot) {
51
- const diff0 = newValues.ph0 - valueRef.current.ph0;
52
- const diff1 = newValues.ph1 - valueRef.current.ph1;
53
- newValues.ph0 +=
54
- diff0 - (diff1 * (data.re.length - pivot?.index)) / data.re.length;
67
+ }, [activeTraceDirection]);
68
+ const calcPhaseCorrectionHandler = useCallback((inputValue, filedName, source) => {
69
+ const newValue = inputValue[activeTraceDirection];
70
+ if (filedName === 'ph1' && data && pivot) {
71
+ const datum = data.rr;
72
+ const nbPoints = activeTraceDirection === 'horizontal'
73
+ ? datum.z[0].length
74
+ : datum.z.length;
75
+ const { ph0, ph1 } = valueRef.current[activeTraceDirection];
76
+ const diff0 = newValue.ph0 - ph0;
77
+ const diff1 = newValue.ph1 - ph1;
78
+ newValue.ph0 += diff0 - (diff1 * (nbPoints - pivot?.index)) / nbPoints;
55
79
  }
56
80
  dispatch({
57
81
  type: 'CALCULATE_TOW_DIMENSIONS_MANUAL_PHASE_CORRECTION_FILTER',
58
- payload: newValues,
82
+ payload: { ...newValue, applyOn2D: source === 'input' },
59
83
  });
60
- }, [data.re, dispatch, pivot]);
84
+ if (source === 'inputRange') {
85
+ debounceCalculation.current(newValue);
86
+ }
87
+ }, [activeTraceDirection, data, dispatch, pivot]);
61
88
  const updateInputRangeInitialValue = useCallback((value) => {
62
89
  // update InputRange initial value
63
- ph0Ref.current.setValue(value.ph0);
64
- ph1Ref.current.setValue(value.ph1);
65
- }, []);
90
+ const { ph0, ph1 } = value[activeTraceDirection];
91
+ ph0Ref.current.setValue(ph0);
92
+ ph1Ref.current.setValue(ph1);
93
+ }, [activeTraceDirection]);
66
94
  const handleInput = useCallback((e) => {
67
95
  const { name, value } = e.target;
68
96
  if (e.target) {
69
- const newValue = { ...valueRef.current, [name]: Number(value) };
97
+ const newValue = {
98
+ ...valueRef.current,
99
+ [activeTraceDirection]: {
100
+ ...valueRef.current[activeTraceDirection],
101
+ [name]: Number(value),
102
+ },
103
+ };
70
104
  if (String(value).trim() !== '-') {
71
- calcPhaseCorrectionHandler(newValue, name);
105
+ calcPhaseCorrectionHandler(newValue, name, 'input');
72
106
  }
73
107
  updateInputRangeInitialValue(newValue);
74
108
  valueRef.current = newValue;
75
109
  setValue(valueRef.current);
76
110
  }
77
- }, [calcPhaseCorrectionHandler, updateInputRangeInitialValue]);
111
+ }, [
112
+ activeTraceDirection,
113
+ calcPhaseCorrectionHandler,
114
+ updateInputRangeInitialValue,
115
+ ]);
78
116
  const handleRangeChange = useCallback((e) => {
79
- const newValue = { ...valueRef.current, [e.name]: e.value };
80
- calcPhaseCorrectionHandler(newValue, e.name);
117
+ const newValue = {
118
+ ...valueRef.current,
119
+ [activeTraceDirection]: {
120
+ ...valueRef.current[activeTraceDirection],
121
+ [e.name]: e.value,
122
+ },
123
+ };
124
+ calcPhaseCorrectionHandler(newValue, e.name, 'inputRange');
81
125
  updateInputRangeInitialValue(newValue);
82
126
  valueRef.current = newValue;
83
127
  setValue(valueRef.current);
84
- }, [calcPhaseCorrectionHandler, updateInputRangeInitialValue]);
128
+ }, [
129
+ activeTraceDirection,
130
+ calcPhaseCorrectionHandler,
131
+ updateInputRangeInitialValue,
132
+ ]);
85
133
  const handleCancelFilter = useCallback(() => {
86
134
  dispatch({
87
135
  type: 'RESET_SELECTED_TOOL',
@@ -93,9 +141,15 @@ export default function PhaseCorrectionTwoDimensionsPanel() {
93
141
  payload: { direction },
94
142
  });
95
143
  }
96
- /*eslint-disable unicorn/consistent-function-scoping */
97
144
  function handleApplyFilter() {
98
- //TODO implement apply filter
145
+ dispatch({ type: 'APPLY_MANUAL_PHASE_CORRECTION_TOW_DIMENSION_FILTER' });
146
+ }
147
+ function handleToggleAddTraceToBothDirections() {
148
+ dispatch({ type: 'TOGGLE_ADD_PHASE_CORRECTION_TRACE_TO_BOTH_DIRECTIONS' });
99
149
  }
100
- return (_jsxs(HeaderContainer, { children: [_jsx(Select, { onChange: onChangeHandler, items: TRACE_DIRECTIONS, defaultValue: activeTraceDirection, style: selectStyle }), _jsxs(_Fragment, { children: [_jsx(Label, { title: "PH0 :", style: headerLabelStyle, children: _jsx(Input, { name: "ph0", style: inputStyle, onChange: handleInput, value: value.ph0, type: "number", debounceTime: 250 }) }), _jsx(Label, { title: "PH1 :", style: headerLabelStyle, children: _jsx(Input, { name: "ph1", style: inputStyle, onChange: handleInput, value: value.ph1, type: "number", debounceTime: 250 }) }), _jsx(InputRange, { ref: ph0Ref, name: "ph0", label: "Change PH0 (click and drag)", shortLabel: "Ph0", style: { width: '20%' }, onChange: handleRangeChange }), _jsx(InputRange, { ref: ph1Ref, name: "ph1", label: "Change PH1 (click and drag)", shortLabel: "Ph1", style: { width: '20%' }, onChange: handleRangeChange })] }), _jsx(ActionButtons, { onDone: handleApplyFilter, onCancel: handleCancelFilter })] }));
150
+ return (_jsxs(HeaderContainer, { style: { padding: '0 5px' }, children: [_jsx(Label, { title: "Direction :", style: headerLabelStyle, children: _jsxs(Toolbar, { children: [_jsx(Toolbar.Item, { css: css `
151
+ border: 1px solid #f7f7f7;
152
+ `, title: "Horizontal", icon: _jsx(FaRulerHorizontal, {}), active: activeTraceDirection === 'horizontal', onClick: () => onChangeHandler('horizontal') }), _jsx(Toolbar.Item, { css: css `
153
+ border: 1px solid #f7f7f7;
154
+ `, title: "Vertical", icon: _jsx(FaRulerVertical, {}), active: activeTraceDirection === 'vertical', onClick: () => onChangeHandler('vertical') })] }) }), _jsx("div", { style: { paddingRight: '5px' }, children: _jsx(Toolbar, { children: _jsx(Toolbar.Item, { title: "Add the trace in both directions", icon: _jsx(MdLooksTwo, {}), active: addTracesToBothDirections, onClick: handleToggleAddTraceToBothDirections }) }) }), _jsx(Label, { title: "PH0 :", style: headerLabelStyle, children: _jsx(Input, { name: "ph0", style: inputStyle, onChange: handleInput, value: value[activeTraceDirection].ph0, type: "number", debounceTime: 250 }) }), _jsx(Label, { title: "PH1 :", style: headerLabelStyle, children: _jsx(Input, { name: "ph1", style: inputStyle, onChange: handleInput, value: value[activeTraceDirection].ph1, type: "number", debounceTime: 250 }) }), _jsx(InputRange, { ref: ph0Ref, name: "ph0", label: "Change PH0 (click and drag)", shortLabel: "Ph0", style: { width: '20%' }, onChange: handleRangeChange }), _jsx(InputRange, { ref: ph1Ref, name: "ph1", label: "Change PH1 (click and drag)", shortLabel: "Ph1", style: { width: '20%' }, onChange: handleRangeChange }), _jsx(ActionButtons, { onDone: handleApplyFilter, onCancel: handleCancelFilter })] }));
101
155
  }
@@ -2,11 +2,11 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
2
2
  import { Formik } from 'formik';
3
3
  import * as Yup from 'yup';
4
4
  import { useDispatch } from '../context/DispatchContext';
5
+ import { useToaster } from '../context/ToasterContext';
5
6
  import Button from '../elements/Button';
6
7
  import Label from '../elements/Label';
7
8
  import FormikCheckBox from '../elements/formik/FormikCheckBox';
8
9
  import FormikInput from '../elements/formik/FormikInput';
9
- import { useAlert } from '../elements/popup/Alert';
10
10
  import { MIN_AREA_POINTS, useCheckPointsNumberInWindowArea, } from '../hooks/useCheckPointsNumberInWindowArea';
11
11
  import { headerLabelStyle } from './Header';
12
12
  import { HeaderContainer } from './HeaderContainer';
@@ -20,7 +20,7 @@ const initialValues = {
20
20
  function RangesPickingOptionPanel() {
21
21
  const dispatch = useDispatch();
22
22
  const pointsNumber = useCheckPointsNumberInWindowArea();
23
- const alert = useAlert();
23
+ const toaster = useToaster();
24
24
  function handleRangesPicking(values) {
25
25
  if (pointsNumber > MIN_AREA_POINTS) {
26
26
  dispatch({
@@ -29,7 +29,10 @@ function RangesPickingOptionPanel() {
29
29
  });
30
30
  }
31
31
  else {
32
- alert.error(`Auto range picking only available for area more than ${MIN_AREA_POINTS} points`);
32
+ toaster.show({
33
+ message: `Auto range picking only available for area more than ${MIN_AREA_POINTS} points`,
34
+ intent: 'danger',
35
+ });
33
36
  }
34
37
  }
35
38
  return (_jsx(HeaderContainer, { children: _jsx(Formik, { onSubmit: handleRangesPicking, initialValues: initialValues, validationSchema: validationSchema, children: ({ handleSubmit, isValid }) => (_jsxs(_Fragment, { children: [_jsx(Label, { title: "Detect negative:", htmlFor: "lookNegative", style: headerLabelStyle, children: _jsx(FormikCheckBox, { name: "lookNegative" }) }), _jsx(Label, { title: "Min Max Ratio:", style: headerLabelStyle, children: _jsx(FormikInput, { type: "number", name: "minMaxRatio", style: {
@@ -0,0 +1,5 @@
1
+ export declare function useDialogToggle<T = Record<string, boolean>>(initState: T): {
2
+ dialog: T;
3
+ closeDialog: () => void;
4
+ openDialog: (id: keyof T) => void;
5
+ };
@@ -0,0 +1,16 @@
1
+ import { useState } from 'react';
2
+ export function useDialogToggle(initState) {
3
+ const [dialog, setDialogState] = useState(initState);
4
+ function openDialog(id) {
5
+ const newState = { ...dialog, [id]: true };
6
+ setDialogState(newState);
7
+ }
8
+ function closeDialog() {
9
+ const newState = {};
10
+ for (const id in dialog) {
11
+ newState[id] = false;
12
+ }
13
+ setDialogState(newState);
14
+ }
15
+ return { dialog, closeDialog, openDialog };
16
+ }
@@ -1,7 +1,15 @@
1
+ import { ExportOptions } from '../../data/SpectraManager';
2
+ interface SaveOptions {
3
+ include: ExportOptions;
4
+ name: string;
5
+ compressed: boolean;
6
+ pretty: boolean;
7
+ }
1
8
  export default function useExport(): {
2
9
  saveToClipboardHandler: () => Promise<void>;
3
10
  saveAsJSONHandler: (spaceIndent?: number, isCompressed?: boolean) => void;
4
11
  saveAsSVGHandler: () => Promise<void>;
5
12
  saveAsPNGHandler: () => Promise<void>;
6
- saveAsHandler: () => Promise<void>;
13
+ saveHandler: (options: SaveOptions) => void;
7
14
  };
15
+ export {};
@@ -1,35 +1,36 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
1
  import { useCallback } from 'react';
3
2
  import { toJSON } from '../../data/SpectraManager';
4
3
  import { useChartData } from '../context/ChartContext';
5
4
  import { useGlobal } from '../context/GlobalContext';
6
5
  import { usePreferences } from '../context/PreferencesContext';
7
- import { useAlert } from '../elements/popup/Alert';
8
- import { positions, useModal } from '../elements/popup/Modal';
9
- import SaveAsModal from '../modal/SaveAsModal';
6
+ import { useToaster } from '../context/ToasterContext';
10
7
  import { copyPNGToClipboard, exportAsJSON, exportAsPng, exportAsSVG, } from '../utility/export';
11
8
  export default function useExport() {
12
9
  const { rootRef } = useGlobal();
13
- const modal = useModal();
14
- const alert = useAlert();
10
+ const toaster = useToaster();
15
11
  const state = useChartData();
16
12
  const preferencesState = usePreferences();
17
13
  const saveToClipboardHandler = useCallback(async () => {
18
14
  if (state.data.length > 0 && rootRef) {
19
- const hideLoading = await alert.showLoading('Exporting as NMRium process in progress');
15
+ const hideLoading = toaster.showLoading({
16
+ message: 'Exporting as NMRium process in progress',
17
+ });
20
18
  setTimeout(async () => {
21
19
  await copyPNGToClipboard(rootRef, 'nmrSVG');
22
20
  hideLoading();
23
- alert.success('Image copied to clipboard');
21
+ toaster.show({
22
+ message: 'Image copied to clipboard',
23
+ intent: 'success',
24
+ });
24
25
  }, 0);
25
26
  }
26
- }, [rootRef, alert, state]);
27
+ }, [state.data.length, rootRef, toaster]);
27
28
  const saveAsJSONHandler = useCallback((spaceIndent = 0, isCompressed = true) => {
28
- alert
29
- .showLoading('Exporting as NMRium process in progress')
30
- .then((hideLoading) => {
31
- async function handle() {
32
- //exported file name by default will be the first spectrum name
29
+ const hideLoading = toaster.showLoading({
30
+ message: 'Exporting as NMRium process in progress',
31
+ });
32
+ try {
33
+ void (async () => {
33
34
  const fileName = state.data[0]?.info?.name;
34
35
  const exportedData = toJSON(state, preferencesState, {
35
36
  exportTarget: 'nmrium',
@@ -37,37 +38,42 @@ export default function useExport() {
37
38
  });
38
39
  await exportAsJSON(exportedData, fileName, spaceIndent, isCompressed);
39
40
  hideLoading();
40
- }
41
- setTimeout(() => {
42
- void handle();
43
- }, 0);
44
- })
45
- .catch(reportError);
46
- }, [alert, preferencesState, state]);
41
+ })();
42
+ }
43
+ catch (error) {
44
+ reportError(error);
45
+ }
46
+ }, [preferencesState, state, toaster]);
47
47
  const saveAsSVGHandler = useCallback(async () => {
48
48
  if (state.data.length > 0 && rootRef) {
49
- const hideLoading = await alert.showLoading('Exporting as SVG process in progress');
49
+ const hideLoading = toaster.showLoading({
50
+ message: 'Exporting as SVG process in progress',
51
+ });
50
52
  setTimeout(() => {
51
53
  const fileName = state.data[0]?.info?.name;
52
54
  exportAsSVG(rootRef, 'nmrSVG', fileName);
53
55
  hideLoading();
54
56
  }, 0);
55
57
  }
56
- }, [rootRef, alert, state.data]);
58
+ }, [state.data, rootRef, toaster]);
57
59
  const saveAsPNGHandler = useCallback(async () => {
58
60
  if (state.data.length > 0 && rootRef) {
59
- const hideLoading = await alert.showLoading('Exporting as PNG process in progress');
61
+ const hideLoading = toaster.showLoading({
62
+ message: 'Exporting as PNG process in progress',
63
+ });
60
64
  setTimeout(() => {
61
65
  const fileName = state.data[0]?.info?.name;
62
66
  exportAsPng(rootRef, 'nmrSVG', fileName);
63
67
  hideLoading();
64
68
  }, 0);
65
69
  }
66
- }, [rootRef, alert, state.data]);
70
+ }, [state.data, rootRef, toaster]);
67
71
  const saveHandler = useCallback((options) => {
68
72
  async function handler() {
69
73
  const { name, pretty, compressed, include } = options;
70
- const hideLoading = await alert.showLoading(`Exporting as ${name}.nmrium process in progress`);
74
+ const hideLoading = toaster.showLoading({
75
+ message: `Exporting as ${name}.nmrium process in progress`,
76
+ });
71
77
  setTimeout(() => {
72
78
  void (async () => {
73
79
  const exportedData = toJSON(state, preferencesState, {
@@ -81,20 +87,12 @@ export default function useExport() {
81
87
  }, 0);
82
88
  }
83
89
  void handler();
84
- }, [alert, preferencesState, state]);
85
- const saveAsHandler = useCallback(async () => {
86
- const fileName = state.data[0]?.info?.name;
87
- modal.show(_jsx(SaveAsModal, { name: fileName, onSave: saveHandler }), {
88
- isBackgroundBlur: false,
89
- position: positions.TOP_CENTER,
90
- width: 500,
91
- });
92
- }, [modal, saveHandler, state.data]);
90
+ }, [preferencesState, state, toaster]);
93
91
  return {
94
92
  saveToClipboardHandler,
95
93
  saveAsJSONHandler,
96
94
  saveAsSVGHandler,
97
95
  saveAsPNGHandler,
98
- saveAsHandler,
96
+ saveHandler,
99
97
  };
100
98
  }
@@ -5,8 +5,8 @@ import { useRef, forwardRef } from 'react';
5
5
  import { useOnOff } from 'react-science/ui';
6
6
  import * as Yup from 'yup';
7
7
  import { usePreferences } from '../context/PreferencesContext';
8
+ import { useToaster } from '../context/ToasterContext';
8
9
  import FormikInput from '../elements/formik/FormikInput';
9
- import { useAlert } from '../elements/popup/Alert/Context';
10
10
  import ConfirmationDialog from '../elements/popup/Modal/ConfirmDialog';
11
11
  const schema = Yup.object().shape({
12
12
  workspaceName: Yup.string().required(),
@@ -22,7 +22,7 @@ const WorkspaceAddForm = forwardRef(({ className, message, onSave }, ref) => {
22
22
  }, autoFocus: true }) })] }));
23
23
  });
24
24
  export function useSaveSettings() {
25
- const alert = useAlert();
25
+ const toaster = useToaster();
26
26
  const [isOpenDialog, openDialog, closeDialog] = useOnOff(false);
27
27
  const settingsRef = useRef();
28
28
  const { dispatch, current } = usePreferences();
@@ -36,7 +36,10 @@ export function useSaveSettings() {
36
36
  },
37
37
  });
38
38
  closeDialog();
39
- alert.success('Preferences saved successfully');
39
+ toaster.show({
40
+ message: 'Preferences saved successfully',
41
+ intent: 'success',
42
+ });
40
43
  }
41
44
  return {
42
45
  saveSettings: (values) => {
@@ -4,12 +4,12 @@ import { useCallback, useRef, useState } from 'react';
4
4
  import { useToggleAccordion } from 'react-science/ui';
5
5
  import { useDispatch } from '../context/DispatchContext';
6
6
  import { usePreferences } from '../context/PreferencesContext';
7
- import { useAlert } from '../elements/popup/Alert';
7
+ import { useToaster } from '../context/ToasterContext';
8
8
  import { TOOLS_PANELS_ACCORDION } from '../panels/Panels';
9
9
  import { options } from '../toolbar/ToolTypes';
10
10
  export default function useToolsFunctions() {
11
11
  const dispatch = useDispatch();
12
- const alert = useAlert();
12
+ const toaster = useToaster();
13
13
  const { open: openPanel } = useToggleAccordion();
14
14
  const [isRealSpectrumShown, setIsRealSpectrumShown] = useState(false);
15
15
  const debounceClickEventsRef = useRef({ clicks: [] });
@@ -22,7 +22,9 @@ export default function useToolsFunctions() {
22
22
  options.exclusionZones.id,
23
23
  options.rangePicking.id,
24
24
  ].includes(selectedTool)) {
25
- alert.show(`Press ${!invert ? 'Shift +' : ''} Left Mouse button to select zone`);
25
+ toaster.show({
26
+ message: `Press ${!invert ? 'Shift +' : ''} Left Mouse button to select zone`,
27
+ });
26
28
  }
27
29
  if (Object.keys(TOOLS_PANELS_ACCORDION).includes(selectedTool)) {
28
30
  openPanel(TOOLS_PANELS_ACCORDION[selectedTool]);
@@ -31,7 +33,7 @@ export default function useToolsFunctions() {
31
33
  type: 'SET_SELECTED_TOOL',
32
34
  payload: { selectedTool: selectedTool || options.zoom.id },
33
35
  });
34
- }, [alert, dispatch, invert, openPanel]);
36
+ }, [dispatch, invert, openPanel, toaster]);
35
37
  const handleFullZoomOut = useCallback(() => {
36
38
  if (debounceClickEventsRef.current.clicks.length === 0) {
37
39
  dispatch({
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
3
3
  import { css } from '@emotion/react';
4
4
  import { fileCollectionFromFileList } from 'filelist-utils';
5
5
  import { read as readDropFiles } from 'nmr-load-save';
6
- import { useCallback } from 'react';
6
+ import { useCallback, useState } from 'react';
7
7
  import { useDropzone } from 'react-dropzone';
8
8
  import { FaUpload } from 'react-icons/fa';
9
9
  import { isMetaFile, parseMetaFile } from '../../data/parseMeta';
@@ -12,10 +12,10 @@ import { useDispatch } from '../context/DispatchContext';
12
12
  import { LoaderProvider } from '../context/LoaderContext';
13
13
  import { useLogger } from '../context/LoggerContext';
14
14
  import { usePreferences } from '../context/PreferencesContext';
15
- import { useAlert } from '../elements/popup/Alert';
15
+ import { useToaster } from '../context/ToasterContext';
16
16
  import useCheckExperimentalFeature from '../hooks/useCheckExperimentalFeature';
17
17
  import { useCheckToolsVisibility } from '../hooks/useCheckToolsVisibility';
18
- import { useMetaInformationImportationModal } from '../modal/metaImportation/index';
18
+ import { MetaImportationModal } from '../modal/metaImportation/MetaImportationModal';
19
19
  const style = css `
20
20
  height: 100%;
21
21
  background-color: #b5b5b599;
@@ -24,7 +24,7 @@ const style = css `
24
24
  justify-content: center;
25
25
  align-items: center;
26
26
  flex-flow: column;
27
- z-index: 99999;
27
+ z-index: 8;
28
28
 
29
29
  p {
30
30
  color: white;
@@ -53,14 +53,14 @@ function DropZone(props) {
53
53
  const { dispatch: dispatchPreferences, current: workspacePreferences } = usePreferences();
54
54
  const preferences = usePreferences();
55
55
  const isToolEnabled = useCheckToolsVisibility();
56
- const openImportMetaInformationModal = useMetaInformationImportationModal();
57
- const alert = useAlert();
56
+ const toaster = useToaster();
58
57
  const { logger } = useLogger();
59
58
  const experimentalFeatures = useCheckExperimentalFeature();
59
+ const [metaInformationFile, openMetaInformationDialog] = useState();
60
60
  async function loadFilesHandler(files) {
61
61
  try {
62
62
  if (files.length === 1 && isMetaFile(files[0])) {
63
- openImportMetaInformationModal(files[0]);
63
+ openMetaInformationDialog(files[0]);
64
64
  }
65
65
  else {
66
66
  const fileCollection = await fileCollectionFromFileList(files);
@@ -98,7 +98,7 @@ function DropZone(props) {
98
98
  }
99
99
  }
100
100
  catch (error) {
101
- alert.error(error.message);
101
+ toaster.show({ message: error.message, intent: 'danger' });
102
102
  logger.error(error);
103
103
  }
104
104
  finally {
@@ -121,11 +121,11 @@ function DropZone(props) {
121
121
  openImportDialog();
122
122
  }
123
123
  }, [isImportEnabled, openImportDialog]);
124
- return (_jsx(LoaderProvider, { value: open, children: _jsxs("div", { ...getRootProps(), role: "none", css: containerStyle, children: [_jsx("input", { ...getInputProps() }), isDragActive && (_jsxs("div", { css: style, style: {
125
- width: `${width}px`,
126
- height: `${height}px`,
127
- marginTop: '30px',
128
- marginLeft: '30px',
129
- }, children: [_jsx(FaUpload, {}), _jsx("p", { children: "Drop your files here" })] })), props.children] }) }));
124
+ return (_jsxs(LoaderProvider, { value: open, children: [metaInformationFile && (_jsx(MetaImportationModal, { isOpen: true, file: metaInformationFile, onCloseDialog: () => openMetaInformationDialog(null) })), _jsxs("div", { ...getRootProps(), role: "none", css: containerStyle, children: [_jsx("input", { ...getInputProps() }), isDragActive && (_jsxs("div", { css: style, style: {
125
+ width: `${width}px`,
126
+ height: `${height}px`,
127
+ marginTop: '30px',
128
+ marginLeft: '30px',
129
+ }, children: [_jsx(FaUpload, {}), _jsx("p", { children: "Drop your files here" })] })), props.children] })] }));
130
130
  }
131
131
  export default DropZone;
@@ -1,14 +1,13 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useEffect, useReducer, useRef, useImperativeHandle, } from 'react';
3
- import { useOnOff } from 'react-science/ui';
4
- import { useFullscreen } from 'react-use';
3
+ import { useFullscreen } from 'react-science/ui';
5
4
  import { AssignmentProvider } from '../assignment';
6
5
  import { GlobalProvider } from '../context/GlobalContext';
7
6
  import { KeyModifiersProvider } from '../context/KeyModifierContext';
8
7
  import { LoggerProvider } from '../context/LoggerContext';
9
8
  import { PreferencesProvider } from '../context/PreferencesContext';
9
+ import { ToasterProvider } from '../context/ToasterContext';
10
10
  import { TopicMoleculeProvider } from '../context/TopicMoleculeContext';
11
- import { AlertProvider } from '../elements/popup/Alert';
12
11
  import { ModalProvider } from '../elements/popup/Modal';
13
12
  import { HighlightProvider } from '../highlight';
14
13
  import { defaultGetSpinner, SpinnerProvider } from '../loader/SpinnerContext';
@@ -20,15 +19,12 @@ export function InnerNMRium({ data: nmriumData, workspace, customWorkspaces, pre
20
19
  const rootRef = useRef(null);
21
20
  const elementsWrapperRef = useRef(null);
22
21
  const viewerRef = useRef(null);
23
- const [enableFullscreen, , disableFullscreen, toggleFullscreen] = useOnOff(false);
24
22
  const mainDivRef = useRef(null);
25
- const isFullscreenEnabled = useFullscreen(rootRef, enableFullscreen, {
26
- onClose: disableFullscreen,
27
- });
23
+ const { isFullScreen } = useFullscreen();
28
24
  const [preferencesState, dispatchPreferences] = useReducer(preferencesReducer, preferencesInitialState, initPreferencesState);
29
25
  useEffect(() => {
30
26
  rootRef.current?.focus();
31
- }, [isFullscreenEnabled]);
27
+ }, [isFullScreen]);
32
28
  useEffect(() => {
33
29
  dispatchPreferences({
34
30
  type: 'INIT_PREFERENCES',
@@ -49,5 +45,5 @@ export function InnerNMRium({ data: nmriumData, workspace, customWorkspaces, pre
49
45
  rootRef: rootRef.current,
50
46
  elementsWrapperRef: elementsWrapperRef.current,
51
47
  viewerRef: viewerRef.current,
52
- }, children: _jsx(PreferencesProvider, { value: preferencesState, children: _jsx(LoggerProvider, { children: _jsx(KeyModifiersProvider, { children: _jsx(AlertProvider, { wrapperRef: elementsWrapperRef.current, children: _jsx(NMRiumStateProvider, { onChange: onChange, nmriumData: nmriumData, children: _jsx(TopicMoleculeProvider, { children: _jsx(ModalProvider, { wrapperRef: elementsWrapperRef.current, children: _jsx(HighlightProvider, { children: _jsx(AssignmentProvider, { children: _jsx(SpinnerProvider, { value: getSpinner, children: _jsx(InnerNMRiumContents, { isFullscreenEnabled: isFullscreenEnabled, toggleFullscreen: toggleFullscreen, emptyText: emptyText, mainDivRef: mainDivRef, elementsWrapperRef: elementsWrapperRef, rootRef: rootRef, viewerRef: viewerRef }) }) }) }) }) }) }) }) }) }) }) }) }));
48
+ }, children: _jsx(PreferencesProvider, { value: preferencesState, children: _jsx(LoggerProvider, { children: _jsx(KeyModifiersProvider, { children: _jsx(ToasterProvider, { children: _jsx(NMRiumStateProvider, { onChange: onChange, nmriumData: nmriumData, children: _jsx(TopicMoleculeProvider, { children: _jsx(ModalProvider, { wrapperRef: elementsWrapperRef.current, children: _jsx(HighlightProvider, { children: _jsx(AssignmentProvider, { children: _jsx(SpinnerProvider, { value: getSpinner, children: _jsx(InnerNMRiumContents, { emptyText: emptyText, mainDivRef: mainDivRef, elementsWrapperRef: elementsWrapperRef, rootRef: rootRef, viewerRef: viewerRef }) }) }) }) }) }) }) }) }) }) }) }) }));
53
49
  }
@@ -2,8 +2,6 @@
2
2
  import { RefObject } from 'react';
3
3
  import { NMRiumProps } from '.';
4
4
  interface InnerNMRiumContentsProps {
5
- isFullscreenEnabled: boolean;
6
- toggleFullscreen: () => void;
7
5
  emptyText: NMRiumProps['emptyText'];
8
6
  mainDivRef: RefObject<HTMLDivElement>;
9
7
  elementsWrapperRef: RefObject<HTMLDivElement>;
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/reac
2
2
  /** @jsxImportSource @emotion/react */
3
3
  import { css } from '@emotion/react';
4
4
  import { useCallback } from 'react';
5
+ import { useFullscreen } from 'react-science/ui';
5
6
  import checkModifierKeyActivated from '../../data/utilities/checkModifierKeyActivated';
6
7
  import Viewer1D from '../1d/Viewer1D';
7
8
  import FloatMoleculeStructures from '../1d-2d/components/FloatMoleculeStructures';
@@ -56,8 +57,9 @@ const containerStyles = css `
56
57
  }
57
58
  `;
58
59
  export function InnerNMRiumContents(props) {
59
- const { isFullscreenEnabled, toggleFullscreen, emptyText, mainDivRef, elementsWrapperRef, rootRef, viewerRef, } = props;
60
+ const { emptyText, mainDivRef, elementsWrapperRef, rootRef, viewerRef } = props;
60
61
  const { displayerMode } = useChartData();
62
+ const { isFullScreen } = useFullscreen();
61
63
  const preventContextMenuHandler = useCallback((e) => {
62
64
  if (!checkModifierKeyActivated(e)) {
63
65
  e.preventDefault();
@@ -68,7 +70,7 @@ export function InnerNMRiumContents(props) {
68
70
  flexDirection: 'column',
69
71
  backgroundColor: 'white',
70
72
  width: '100%',
71
- }, children: [_jsx(Header, { isFullscreenEnabled: isFullscreenEnabled, onEnableFullscreen: toggleFullscreen }), _jsxs("div", { style: {
73
+ }, children: [_jsx(Header, {}), _jsxs("div", { style: {
72
74
  display: 'flex',
73
75
  flexDirection: 'row',
74
76
  height: '100%',
@@ -84,5 +86,5 @@ export function InnerNMRiumContents(props) {
84
86
  right: 0,
85
87
  top: 0,
86
88
  bottom: 0,
87
- } }, String(isFullscreenEnabled))] })] }) }) })] }));
89
+ } }, String(isFullScreen))] })] }) }) })] }));
88
90
  }