nmrium 0.50.1 → 0.52.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 (219) hide show
  1. package/lib/component/1d/Chart1D.js +1 -1
  2. package/lib/component/1d/LinesSeries.js +2 -2
  3. package/lib/component/1d/Viewer1D.js +6 -11
  4. package/lib/component/1d/database/DatabaseSpectrum.js +3 -3
  5. package/lib/component/2d/1d-tracer/HorizontalSliceChart.js +6 -2
  6. package/lib/component/2d/1d-tracer/VerticalSliceChart.js +8 -1
  7. package/lib/component/2d/1d-tracer/phase-correction-traces/PhaseTraceWithMouse.js +2 -21
  8. package/lib/component/2d/1d-tracer/phase-correction-traces/PhaseTraces.js +1 -1
  9. package/lib/component/2d/1d-tracer/phase-correction-traces/SpectraPhaseTraces.d.ts +1 -1
  10. package/lib/component/2d/1d-tracer/phase-correction-traces/SpectraPhaseTraces.js +6 -17
  11. package/lib/component/2d/1d-tracer/phase-correction-traces/SpectrumPhaseTrace.d.ts +6 -10
  12. package/lib/component/2d/1d-tracer/phase-correction-traces/SpectrumPhaseTrace.js +62 -13
  13. package/lib/component/2d/1d-tracer/phase-correction-traces/useActivePhaseTraces.d.ts +1 -0
  14. package/lib/component/2d/1d-tracer/phase-correction-traces/useActivePhaseTraces.js +2 -1
  15. package/lib/component/2d/Viewer2D.js +16 -15
  16. package/lib/component/2d/ft/Contours.js +6 -3
  17. package/lib/component/2d/utilities/scale.d.ts +2 -1
  18. package/lib/component/2d/utilities/scale.js +12 -2
  19. package/lib/component/EventsTrackers/BrushTracker.d.ts +5 -3
  20. package/lib/component/EventsTrackers/BrushTracker.js +2 -2
  21. package/lib/component/EventsTrackers/KeysListenerTracker.d.ts +1 -1
  22. package/lib/component/EventsTrackers/KeysListenerTracker.js +32 -18
  23. package/lib/component/context/DispatchContext.d.ts +1 -1
  24. package/lib/component/context/ToasterContext.d.ts +13 -0
  25. package/lib/component/context/ToasterContext.js +34 -0
  26. package/lib/component/elements/Label.js +1 -1
  27. package/lib/component/elements/Select.js +2 -2
  28. package/lib/component/elements/ToolbarPopoverItem.js +1 -1
  29. package/lib/component/header/ApodizationOptionsPanel.js +1 -1
  30. package/lib/component/header/AutoPeakPickingOptionPanel.js +7 -4
  31. package/lib/component/header/BaseLineCorrectionPanel.js +2 -2
  32. package/lib/component/header/Header.d.ts +1 -11
  33. package/lib/component/header/Header.js +5 -6
  34. package/lib/component/header/PhaseCorrectionPanel.js +24 -33
  35. package/lib/component/header/PhaseCorrectionTwoDimensionsPanel.d.ts +1 -1
  36. package/lib/component/header/PhaseCorrectionTwoDimensionsPanel.js +96 -42
  37. package/lib/component/header/RangesPickingOptionPanel.js +7 -4
  38. package/lib/component/header/ZeroFillingOptionsPanel.js +1 -1
  39. package/lib/component/header/Zones2DOptionPanel.js +6 -2
  40. package/lib/component/hooks/useDialogToggle.d.ts +5 -0
  41. package/lib/component/hooks/useDialogToggle.js +16 -0
  42. package/lib/component/hooks/useExport.d.ts +9 -1
  43. package/lib/component/hooks/useExport.js +34 -36
  44. package/lib/component/hooks/useSaveSettings.js +6 -3
  45. package/lib/component/hooks/useToolsFunctions.d.ts +1 -1
  46. package/lib/component/hooks/useToolsFunctions.js +9 -7
  47. package/lib/component/loader/DropZone.js +14 -14
  48. package/lib/component/main/InnerNMRium.js +5 -9
  49. package/lib/component/main/InnerNMRiumContents.d.ts +0 -2
  50. package/lib/component/main/InnerNMRiumContents.js +5 -3
  51. package/lib/component/main/NMRium.js +2 -2
  52. package/lib/component/modal/AboutPredictionModal.js +1 -1
  53. package/lib/component/modal/AboutSpectrumSimulationModal.js +1 -1
  54. package/lib/component/modal/EditPeakShapeModal.js +1 -1
  55. package/lib/component/modal/ExportAsJcampModal.js +15 -15
  56. package/lib/component/modal/ImportPublicationStringModal.js +5 -3
  57. package/lib/component/modal/LoadJCAMPModal.js +7 -5
  58. package/lib/component/modal/LogsHistoryModal.js +1 -1
  59. package/lib/component/modal/MultipletAnalysisModal.js +1 -1
  60. package/lib/component/modal/PredictSpectraModal.js +11 -9
  61. package/lib/component/modal/SaveAsModal.d.ts +3 -4
  62. package/lib/component/modal/SaveAsModal.js +27 -27
  63. package/lib/component/modal/editRange/EditRangeModal.js +2 -2
  64. package/lib/component/modal/editRange/forms/components/DeltaInput.d.ts +2 -3
  65. package/lib/component/modal/editRange/forms/components/DeltaInput.js +2 -3
  66. package/lib/component/modal/editRange/forms/components/InfoBlock.d.ts +1 -0
  67. package/lib/component/modal/editRange/forms/components/{SignalFormInfo.js → InfoBlock.js} +2 -2
  68. package/lib/component/modal/editRange/forms/components/NewSignalTab.d.ts +5 -0
  69. package/lib/component/modal/editRange/forms/components/NewSignalTab.js +85 -0
  70. package/lib/component/modal/editRange/forms/components/SignalTab.d.ts +7 -0
  71. package/lib/component/modal/editRange/forms/components/SignalTab.js +24 -0
  72. package/lib/component/modal/editRange/forms/components/SignalsContent.d.ts +8 -0
  73. package/lib/component/modal/editRange/forms/components/SignalsContent.js +57 -0
  74. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalJCouplingsTable.d.ts +5 -0
  75. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalJCouplingsTable.js +133 -0
  76. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalPeaksTable.d.ts +5 -0
  77. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalPeaksTable.js +141 -0
  78. package/lib/component/modal/editZone/EditPathLengthFormik.js +2 -2
  79. package/lib/component/modal/editZone/EditZoneModal.js +1 -1
  80. package/lib/component/modal/metaImportation/MetaImportationModal.d.ts +7 -4
  81. package/lib/component/modal/metaImportation/MetaImportationModal.js +23 -13
  82. package/lib/component/modal/metaImportation/utils/mapColumnToSelectItems.js +1 -1
  83. package/lib/component/modal/setting/GeneralSettings.js +9 -6
  84. package/lib/component/modal/setting/settings-tabs/GeneralTabContent.js +1 -1
  85. package/lib/component/modal/setting/settings-tabs/InfoBlockTabContent.js +1 -1
  86. package/lib/component/modal/setting/settings-tabs/OnLoadProcessingTabContent.js +1 -1
  87. package/lib/component/panels/AutomaticAssignment/useAutoAssignments.js +7 -4
  88. package/lib/component/panels/IntegralsPanel/IntegralsPreferences.js +1 -1
  89. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +13 -7
  90. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +6 -4
  91. package/lib/component/panels/Panels.js +5 -5
  92. package/lib/component/panels/PeaksPanel/PeaksPanel.js +6 -3
  93. package/lib/component/panels/RangesPanel/RangesHeader.js +3 -3
  94. package/lib/component/panels/RangesPanel/RangesPanel.js +5 -5
  95. package/lib/component/panels/RangesPanel/RangesPreferences.js +1 -1
  96. package/lib/component/panels/SpectraPanel/SpectraPanelHeader.d.ts +5 -0
  97. package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectraPanelHeader.js +11 -11
  98. package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectraTable.js +12 -6
  99. package/lib/component/panels/SpectraPanel/SpectraTabs.d.ts +1 -0
  100. package/lib/component/panels/{SpectrumsPanel/SpectrumsTabs.js → SpectraPanel/SpectraTabs.js} +6 -6
  101. package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectrumListPanel.js +2 -2
  102. package/lib/component/panels/databasePanel/DatabasePanel.js +37 -19
  103. package/lib/component/panels/databasePanel/DatabasePreferences.js +1 -1
  104. package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +1 -1
  105. package/lib/component/panels/filtersPanel/FilterPanel.js +5 -3
  106. package/lib/component/panels/filtersPanel/FiltersTable.js +27 -23
  107. package/lib/component/panels/header/SpectraAutomaticPickingButton.js +7 -5
  108. package/lib/component/panels/multipleAnalysisPanel/AlignSpectra.js +2 -2
  109. package/lib/component/panels/multipleAnalysisPanel/AnalysisChart.js +5 -5
  110. package/lib/component/panels/multipleAnalysisPanel/MultipleSpectraAnalysisPanel.js +6 -6
  111. package/lib/component/panels/multipleAnalysisPanel/preferences/index.js +5 -3
  112. package/lib/component/panels/predictionPanel/PredictionOptionsPanel.js +2 -2
  113. package/lib/component/panels/predictionPanel/PredictionPanel.js +7 -5
  114. package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +2 -1
  115. package/lib/component/panels/spectrumSimulation/SpectrumSimulationPreferences.js +1 -1
  116. package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +1 -1
  117. package/lib/component/reducer/IgnoreActions.js +1 -1
  118. package/lib/component/reducer/Reducer.d.ts +3 -2
  119. package/lib/component/reducer/Reducer.js +40 -32
  120. package/lib/component/reducer/actions/DomainActions.js +3 -3
  121. package/lib/component/reducer/actions/FiltersActions.d.ts +11 -4
  122. package/lib/component/reducer/actions/FiltersActions.js +243 -91
  123. package/lib/component/reducer/actions/IntegralsActions.js +2 -2
  124. package/lib/component/reducer/actions/LoadActions.js +1 -1
  125. package/lib/component/reducer/actions/MoleculeActions.js +0 -1
  126. package/lib/component/reducer/actions/PreferencesActions.js +2 -2
  127. package/lib/component/reducer/actions/RangesActions.js +16 -6
  128. package/lib/component/reducer/actions/ToolsActions.d.ts +6 -6
  129. package/lib/component/reducer/actions/ToolsActions.js +83 -22
  130. package/lib/component/reducer/actions/ZonesActions.d.ts +2 -0
  131. package/lib/component/reducer/actions/ZonesActions.js +5 -1
  132. package/lib/component/reducer/helper/Zoom1DManager.d.ts +4 -3
  133. package/lib/component/reducer/helper/Zoom1DManager.js +4 -4
  134. package/lib/component/reducer/helper/ZoomHistoryManager.js +1 -5
  135. package/lib/component/reducer/helper/findStrongestPeak.d.ts +6 -0
  136. package/lib/component/reducer/helper/findStrongestPeak.js +13 -0
  137. package/lib/component/reducer/helper/getTwoDimensionPhaseCorrectionOptions.d.ts +2 -1
  138. package/lib/component/reducer/helper/getTwoDimensionPhaseCorrectionOptions.js +7 -1
  139. package/lib/component/toolbar/ToolBar.js +32 -27
  140. package/lib/component/toolbar/toolbarMenu.js +4 -4
  141. package/lib/component/utility/Events.d.ts +11 -0
  142. package/lib/component/utility/Events.js +22 -0
  143. package/lib/constants.js +5 -5
  144. package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +0 -33
  145. package/lib/data/data1d/Spectrum1D/ranges/addRange.js +5 -15
  146. package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +6 -4
  147. package/lib/data/data1d/Spectrum1D/ranges/changeRange.js +1 -1
  148. package/lib/data/data1d/Spectrum1D/ranges/detectRange.js +1 -1
  149. package/lib/data/data1d/Spectrum1D/ranges/detectRanges.d.ts +6 -4
  150. package/lib/data/data1d/Spectrum1D/ranges/detectSignals.d.ts +13 -3
  151. package/lib/data/data1d/Spectrum1D/ranges/detectSignals.js +6 -0
  152. package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.d.ts +13 -3
  153. package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.js +78 -18
  154. package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +2 -2
  155. package/lib/data/data1d/spectrumSimulation.d.ts +1 -1
  156. package/lib/data/data2d/Spectrum2D/contours.js +3 -3
  157. package/lib/data/data2d/Spectrum2D/getMissingProjection.js +2 -2
  158. package/lib/data/data2d/Spectrum2D/getSlice.js +4 -4
  159. package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.d.ts +1 -0
  160. package/lib/data/getDefaultMatrixFilters.js +2 -2
  161. package/lib/data/matrixGeneration.js +1 -1
  162. package/lib/data/utilities/calculateSanPlot.d.ts +1 -6
  163. package/lib/versionInfo.js +1 -1
  164. package/package.json +32 -30
  165. package/lib/component/elements/popup/Alert/AlertBlock.d.ts +0 -8
  166. package/lib/component/elements/popup/Alert/AlertBlock.js +0 -30
  167. package/lib/component/elements/popup/Alert/Context.d.ts +0 -27
  168. package/lib/component/elements/popup/Alert/Context.js +0 -10
  169. package/lib/component/elements/popup/Alert/ProgressIndicator.d.ts +0 -1
  170. package/lib/component/elements/popup/Alert/ProgressIndicator.js +0 -33
  171. package/lib/component/elements/popup/Alert/Provider.d.ts +0 -19
  172. package/lib/component/elements/popup/Alert/Provider.js +0 -127
  173. package/lib/component/elements/popup/Alert/index.d.ts +0 -3
  174. package/lib/component/elements/popup/Alert/index.js +0 -3
  175. package/lib/component/modal/editRange/forms/components/AddSignalFormTab.d.ts +0 -10
  176. package/lib/component/modal/editRange/forms/components/AddSignalFormTab.js +0 -81
  177. package/lib/component/modal/editRange/forms/components/CouplingsTable.d.ts +0 -13
  178. package/lib/component/modal/editRange/forms/components/CouplingsTable.js +0 -63
  179. package/lib/component/modal/editRange/forms/components/SignalFormInfo.d.ts +0 -1
  180. package/lib/component/modal/editRange/forms/components/SignalFormTab.d.ts +0 -8
  181. package/lib/component/modal/editRange/forms/components/SignalFormTab.js +0 -18
  182. package/lib/component/modal/editRange/forms/components/SignalsForm.d.ts +0 -10
  183. package/lib/component/modal/editRange/forms/components/SignalsForm.js +0 -114
  184. package/lib/component/modal/metaImportation/index.d.ts +0 -2
  185. package/lib/component/modal/metaImportation/index.js +0 -17
  186. package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.d.ts +0 -5
  187. package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.d.ts +0 -1
  188. package/lib/component/reducer/helper/getStrongestPeak.d.ts +0 -7
  189. package/lib/component/reducer/helper/getStrongestPeak.js +0 -15
  190. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectraPreferences.d.ts +0 -0
  191. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectraPreferences.js +0 -0
  192. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectraTable.d.ts +0 -0
  193. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectrumListPanel.d.ts +0 -0
  194. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/ColorIndicator.d.ts +0 -0
  195. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/ColorIndicator.js +0 -0
  196. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/RenderAsHTML.d.ts +0 -0
  197. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/RenderAsHTML.js +0 -0
  198. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/ShowHideSpectrumButton.d.ts +0 -0
  199. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/ShowHideSpectrumButton.js +0 -0
  200. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/SpectraColumnsManager.d.ts +0 -0
  201. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/SpectraColumnsManager.js +0 -0
  202. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/SpectrumName.d.ts +0 -0
  203. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/SpectrumName.js +0 -0
  204. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/PlotChart.d.ts +0 -0
  205. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/PlotChart.js +0 -0
  206. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum1DHistogram.d.ts +0 -0
  207. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum1DHistogram.js +0 -0
  208. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum1DSetting.d.ts +0 -0
  209. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum1DSetting.js +0 -0
  210. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum2DHistogram.d.ts +0 -0
  211. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum2DHistogram.js +0 -0
  212. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum2DSetting.d.ts +0 -0
  213. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum2DSetting.js +0 -0
  214. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/SpectrumSetting.d.ts +0 -0
  215. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/SpectrumSetting.js +0 -0
  216. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/processSnapPlot.d.ts +0 -0
  217. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/processSnapPlot.js +0 -0
  218. /package/lib/component/reducer/actions/{SpectrumsActions.d.ts → SpectraActions.d.ts} +0 -0
  219. /package/lib/component/reducer/actions/{SpectrumsActions.js → SpectraActions.js} +0 -0
@@ -12,7 +12,7 @@ import { initiateDatabase, prepareData, DATA_BASES, } from '../../../data/data1d
12
12
  import { useChartData } from '../../context/ChartContext';
13
13
  import { useDispatch } from '../../context/DispatchContext';
14
14
  import { usePreferences } from '../../context/PreferencesContext';
15
- import { useAlert } from '../../elements/popup/Alert';
15
+ import { useToaster } from '../../context/ToasterContext';
16
16
  import { useFormatNumberByNucleus } from '../../hooks/useFormatNumberByNucleus';
17
17
  import { options } from '../../toolbar/ToolTypes';
18
18
  import Events from '../../utility/Events';
@@ -44,7 +44,7 @@ function mapKeywordsToArray(searchKeywords, solvent) {
44
44
  }
45
45
  function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase, }) {
46
46
  const dispatch = useDispatch();
47
- const alert = useAlert();
47
+ const toaster = useToaster();
48
48
  const { item } = useAccordionContext('Databases');
49
49
  const format = useFormatNumberByNucleus(nucleus);
50
50
  const [isFlipped, setFlipStatus] = useState(false);
@@ -80,9 +80,11 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
80
80
  }, [idCode, keywords]);
81
81
  useEffect(() => {
82
82
  const { solvent, searchKeywords } = keywords;
83
- setTimeout(async () => {
83
+ setTimeout(() => {
84
84
  if (databaseInstance.current) {
85
- const hideLoading = await alert.showLoading(`Preparing of the Result`);
85
+ const hideLoading = toaster.showLoading({
86
+ message: 'Preparing of the Result',
87
+ });
86
88
  if (solvent === '-1' && !searchKeywords) {
87
89
  const solvents = mapSolventsToSelect(databaseInstance.current.getSolvents());
88
90
  search(solvents);
@@ -93,7 +95,7 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
93
95
  hideLoading();
94
96
  }
95
97
  }, 0);
96
- }, [alert, idCode, keywords, search]);
98
+ }, [idCode, keywords, search, toaster]);
97
99
  useEffect(() => {
98
100
  function handle(event) {
99
101
  if (selectedTool === options.databaseRangesSelection.id) {
@@ -116,21 +118,25 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
116
118
  };
117
119
  }, [format, selectedTool]);
118
120
  useEffect(() => {
119
- setTimeout(async () => {
121
+ setTimeout(() => {
120
122
  if (databaseInstance.current) {
121
- const hideLoading = await alert.showLoading(`Loading the database`);
123
+ const hideLoading = toaster.showLoading({
124
+ message: 'Loading the database',
125
+ });
122
126
  databaseInstance.current = initiateDatabase(databaseDataRef.current, nucleus);
123
127
  hideLoading();
124
128
  setKeywords({ ...emptyKeywords });
125
129
  }
126
130
  }, 0);
127
- }, [alert, nucleus]);
131
+ }, [nucleus, toaster]);
128
132
  const handleChangeDatabase = useCallback((databaseKey) => {
129
133
  const database = databases.find((item) => item.key === databaseKey);
130
134
  setTimeout(async () => {
131
135
  if (database?.url) {
132
136
  const { url, label } = database;
133
- const hideLoading = await alert.showLoading(`load ${label} database`);
137
+ const hideLoading = toaster.showLoading({
138
+ message: `load ${label} database`,
139
+ });
134
140
  try {
135
141
  databaseDataRef.current = await fetch(url)
136
142
  .then((response) => response.json())
@@ -140,7 +146,10 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
140
146
  })));
141
147
  }
142
148
  catch {
143
- alert.error(`Failed to load ${url}`);
149
+ toaster.show({
150
+ message: `Failed to load ${url}`,
151
+ intent: 'danger',
152
+ });
144
153
  }
145
154
  finally {
146
155
  hideLoading();
@@ -150,12 +159,14 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
150
159
  databaseDataRef.current = database
151
160
  ?.value;
152
161
  }
153
- const hideLoading = await alert.showLoading(`Loading the database`);
162
+ const hideLoading = toaster.showLoading({
163
+ message: 'Loading the database',
164
+ });
154
165
  databaseInstance.current = initiateDatabase(databaseDataRef.current, nucleus);
155
166
  setKeywords({ ...emptyKeywords });
156
167
  hideLoading();
157
168
  }, 0);
158
- }, [alert, databases, nucleus]);
169
+ }, [databases, nucleus, toaster]);
159
170
  useEffect(() => {
160
171
  if (item?.isOpen && defaultDatabase && !databaseInstance.current) {
161
172
  handleChangeDatabase(defaultDatabase);
@@ -170,7 +181,9 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
170
181
  if (jcampRelativeURL) {
171
182
  const url = new URL(jcampRelativeURL, baseURL);
172
183
  setTimeout(async () => {
173
- const hideLoading = await alert.showLoading(`load jcamp in progress...`);
184
+ const hideLoading = toaster.showLoading({
185
+ message: `load jcamp in progress...`,
186
+ });
174
187
  try {
175
188
  const { data } = await readFromWebSource({
176
189
  entries: [{ baseURL: url.origin, relativePath: url.pathname }],
@@ -184,7 +197,7 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
184
197
  }
185
198
  }
186
199
  catch {
187
- alert.error(`Failed to load Jcamp`);
200
+ toaster.show({ message: 'Failed to load Jcamp', intent: 'danger' });
188
201
  }
189
202
  finally {
190
203
  hideLoading();
@@ -197,17 +210,22 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
197
210
  payload: { ranges, info: { solvent, nucleus, name: names[0] } },
198
211
  });
199
212
  }
200
- }, [alert, dispatch, nucleus, result.data]);
213
+ }, [dispatch, nucleus, result.data, toaster]);
201
214
  const saveHandler = useCallback((row) => {
202
215
  if (row?.jcampURL) {
203
216
  setTimeout(async () => {
204
- const hideLoading = await alert.showLoading(`Download jcamp in progress...`);
217
+ const hideLoading = toaster.showLoading({
218
+ message: `Download jcamp in progress...`,
219
+ });
205
220
  try {
206
221
  await saveJcampAsJson(row, result);
207
222
  hideLoading();
208
223
  }
209
224
  catch {
210
- alert.error(`Failed to download the jcamp`);
225
+ toaster.show({
226
+ message: 'Failed to download the jcamp',
227
+ intent: 'danger',
228
+ });
211
229
  }
212
230
  finally {
213
231
  hideLoading();
@@ -215,9 +233,9 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
215
233
  }, 0);
216
234
  }
217
235
  else {
218
- alert.error(`No jcamp file to save`);
236
+ toaster.show({ message: 'No jcamp file to save', intent: 'danger' });
219
237
  }
220
- }, [alert, result]);
238
+ }, [result, toaster]);
221
239
  const searchByStructureHandler = (idCodeValue) => {
222
240
  setIdCode(idCodeValue);
223
241
  };
@@ -27,6 +27,6 @@ function DatabasePreferences(props, ref) {
27
27
  formRef.current.submitForm();
28
28
  },
29
29
  }));
30
- return (_jsx(PreferencesContainer, { children: _jsx(Formik, { initialValues: {}, onSubmit: saveHandler, innerRef: formRef, children: _jsxs(_Fragment, { children: [_jsxs(PreferencesGroup, { children: [_jsx(FormikColumnFormatField, { label: "Preview jcamp", checkControllerName: "previewJcamp", hideFormatField: true }), _jsx(Label, { title: "Color", style: formatFieldLabelStyle, children: _jsx(FormikColorPickerDropdown, { name: "color" }) }), _jsx(Label, { title: "Margin bottom (px) :", style: formatFieldLabelStyle, children: _jsx(FormikInput, { name: "marginBottom", type: "number", style: formatFieldInputStyle }) })] }), _jsxs(PreferencesGroup, { header: "Table Preferences", children: [_jsx(FormikColumnFormatField, { label: "Structure", checkControllerName: "showSmiles", hideFormatField: true }), _jsx(FormikColumnFormatField, { label: "Solvent", checkControllerName: "showSolvent", hideFormatField: true }), _jsx(FormikColumnFormatField, { label: "Names", checkControllerName: "showNames", hideFormatField: true }), _jsx(FormikColumnFormatField, { label: "Range", checkControllerName: "range.show", formatControllerName: "range.format" }), _jsx(FormikColumnFormatField, { label: "\u03B4 (ppm)", checkControllerName: "delta.show", formatControllerName: "delta.format" }), _jsx(FormikColumnFormatField, { label: "Assignment", checkControllerName: "showAssignment", hideFormatField: true }), _jsx(FormikColumnFormatField, { label: "J (Hz)", checkControllerName: "coupling.show", formatControllerName: "coupling.format" }), _jsx(FormikColumnFormatField, { label: "Multiplicity", checkControllerName: "showMultiplicity", hideFormatField: true }), _jsx(FormikColumnFormatField, { label: "Save as nmrium", checkControllerName: "allowSaveAsNMRium", hideFormatField: true })] })] }) }) }));
30
+ return (_jsx(PreferencesContainer, { children: _jsx(Formik, { initialValues: {}, onSubmit: saveHandler, innerRef: formRef, children: _jsxs(_Fragment, { children: [_jsxs(PreferencesGroup, { children: [_jsx(FormikColumnFormatField, { label: "Preview jcamp", checkControllerName: "previewJcamp", hideFormatField: true }), _jsx(Label, { title: "Color", style: formatFieldLabelStyle, children: _jsx(FormikColorPickerDropdown, { name: "color" }) }), _jsx(Label, { title: "Margin bottom (px):", style: formatFieldLabelStyle, children: _jsx(FormikInput, { name: "marginBottom", type: "number", style: formatFieldInputStyle }) })] }), _jsxs(PreferencesGroup, { header: "Table Preferences", children: [_jsx(FormikColumnFormatField, { label: "Structure", checkControllerName: "showSmiles", hideFormatField: true }), _jsx(FormikColumnFormatField, { label: "Solvent", checkControllerName: "showSolvent", hideFormatField: true }), _jsx(FormikColumnFormatField, { label: "Names", checkControllerName: "showNames", hideFormatField: true }), _jsx(FormikColumnFormatField, { label: "Range", checkControllerName: "range.show", formatControllerName: "range.format" }), _jsx(FormikColumnFormatField, { label: "\u03B4 (ppm)", checkControllerName: "delta.show", formatControllerName: "delta.format" }), _jsx(FormikColumnFormatField, { label: "Assignment", checkControllerName: "showAssignment", hideFormatField: true }), _jsx(FormikColumnFormatField, { label: "J (Hz)", checkControllerName: "coupling.show", formatControllerName: "coupling.format" }), _jsx(FormikColumnFormatField, { label: "Multiplicity", checkControllerName: "showMultiplicity", hideFormatField: true }), _jsx(FormikColumnFormatField, { label: "Save as nmrium", checkControllerName: "allowSaveAsNMRium", hideFormatField: true })] })] }) }) }));
31
31
  }
32
32
  export default forwardRef(DatabasePreferences);
@@ -48,5 +48,5 @@ export function DatabaseSearchOptions({ databases, defaultDatabase, keywords, re
48
48
  alignItems: 'center',
49
49
  flex: 2,
50
50
  justifyContent: 'flex-end',
51
- }, children: [_jsx(CounterLabel, { value: formatCounterLabel(total || 0, result.data.length) }), _jsx(PreferencesButton, { title: "Preferences", onClick: onSettingClick })] })] }), _jsxs("div", { style: { display: 'flex', justifyContent: 'space-between' }, children: [_jsx(ToolBarButton, { title: "Filter by select ranges", icon: _jsx(FaICursor, {}), active: selectedTool === options.databaseRangesSelection.id, onClick: enableFilterHandler }), _jsx(Input, { value: keywords.searchKeywords, renderIcon: () => _jsx(IoSearchOutline, {}), style: { inputWrapper: { flex: 3, margin: '0 5px' } }, className: "search-input", type: "text", debounceTime: 250, placeholder: "Search for parameter...", onChange: handleSearch, onClear: clearHandler, canClear: true }), _jsx(ToolBarButton, { title: "Search by stricture", icon: !idCode ? _jsx(BsHexagon, {}) : _jsx(BsHexagonFill, {}), intent: "success", active: !!idCode, onClick: onStructureClick })] })] }));
51
+ }, children: [_jsx(CounterLabel, { value: formatCounterLabel(total || 0, result.data.length) }), _jsx(PreferencesButton, { title: "Preferences", onClick: onSettingClick })] })] }), _jsxs("div", { style: { display: 'flex', justifyContent: 'space-between' }, children: [_jsx(ToolBarButton, { title: "Filter by select ranges", icon: _jsx(FaICursor, {}), active: selectedTool === options.databaseRangesSelection.id, onClick: enableFilterHandler }), _jsx(Input, { value: keywords.searchKeywords, renderIcon: () => _jsx(IoSearchOutline, {}), style: { inputWrapper: { flex: 3, margin: '0 5px' } }, className: "search-input", type: "text", debounceTime: 250, placeholder: "Search for parameter...", onChange: handleSearch, onClear: clearHandler, canClear: true }), _jsx(ToolBarButton, { title: "Search by substructure", icon: !idCode ? _jsx(BsHexagon, {}) : _jsx(BsHexagonFill, {}), intent: "success", active: !!idCode, onClick: onStructureClick })] })] }));
52
52
  }
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
2
  import { useDispatch } from '../../context/DispatchContext';
3
- import { useAlert } from '../../elements/popup/Alert/Context';
3
+ import { useToaster } from '../../context/ToasterContext';
4
4
  import { useModal } from '../../elements/popup/Modal/Context';
5
5
  import { tablePanelStyle } from '../extra/BasicPanelStyle';
6
6
  import DefaultPanelHeader from '../header/DefaultPanelHeader';
@@ -8,13 +8,15 @@ import FiltersTable from './FiltersTable';
8
8
  export default function FiltersPanel() {
9
9
  const dispatch = useDispatch();
10
10
  const modal = useModal();
11
- const alert = useAlert();
11
+ const toaster = useToaster();
12
12
  function handelDeleteFilter() {
13
13
  const buttons = [
14
14
  {
15
15
  text: 'Yes',
16
16
  handler: async () => {
17
- const hideLoading = await alert.showLoading('Delete filters process in progress');
17
+ const hideLoading = toaster.showLoading({
18
+ message: 'Delete filters process in progress',
19
+ });
18
20
  dispatch({ type: 'DELETE_FILTER', payload: {} });
19
21
  hideLoading();
20
22
  },
@@ -5,10 +5,10 @@ import { FaRegTrashAlt } from 'react-icons/fa';
5
5
  import { ObjectInspector } from 'react-inspector';
6
6
  import { useChartData } from '../../context/ChartContext';
7
7
  import { useDispatch } from '../../context/DispatchContext';
8
+ import { useToaster } from '../../context/ToasterContext';
8
9
  import Button from '../../elements/Button';
9
10
  import { ColumnWrapper } from '../../elements/ColumnWrapper';
10
11
  import ReactTable from '../../elements/ReactTable/ReactTable';
11
- import { useAlert } from '../../elements/popup/Alert';
12
12
  import { useModal } from '../../elements/popup/Modal';
13
13
  import useSpectraByActiveNucleus from '../../hooks/useSpectraPerNucleus';
14
14
  import useSpectrum from '../../hooks/useSpectrum';
@@ -31,24 +31,26 @@ const rowColors = {
31
31
  function FiltersTableInner({ filters, spectraCounter, activeFilterID, }) {
32
32
  const dispatch = useDispatch();
33
33
  const modal = useModal();
34
- const alert = useAlert();
34
+ const toaster = useToaster();
35
35
  const selectedFilterIndex = useRef();
36
36
  const handelFilterCheck = useCallback((id, event) => {
37
37
  const { checked: enabled } = event.target;
38
- void (async () => {
39
- const hideLoading = await alert.showLoading(`${enabled ? 'Enable' : 'Disable'} filter in progress`);
40
- setTimeout(() => {
41
- dispatch({ type: 'ENABLE_FILTER', payload: { id, enabled } });
42
- hideLoading();
43
- }, 0);
44
- })();
45
- }, [alert, dispatch]);
38
+ const hideLoading = toaster.showLoading({
39
+ message: `${enabled ? 'Enable' : 'Disable'} filter in progress`,
40
+ });
41
+ setTimeout(() => {
42
+ dispatch({ type: 'ENABLE_FILTER', payload: { id, enabled } });
43
+ hideLoading();
44
+ }, 0);
45
+ }, [dispatch, toaster]);
46
46
  const handelDeleteFilter = useCallback(({ id, name, label }) => {
47
47
  const buttons = [
48
48
  {
49
49
  text: 'Yes',
50
- handler: async () => {
51
- const hideLoading = await alert.showLoading('Delete filter process in progress');
50
+ handler: () => {
51
+ const hideLoading = toaster.showLoading({
52
+ message: 'Delete filter process in progress',
53
+ });
52
54
  dispatch({ type: 'DELETE_FILTER', payload: { id } });
53
55
  hideLoading();
54
56
  },
@@ -58,8 +60,10 @@ function FiltersTableInner({ filters, spectraCounter, activeFilterID, }) {
58
60
  if (spectraCounter > 1) {
59
61
  buttons.unshift({
60
62
  text: 'Yes, for all spectra',
61
- handler: async () => {
62
- const hideLoading = await alert.showLoading('Delete all spectra filter process in progress');
63
+ handler: () => {
64
+ const hideLoading = toaster.showLoading({
65
+ message: 'Delete all spectra filter process in progress',
66
+ });
63
67
  dispatch({
64
68
  type: 'DELETE_SPECTRA_FILTER',
65
69
  payload: { filterName: name },
@@ -72,20 +76,20 @@ function FiltersTableInner({ filters, spectraCounter, activeFilterID, }) {
72
76
  message: (_jsxs("span", { children: ["You are about to delete this processing step", _jsxs("span", { style: { color: 'black' }, children: [" ", label, " "] }), " , Are you sure?"] })),
73
77
  buttons,
74
78
  }, { height: 'auto', width: 'auto' });
75
- }, [alert, dispatch, modal, spectraCounter]);
79
+ }, [dispatch, modal, spectraCounter, toaster]);
76
80
  const filterSnapShotHandler = useCallback((filter, index) => {
77
81
  selectedFilterIndex.current =
78
82
  selectedFilterIndex.current && index === selectedFilterIndex.current
79
83
  ? null
80
84
  : index;
81
- void (async () => {
82
- const hideLoading = await alert.showLoading('Filter snapshot process in progress');
83
- setTimeout(() => {
84
- dispatch({ type: 'SET_FILTER_SNAPSHOT', payload: filter });
85
- hideLoading();
86
- }, 0);
87
- })();
88
- }, [alert, dispatch]);
85
+ const hideLoading = toaster.showLoading({
86
+ message: 'Filter snapshot process in progress',
87
+ });
88
+ setTimeout(() => {
89
+ dispatch({ type: 'SET_FILTER_SNAPSHOT', payload: filter });
90
+ hideLoading();
91
+ }, 0);
92
+ }, [dispatch, toaster]);
89
93
  const COLUMNS = useMemo(() => [
90
94
  {
91
95
  Header: '#',
@@ -4,26 +4,28 @@ import { useCallback } from 'react';
4
4
  import { Toolbar } from 'react-science/ui';
5
5
  import { useChartData } from '../../context/ChartContext';
6
6
  import { useDispatch } from '../../context/DispatchContext';
7
- import { useAlert } from '../../elements/popup/Alert';
7
+ import { useToaster } from '../../context/ToasterContext';
8
8
  import { useCheckToolsVisibility } from '../../hooks/useCheckToolsVisibility';
9
9
  export function SpectraAutomaticPickingButton() {
10
10
  const dispatch = useDispatch();
11
- const alert = useAlert();
11
+ const toaster = useToaster();
12
12
  const { data } = useChartData();
13
13
  const isToolVisible = useCheckToolsVisibility();
14
14
  const automaticPickingHandler = useCallback(() => {
15
15
  void (async () => {
16
- const hideLoading = await alert.showLoading('Automatic Ranges/Zones detection for all spectra in progress');
16
+ const hideLoading = toaster.showLoading({
17
+ message: 'Automatic Ranges/Zones detection for all spectra in progress',
18
+ });
17
19
  setTimeout(() => {
18
20
  dispatch({ type: 'AUTO_RANGES_SPECTRA_PICKING' });
19
21
  dispatch({ type: 'AUTO_ZONES_SPECTRA_PICKING' });
20
22
  hideLoading();
21
23
  }, 0);
22
24
  })();
23
- }, [dispatch, alert]);
25
+ }, [toaster, dispatch]);
24
26
  if ((Array.isArray(data) && data.length === 0) ||
25
27
  !isToolVisible('autoRangeAndZonePicking')) {
26
28
  return null;
27
29
  }
28
- return (_jsx(Toolbar.Item, { icon: _jsx(SvgNmrRangePicking, {}), title: "Automatic Ranges/Zones picking for all spectra", onClick: automaticPickingHandler }));
30
+ return (_jsx(Toolbar.Item, { icon: _jsx(SvgNmrRangePicking, {}), title: "Automatic ranges/zones picking for all spectra", onClick: automaticPickingHandler }));
29
31
  }
@@ -7,7 +7,7 @@ import { useEffect, useState } from 'react';
7
7
  import * as Yup from 'yup';
8
8
  import { REFERENCES } from '../../../data/constants/References';
9
9
  import { useDispatch } from '../../context/DispatchContext';
10
- import Button from '../../elements/Button';
10
+ import ActionButtons from '../../elements/ActionButtons';
11
11
  import Label from '../../elements/Label';
12
12
  import Message from '../../elements/Message';
13
13
  import Select from '../../elements/Select';
@@ -131,6 +131,6 @@ function AlignSpectra({ onClose = () => null, nucleus }) {
131
131
  padding-top: 5px;
132
132
  }
133
133
  `;
134
- return (_jsx("div", { css: styles, children: _jsx(Formik, { initialValues: options, enableReinitialize: true, onSubmit: submitHandler, validationSchema: schemaValidation, validate: () => setError(''), children: ({ submitForm }) => (_jsxs(_Fragment, { children: [_jsxs("div", { className: "body", style: { flex: 1 }, children: [_jsx("div", { className: "header", children: _jsx("span", { children: "Spectra calibration" }) }), error && _jsx(Message, { type: "error", children: error }), _jsx(Label, { title: "Options", style: labelStyle, children: _jsx(Select, { items: List, style: { width: '100%', height: 30 }, onChange: optionChangeHandler }) }), _jsxs(Label, { title: "Range", style: labelStyle, children: [_jsx(Label, { title: "From", children: _jsx(FormikInput, { name: "from", type: "number", style: inputStyle }) }), _jsx(Label, { title: "To", style: { label: { padding: '0 10px' } }, children: _jsx(FormikInput, { name: "to", type: "number", style: inputStyle }) })] }), _jsx(Label, { title: "Number of Peaks", style: labelStyle, children: _jsx(FormikInput, { name: "nbPeaks", type: "number", style: inputStyle }) }), _jsx(Label, { title: "Target PPM", style: labelStyle, children: _jsx(FormikInput, { name: "targetX", type: "number", style: inputStyle }) })] }), _jsx("div", { className: "footer", children: _jsx(Button.Done, { style: { padding: '5px 14px', fontSize: 14 }, onClick: submitForm, children: "Done" }) })] })) }) }));
134
+ return (_jsx("div", { css: styles, children: _jsx(Formik, { initialValues: options, enableReinitialize: true, onSubmit: submitHandler, validationSchema: schemaValidation, validate: () => setError(''), children: ({ submitForm }) => (_jsxs(_Fragment, { children: [_jsxs("div", { className: "body", style: { flex: 1 }, children: [_jsx("div", { className: "header", children: _jsx("span", { children: "Spectra calibration" }) }), error && _jsx(Message, { type: "error", children: error }), _jsx(Label, { title: "Options", style: labelStyle, children: _jsx(Select, { items: List, style: { width: '100%', height: 30 }, onChange: optionChangeHandler }) }), _jsxs(Label, { title: "Range", style: labelStyle, children: [_jsx(Label, { title: "From", children: _jsx(FormikInput, { name: "from", type: "number", style: inputStyle }) }), _jsx(Label, { title: "To", style: { label: { padding: '0 10px' } }, children: _jsx(FormikInput, { name: "to", type: "number", style: inputStyle }) })] }), _jsx(Label, { title: "Number of peaks", style: labelStyle, children: _jsx(FormikInput, { name: "nbPeaks", type: "number", style: inputStyle }) }), _jsx(Label, { title: "Target PPM", style: labelStyle, children: _jsx(FormikInput, { name: "targetX", type: "number", style: inputStyle }) })] }), _jsx("div", { className: "footer", children: _jsx(ActionButtons, { onDone: submitForm, onCancel: onClose }) })] })) }) }));
135
135
  }
136
136
  export default AlignSpectra;
@@ -6,10 +6,10 @@ import { ResponsiveChart } from 'react-d3-utils';
6
6
  import { FaFileExport } from 'react-icons/fa';
7
7
  import { Axis, LineSeries, Plot } from 'react-plot';
8
8
  import { useChartData } from '../../context/ChartContext';
9
+ import { useToaster } from '../../context/ToasterContext';
9
10
  import Button from '../../elements/Button';
10
11
  import Input from '../../elements/Input';
11
12
  import Label from '../../elements/Label';
12
- import { useAlert } from '../../elements/popup/Alert';
13
13
  import useSpectraByActiveNucleus from '../../hooks/useSpectraPerNucleus';
14
14
  import { copyPNGToClipboard } from '../../utility/export';
15
15
  import { getSpectraObjectPaths } from '../../utility/getSpectraObjectPaths';
@@ -70,7 +70,7 @@ function getAnalysisColumnsPaths(spectraAnalysisData) {
70
70
  export default function AnalysisChart(props) {
71
71
  const { spectraAnalysisData } = props;
72
72
  const { data } = useChartData();
73
- const alert = useAlert();
73
+ const toaster = useToaster();
74
74
  const chartParentRef = useRef(null);
75
75
  const [plotOptions, setPlotOptions] = useState({
76
76
  xPath: '',
@@ -94,15 +94,15 @@ export default function AnalysisChart(props) {
94
94
  function handleCopy() {
95
95
  if (chartParentRef.current) {
96
96
  void copyPNGToClipboard(chartParentRef.current, svgId, css({ text: { fill: 'black' } }));
97
- alert.success('Chart copied to clipboard');
97
+ toaster.show({ message: 'Chart copied to clipboard', intent: 'success' });
98
98
  }
99
99
  }
100
100
  const plotData = usePlotData(spectraAnalysisData, { ...plotOptions, paths });
101
101
  const xLabel = paths?.[plotOptions.xPath]?.at(-1) || '';
102
102
  const yLabel = paths?.[plotOptions.yPath]?.at(-1) || '';
103
- return (_jsxs("div", { children: [_jsxs("div", { style: { display: 'flex', padding: '5px' }, children: [_jsx(Label, { title: "X ", children: _jsx(Input, { name: "xPath", style: {
103
+ return (_jsxs("div", { children: [_jsxs("div", { style: { display: 'flex', padding: '5px' }, children: [_jsx(Label, { title: "X", children: _jsx(Input, { name: "xPath", style: {
104
104
  input: { padding: '5px' },
105
- }, value: plotOptions.xPath, datalist: datalist, onChange: handleChangeKey }) }), _jsx(Label, { title: "Y ", style: { container: { paddingLeft: '5px' } }, children: _jsx(Input, { name: "yPath", style: {
105
+ }, value: plotOptions.xPath, datalist: datalist, onChange: handleChangeKey }) }), _jsx(Label, { title: "Y", style: { container: { paddingLeft: '5px' } }, children: _jsx(Input, { name: "yPath", style: {
106
106
  input: { padding: '5px' },
107
107
  }, value: plotOptions.yPath, datalist: datalist, onChange: handleChangeKey }) }), _jsx(Button.BarButton, { toolTip: "Copy chart to clipboard", onClick: handleCopy, children: _jsx(FaFileExport, {}) })] }), _jsx("div", { style: {
108
108
  width: '100%',
@@ -11,10 +11,10 @@ import { ClipboardFallbackModal } from '../../../utils/clipboard/clipboardCompon
11
11
  import { useClipboard } from '../../../utils/clipboard/clipboardHooks';
12
12
  import { useChartData } from '../../context/ChartContext';
13
13
  import { useDispatch } from '../../context/DispatchContext';
14
- import { useAlert } from '../../elements/popup/Alert';
14
+ import { useToaster } from '../../context/ToasterContext';
15
15
  import { usePanelPreferences } from '../../hooks/usePanelPreferences';
16
- import { getSpectraByNucleus } from '../../utility/getSpectraByNucleus';
17
16
  import { booleanToString } from '../../utility/booleanToString';
17
+ import { getSpectraByNucleus } from '../../utility/getSpectraByNucleus';
18
18
  import { tablePanelStyle } from '../extra/BasicPanelStyle';
19
19
  import DefaultPanelHeader from '../header/DefaultPanelHeader';
20
20
  import PreferencesHeader from '../header/PreferencesHeader';
@@ -30,7 +30,7 @@ function MultipleSpectraAnalysisPanelInner({ activeTab, spectra, showLegend, dis
30
30
  const [showAnalysisChart, toggleAnalysisChart] = useToggle(false);
31
31
  const spectraAnalysis = generateAnalyzeSpectra(preferences, spectra, activeTab);
32
32
  const settingRef = useRef();
33
- const alert = useAlert();
33
+ const toaster = useToaster();
34
34
  const dispatch = useDispatch();
35
35
  const settingsPanelHandler = useCallback(() => {
36
36
  setFlipStatus(!isFlipped);
@@ -49,8 +49,8 @@ function MultipleSpectraAnalysisPanelInner({ activeTab, spectra, showLegend, dis
49
49
  const data = getDataAsString(spectraAnalysis, spectra, spectraPreferences);
50
50
  if (!data)
51
51
  return;
52
- void rawWriteWithType(data).then(() => alert.success('Data copied to clipboard'));
53
- }, [alert, rawWriteWithType, spectra, spectraAnalysis, spectraPreferences]);
52
+ void rawWriteWithType(data).then(() => toaster.show({ message: 'Data copied to clipboard', intent: 'success' }));
53
+ }, [rawWriteWithType, spectra, spectraAnalysis, spectraPreferences, toaster]);
54
54
  function handleSpectraCalibration() {
55
55
  setCalibration((value) => {
56
56
  if (value)
@@ -61,7 +61,7 @@ function MultipleSpectraAnalysisPanelInner({ activeTab, spectra, showLegend, dis
61
61
  let lefButtons = [
62
62
  {
63
63
  icon: _jsx(FaFileExport, {}),
64
- title: 'Copy To Clipboard',
64
+ title: 'Copy to clipboard',
65
65
  onClick: copyToClipboardHandler,
66
66
  },
67
67
  ];
@@ -7,6 +7,7 @@ import { usePreferences } from '../../../context/PreferencesContext';
7
7
  import { GroupPane } from '../../../elements/GroupPane';
8
8
  import Label from '../../../elements/Label';
9
9
  import FormikCheckBox from '../../../elements/formik/FormikCheckBox';
10
+ import useCheckExperimentalFeature from '../../../hooks/useCheckExperimentalFeature';
10
11
  import { usePanelPreferences } from '../../../hooks/usePanelPreferences';
11
12
  import { PreferencesContainer } from '../../extra/preferences/PreferencesContainer';
12
13
  import { AnalysisTablePreferences } from './AnalysisTablePreferences';
@@ -34,6 +35,7 @@ function MultipleSpectraAnalysisPreferences({ data, activeTab, onAfterSave }, re
34
35
  const panelPreferences = usePanelPreferences('multipleSpectraAnalysis', activeTab);
35
36
  const preferences = usePreferences();
36
37
  const columns = getMultipleSpectraAnalysisData(panelPreferences);
38
+ const isExperimental = useCheckExperimentalFeature();
37
39
  useImperativeHandle(ref, () => ({
38
40
  saveSetting() {
39
41
  refForm.current.submitForm();
@@ -55,13 +57,13 @@ function MultipleSpectraAnalysisPreferences({ data, activeTab, onAfterSave }, re
55
57
  }, children: _jsx(LegendsPreferences, {}) }), _jsx(GroupPane, { text: "General", style: {
56
58
  header: { color: 'black' },
57
59
  container: { padding: '5px' },
58
- }, children: _jsx(Label, { title: "Enable resort spectra", htmlFor: "resortSpectra", children: _jsx(FormikCheckBox, { name: "resortSpectra" }) }) }), _jsx(GroupPane, { text: "Columns Settings ", style: {
60
+ }, children: _jsx(Label, { title: "Enable resort spectra", children: _jsx(FormikCheckBox, { name: "resortSpectra" }) }) }), _jsx(GroupPane, { text: "Columns Settings ", style: {
59
61
  header: { color: 'black' },
60
62
  container: { padding: '5px' },
61
- }, children: _jsx(AnalysisTablePreferences, {}) }), _jsx(GroupPane, { text: "Execute code ", style: {
63
+ }, children: _jsx(AnalysisTablePreferences, {}) }), isExperimental && (_jsx(GroupPane, { text: "Execute code ", style: {
62
64
  header: { color: 'black' },
63
65
  container: { padding: '5px' },
64
- }, children: _jsx(MultipleAnalysisCodeEditor, { data: data }) })] }) }) }));
66
+ }, children: _jsx(MultipleAnalysisCodeEditor, { data: data }) }))] }) }) }));
65
67
  }
66
68
  function columnSchema(columns) {
67
69
  return Yup.object().shape({
@@ -79,9 +79,9 @@ function PredictionOptionsPanel(props, ref) {
79
79
  const { options, onSubmit, hideName = false } = props;
80
80
  return (_jsx(Formik, { initialValues: options, validationSchema: predictionFormValidation, enableReinitialize: true, onSubmit: onSubmit, innerRef: ref, children: _jsxs(_Fragment, { children: [_jsx(FormikErrorsSummary, {}), !hideName && (_jsx(Label, { title: "Name", style: labelStyle, children: _jsx(FormikInput, { name: "name", style: inputStyle }) })), _jsx(Label, { title: "Frequency", style: labelStyle, children: _jsx(FormikSelect, { items: FREQUENCIES, style: styles.select, name: "frequency" }) }), _jsxs(GroupPane, { text: "1D Options", style: {
81
81
  header: styles.groupHeader,
82
- }, children: [_jsx(Label, { title: "Auto extend range", style: labelStyle, children: _jsx(FormikCheckBox, { name: "autoExtendRange" }) }), _jsxs(Label, { title: "1H", renderTitle: (title) => (_jsx(IsotopesViewer, { value: title, className: "custom-label" })), style: labelStyle, children: [_jsx(Label, { title: "From", children: _jsx(FormikInput, { name: "1d.1H.from", type: "number", style: inputStyle }) }), _jsx(Label, { title: "To", style: { label: { padding: '0 10px' } }, children: _jsx(FormikInput, { name: "1d.1H.to", type: "number", style: inputStyle }) })] }), _jsxs(Label, { title: "13C", renderTitle: (title) => (_jsx(IsotopesViewer, { value: title, className: "custom-label" })), style: labelStyle, children: [_jsx(Label, { title: "From", children: _jsx(FormikInput, { name: "1d.13C.from", type: "number", style: inputStyle }) }), _jsx(Label, { title: "To", style: { label: { padding: '0 10px' } }, children: _jsx(FormikInput, { name: "1d.13C.to", type: "number", style: inputStyle }) })] }), _jsxs(Label, { title: "Line Width", style: labelStyle, children: [_jsx(FormikInput, { name: "1d.lineWidth", type: "number", style: inputStyle }), _jsx("span", { style: { paddingLeft: '0.4rem' }, children: " Hz " })] }), _jsx(Label, { title: "Number of Points", style: labelStyle, children: _jsx(FormikSelect, { items: NUMBER_OF_POINTS_1D, name: "1d.nbPoints", style: styles.select }) })] }), _jsx(GroupPane, { text: "2D Options", style: {
82
+ }, children: [_jsx(Label, { title: "Auto extend range", style: labelStyle, children: _jsx(FormikCheckBox, { name: "autoExtendRange" }) }), _jsxs(Label, { title: "1H", renderTitle: (title) => (_jsx(IsotopesViewer, { value: title, className: "custom-label" })), style: labelStyle, children: [_jsx(Label, { title: "From", children: _jsx(FormikInput, { name: "1d.1H.from", type: "number", style: inputStyle }) }), _jsx(Label, { title: "To", style: { label: { padding: '0 10px' } }, children: _jsx(FormikInput, { name: "1d.1H.to", type: "number", style: inputStyle }) })] }), _jsxs(Label, { title: "13C", renderTitle: (title) => (_jsx(IsotopesViewer, { value: title, className: "custom-label" })), style: labelStyle, children: [_jsx(Label, { title: "From", children: _jsx(FormikInput, { name: "1d.13C.from", type: "number", style: inputStyle }) }), _jsx(Label, { title: "To", style: { label: { padding: '0 10px' } }, children: _jsx(FormikInput, { name: "1d.13C.to", type: "number", style: inputStyle }) })] }), _jsxs(Label, { title: "Line width", style: labelStyle, children: [_jsx(FormikInput, { name: "1d.lineWidth", type: "number", style: inputStyle }), _jsx("span", { style: { paddingLeft: '0.4rem' }, children: " Hz " })] }), _jsx(Label, { title: "Number of points", style: labelStyle, children: _jsx(FormikSelect, { items: NUMBER_OF_POINTS_1D, name: "1d.nbPoints", style: styles.select }) })] }), _jsx(GroupPane, { text: "2D Options", style: {
83
83
  header: styles.groupHeader,
84
- }, children: _jsxs(Label, { title: "Number of Points", style: labelStyle, children: [_jsx(FormikSelect, { items: NUMBER_OF_POINTS_2D, name: "2d.nbPoints.x", style: { margin: 0, height: 30 } }), _jsx("span", { style: { padding: '0 10px' }, children: " X " }), _jsx(FormikSelect, { items: NUMBER_OF_POINTS_2D, name: "2d.nbPoints.y", style: { margin: 0, height: 30 } })] }) }), _jsx(GroupPane, { text: "Spectra", style: {
84
+ }, children: _jsxs(Label, { title: "Number of points", style: labelStyle, children: [_jsx(FormikSelect, { items: NUMBER_OF_POINTS_2D, name: "2d.nbPoints.x", style: { margin: 0, height: 30 } }), _jsx("span", { style: { padding: '0 10px' }, children: " X " }), _jsx(FormikSelect, { items: NUMBER_OF_POINTS_2D, name: "2d.nbPoints.y", style: { margin: 0, height: 30 } })] }) }), _jsx(GroupPane, { text: "Spectra", style: {
85
85
  header: styles.groupHeader,
86
86
  }, children: _jsxs("div", { style: { display: 'flex', justifyContent: 'space-around' }, children: [_jsx(IsotopesOption, { title: "1H", name: "spectra.proton" }), _jsx(IsotopesOption, { title: "13C", name: "spectra.carbon" }), _jsx(IsotopesOption, { title: "COSY", name: "spectra.cosy" }), _jsx(IsotopesOption, { title: "HSQC", name: "spectra.hsqc" }), _jsx(IsotopesOption, { title: "HMBC", name: "spectra.hmbc" })] }) })] }) }));
87
87
  }
@@ -7,9 +7,9 @@ import { predictSpectra } from '../../../data/PredictionManager';
7
7
  import { useChartData } from '../../context/ChartContext';
8
8
  import { useDispatch } from '../../context/DispatchContext';
9
9
  import { useLogger } from '../../context/LoggerContext';
10
+ import { useToaster } from '../../context/ToasterContext';
10
11
  import Button from '../../elements/Button';
11
12
  import NextPrev from '../../elements/NextPrev';
12
- import { useAlert } from '../../elements/popup/Alert';
13
13
  import { usePanelPreferences } from '../../hooks/usePanelPreferences';
14
14
  import { useMoleculeEditor } from '../../modal/MoleculeStructureEditorModal';
15
15
  import MoleculeHeader from '../MoleculesPanel/MoleculeHeader';
@@ -31,7 +31,7 @@ const styles = {
31
31
  export default function PredictionPanel() {
32
32
  const { molecules, view: { molecules: moleculesView, predictions }, } = useChartData();
33
33
  const dispatch = useDispatch();
34
- const alert = useAlert();
34
+ const toaster = useToaster();
35
35
  const { logger } = useLogger();
36
36
  const [currentIndex, setCurrentIndex] = useState(0);
37
37
  const [molfile, setMolfile] = useState(null);
@@ -70,7 +70,9 @@ export default function PredictionPanel() {
70
70
  predictedSpectra.push(key);
71
71
  }
72
72
  }
73
- const hideLoading = await alert.showLoading(`Predict ${predictedSpectra.join(',')} in progress`);
73
+ const hideLoading = toaster.showLoading({
74
+ message: `Predict ${predictedSpectra.join(',')} in progress`,
75
+ });
74
76
  try {
75
77
  const data = await predictSpectra(molfile, predictionPreferences.spectra);
76
78
  dispatch({
@@ -88,14 +90,14 @@ export default function PredictionPanel() {
88
90
  }
89
91
  }
90
92
  catch (error) {
91
- alert.error(error.message);
93
+ toaster.show({ message: error.message, intent: 'danger' });
92
94
  }
93
95
  finally {
94
96
  hideLoading();
95
97
  }
96
98
  }
97
99
  else {
98
- alert.error('No Molecule selected');
100
+ toaster.show({ message: 'No Molecule selected', intent: 'danger' });
99
101
  }
100
102
  })();
101
103
  }
@@ -35,9 +35,10 @@ function PredictionSimpleOptions() {
35
35
  // eslint-disable-next-line @typescript-eslint/no-empty-function
36
36
  onSubmit: () => { }, children: _jsxs("div", { style: {
37
37
  display: 'flex',
38
+ flexWrap: 'wrap',
38
39
  justifyContent: 'flex-end',
39
40
  flex: '1',
40
41
  height: '100%',
41
- }, children: [_jsx(Label, { title: "Frequency", style: labelStyle, children: _jsx(FormikSelect, { items: FREQUENCIES, style: selectStyles, name: "frequency" }) }), _jsxs(Label, { title: "Line Width", style: labelStyle, children: [_jsx(FormikInput, { name: "1d.lineWidth", type: "number", style: { input: { width: '40px', textAlign: 'center' } } }), _jsx("span", { style: { padding: '0 5px' }, children: "Hz" })] }), _jsx(FormikOnChange, { enableValidation: true, onChange: optionsChangeHandler })] }) }));
42
+ }, children: [_jsx(Label, { title: "Frequency", style: labelStyle, children: _jsx(FormikSelect, { items: FREQUENCIES, style: selectStyles, name: "frequency" }) }), _jsxs(Label, { title: "Line width", style: labelStyle, children: [_jsx(FormikInput, { name: "1d.lineWidth", type: "number", style: { input: { width: '40px', textAlign: 'center' } } }), _jsx("span", { style: { padding: '0 5px' }, children: "Hz" })] }), _jsx(FormikOnChange, { enableValidation: true, onChange: optionsChangeHandler })] }) }));
42
43
  }
43
44
  export default PredictionSimpleOptions;
@@ -32,6 +32,6 @@ function SpectrumSimulationPreferences({ options, onSave }, ref) {
32
32
  void formRef.current?.submitForm();
33
33
  },
34
34
  }), []);
35
- return (_jsx(PreferencesContainer, { style: { backgroundColor: 'white' }, children: _jsx(Formik, { initialValues: options, onSubmit: onSave, innerRef: formRef, children: _jsxs(_Fragment, { children: [_jsx(Label, { title: "Frequency", style: labelStyle, children: _jsx(FormikSelect, { items: FREQUENCIES, style: selectStyles, name: "options.frequency" }) }), _jsx(Label, { title: "Number of Points", style: labelStyle, children: _jsx(FormikSelect, { items: SIMULATION_NUMBER_OF_POINTS, name: "options.nbPoints", style: selectStyles }) }), _jsxs(Label, { title: "Range", style: labelStyle, children: [_jsx(Label, { title: "From", children: _jsx(FormikInput, { name: "options.from", type: "number", style: inputStyle }) }), _jsx(Label, { title: "To", style: { label: { padding: '0 10px' } }, children: _jsx(FormikInput, { name: "options.to", type: "number", style: inputStyle }) })] }), _jsxs(Label, { title: "Line Width", style: labelStyle, children: [_jsx(FormikInput, { name: "options.lineWidth", type: "number", style: inputStyle }), _jsx("span", { style: { paddingLeft: '0.4rem' }, children: " Hz " })] })] }) }) }));
35
+ return (_jsx(PreferencesContainer, { style: { backgroundColor: 'white' }, children: _jsx(Formik, { initialValues: options, onSubmit: onSave, innerRef: formRef, children: _jsxs(_Fragment, { children: [_jsx(Label, { title: "Frequency", style: labelStyle, children: _jsx(FormikSelect, { items: FREQUENCIES, style: selectStyles, name: "options.frequency" }) }), _jsx(Label, { title: "Number of points", style: labelStyle, children: _jsx(FormikSelect, { items: SIMULATION_NUMBER_OF_POINTS, name: "options.nbPoints", style: selectStyles }) }), _jsxs(Label, { title: "Range", style: labelStyle, children: [_jsx(Label, { title: "From", children: _jsx(FormikInput, { name: "options.from", type: "number", style: inputStyle }) }), _jsx(Label, { title: "To", style: { label: { padding: '0 10px' } }, children: _jsx(FormikInput, { name: "options.to", type: "number", style: inputStyle }) })] }), _jsxs(Label, { title: "Line width", style: labelStyle, children: [_jsx(FormikInput, { name: "options.lineWidth", type: "number", style: inputStyle }), _jsx("span", { style: { paddingLeft: '0.4rem' }, children: " Hz " })] })] }) }) }));
36
36
  }
37
37
  export default forwardRef(SpectrumSimulationPreferences);
@@ -20,7 +20,7 @@ export default function SpectrumSimulationSimpleOptions({ onSpinSystemChange, sp
20
20
  display: 'flex',
21
21
  justifyContent: 'flex-end',
22
22
  flex: '1',
23
- }, children: [_jsx(Label, { title: "", style: labelStyle, children: _jsx(Select, { items: SPIN_SYSTEMS, style: selectStyles, onChange: onSpinSystemChange, value: spinSystem }) }), _jsx(Label, { title: "Frequency", style: labelStyle, children: _jsx(FormikSelect, { items: FREQUENCIES, style: selectStyles, name: "options.frequency" }) }), _jsxs(Label, { title: "Line Width", style: labelStyle, children: [_jsx(FormikInput, { name: "options.lineWidth", type: "number", style: {
23
+ }, children: [_jsx(Label, { title: "", style: labelStyle, children: _jsx(Select, { items: SPIN_SYSTEMS, style: selectStyles, onChange: onSpinSystemChange, value: spinSystem }) }), _jsx(Label, { title: "Frequency", style: labelStyle, children: _jsx(FormikSelect, { items: FREQUENCIES, style: selectStyles, name: "options.frequency" }) }), _jsxs(Label, { title: "Line width", style: labelStyle, children: [_jsx(FormikInput, { name: "options.lineWidth", type: "number", style: {
24
24
  input: {
25
25
  width: '40px',
26
26
  textAlign: 'center',
@@ -7,7 +7,7 @@ const ignoreActions = new Set([
7
7
  'SET_KEY_PREFERENCES',
8
8
  'SET_LOADING_FLAG',
9
9
  'SET_SELECTED_TOOL',
10
- 'SET_SPECTRUMS_VERTICAL_ALIGN',
10
+ 'SET_SPECTRA_VERTICAL_ALIGN',
11
11
  'SET_ONE_DIMENSION_PIVOT_POINT',
12
12
  'SET_TWO_DIMENSION_PIVOT_POINT',
13
13
  'SET_DIMENSIONS',