nmrium 2.4.0 → 2.5.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 (277) hide show
  1. package/lib/component/1d/HorizontalAxis1D.d.ts.map +1 -1
  2. package/lib/component/1d/HorizontalAxis1D.js +4 -1
  3. package/lib/component/1d/HorizontalAxis1D.js.map +1 -1
  4. package/lib/component/1d/SVGContent1D.d.ts.map +1 -1
  5. package/lib/component/1d/SVGContent1D.js +2 -1
  6. package/lib/component/1d/SVGContent1D.js.map +1 -1
  7. package/lib/component/1d/Viewer1D.d.ts.map +1 -1
  8. package/lib/component/1d/Viewer1D.js +2 -1
  9. package/lib/component/1d/Viewer1D.js.map +1 -1
  10. package/lib/component/1d/integral/IntegralResizable.d.ts.map +1 -1
  11. package/lib/component/1d/integral/IntegralResizable.js +4 -4
  12. package/lib/component/1d/integral/IntegralResizable.js.map +1 -1
  13. package/lib/component/1d/ranges/Range.d.ts.map +1 -1
  14. package/lib/component/1d/ranges/Range.js +3 -3
  15. package/lib/component/1d/ranges/Range.js.map +1 -1
  16. package/lib/component/1d/ranges/Signals.d.ts +2 -0
  17. package/lib/component/1d/ranges/Signals.d.ts.map +1 -0
  18. package/lib/component/1d/ranges/Signals.js +16 -0
  19. package/lib/component/1d/ranges/Signals.js.map +1 -0
  20. package/lib/component/1d-2d/components/RangeIndicator.d.ts +13 -0
  21. package/lib/component/1d-2d/components/RangeIndicator.d.ts.map +1 -0
  22. package/lib/component/1d-2d/components/RangeIndicator.js +52 -0
  23. package/lib/component/1d-2d/components/RangeIndicator.js.map +1 -0
  24. package/lib/component/1d-2d/components/Signals1D.d.ts +19 -0
  25. package/lib/component/1d-2d/components/Signals1D.d.ts.map +1 -0
  26. package/lib/component/1d-2d/components/Signals1D.js +155 -0
  27. package/lib/component/1d-2d/components/Signals1D.js.map +1 -0
  28. package/lib/component/1d-2d/tools/CrossLinePointer.d.ts +16 -1
  29. package/lib/component/1d-2d/tools/CrossLinePointer.d.ts.map +1 -1
  30. package/lib/component/1d-2d/tools/CrossLinePointer.js +25 -15
  31. package/lib/component/1d-2d/tools/CrossLinePointer.js.map +1 -1
  32. package/lib/component/1d-2d/tools/CursorToolIcon.d.ts +9 -0
  33. package/lib/component/1d-2d/tools/CursorToolIcon.d.ts.map +1 -0
  34. package/lib/component/1d-2d/tools/CursorToolIcon.js +58 -0
  35. package/lib/component/1d-2d/tools/CursorToolIcon.js.map +1 -0
  36. package/lib/component/2d/1d-tracer/Left1DChart.d.ts.map +1 -1
  37. package/lib/component/2d/1d-tracer/Left1DChart.js +3 -2
  38. package/lib/component/2d/1d-tracer/Left1DChart.js.map +1 -1
  39. package/lib/component/2d/1d-tracer/Ranges1D.d.ts.map +1 -1
  40. package/lib/component/2d/1d-tracer/Ranges1D.js +4 -60
  41. package/lib/component/2d/1d-tracer/Ranges1D.js.map +1 -1
  42. package/lib/component/2d/1d-tracer/Top1DChart.d.ts.map +1 -1
  43. package/lib/component/2d/1d-tracer/Top1DChart.js +3 -2
  44. package/lib/component/2d/1d-tracer/Top1DChart.js.map +1 -1
  45. package/lib/component/2d/DirectAxis2D.d.ts.map +1 -1
  46. package/lib/component/2d/DirectAxis2D.js +4 -1
  47. package/lib/component/2d/DirectAxis2D.js.map +1 -1
  48. package/lib/component/2d/IndirectAxis2D.d.ts.map +1 -1
  49. package/lib/component/2d/IndirectAxis2D.js +5 -2
  50. package/lib/component/2d/IndirectAxis2D.js.map +1 -1
  51. package/lib/component/2d/Viewer2D.d.ts.map +1 -1
  52. package/lib/component/2d/Viewer2D.js +2 -1
  53. package/lib/component/2d/Viewer2D.js.map +1 -1
  54. package/lib/component/AnchorSVG.d.ts +5 -6
  55. package/lib/component/AnchorSVG.d.ts.map +1 -1
  56. package/lib/component/AnchorSVG.js +9 -6
  57. package/lib/component/AnchorSVG.js.map +1 -1
  58. package/lib/component/EventsTrackers/BrushTracker.d.ts.map +1 -1
  59. package/lib/component/EventsTrackers/BrushTracker.js +14 -4
  60. package/lib/component/EventsTrackers/BrushTracker.js.map +1 -1
  61. package/lib/component/EventsTrackers/MouseTracker.d.ts +3 -0
  62. package/lib/component/EventsTrackers/MouseTracker.d.ts.map +1 -1
  63. package/lib/component/EventsTrackers/MouseTracker.js +15 -0
  64. package/lib/component/EventsTrackers/MouseTracker.js.map +1 -1
  65. package/lib/component/context/KeyModifierContext.d.ts +1 -0
  66. package/lib/component/context/KeyModifierContext.d.ts.map +1 -1
  67. package/lib/component/context/KeyModifierContext.js +22 -6
  68. package/lib/component/context/KeyModifierContext.js.map +1 -1
  69. package/lib/component/elements/D3Axis.d.ts.map +1 -1
  70. package/lib/component/elements/D3Axis.js +4 -3
  71. package/lib/component/elements/D3Axis.js.map +1 -1
  72. package/lib/component/header/AutoPeakPickingOptionPanel.d.ts.map +1 -1
  73. package/lib/component/header/AutoPeakPickingOptionPanel.js +59 -31
  74. package/lib/component/header/AutoPeakPickingOptionPanel.js.map +1 -1
  75. package/lib/component/header/RangesPickingOptionPanel.d.ts.map +1 -1
  76. package/lib/component/header/RangesPickingOptionPanel.js +34 -19
  77. package/lib/component/header/RangesPickingOptionPanel.js.map +1 -1
  78. package/lib/component/hooks/useAddMultipletSignal.d.ts +7 -0
  79. package/lib/component/hooks/useAddMultipletSignal.d.ts.map +1 -0
  80. package/lib/component/hooks/useAddMultipletSignal.js +28 -0
  81. package/lib/component/hooks/useAddMultipletSignal.js.map +1 -0
  82. package/lib/component/hooks/useFilter.d.ts.map +1 -1
  83. package/lib/component/hooks/useFilter.js.map +1 -1
  84. package/lib/component/hooks/useSpectrum.d.ts +3 -1
  85. package/lib/component/hooks/useSpectrum.d.ts.map +1 -1
  86. package/lib/component/hooks/useSpectrum.js +1 -1
  87. package/lib/component/hooks/useSpectrum.js.map +1 -1
  88. package/lib/component/hooks/useSpectrumWithDataSource.d.ts +1 -1
  89. package/lib/component/hooks/useSpectrumWithDataSource.d.ts.map +1 -1
  90. package/lib/component/hooks/useSpectrumWithDataSource.js.map +1 -1
  91. package/lib/component/hooks/useTempSpectrum.d.ts +1 -1
  92. package/lib/component/hooks/useTempSpectrum.d.ts.map +1 -1
  93. package/lib/component/hooks/use_ticks_config.d.ts +1 -4
  94. package/lib/component/hooks/use_ticks_config.d.ts.map +1 -1
  95. package/lib/component/hooks/use_ticks_config.js +1 -6
  96. package/lib/component/hooks/use_ticks_config.js.map +1 -1
  97. package/lib/component/modal/PublicationStringModal.d.ts +1 -1
  98. package/lib/component/modal/PublicationStringModal.d.ts.map +1 -1
  99. package/lib/component/modal/PublicationStringModal.js +2 -2
  100. package/lib/component/modal/PublicationStringModal.js.map +1 -1
  101. package/lib/component/modal/setting/tanstack_general_settings/errors/context.d.ts +118 -0
  102. package/lib/component/modal/setting/tanstack_general_settings/errors/context.d.ts.map +1 -1
  103. package/lib/component/modal/setting/tanstack_general_settings/errors/renderer.d.ts +118 -0
  104. package/lib/component/modal/setting/tanstack_general_settings/errors/renderer.d.ts.map +1 -1
  105. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_body.d.ts +118 -0
  106. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_body.d.ts.map +1 -1
  107. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_footer.d.ts +96 -0
  108. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_footer.d.ts.map +1 -1
  109. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_header.d.ts +96 -0
  110. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_header.d.ts.map +1 -1
  111. package/lib/component/modal/setting/tanstack_general_settings/hooks/use_safe_workspace.d.ts +16 -0
  112. package/lib/component/modal/setting/tanstack_general_settings/hooks/use_safe_workspace.d.ts.map +1 -1
  113. package/lib/component/modal/setting/tanstack_general_settings/tabs/auto_processing_tab.d.ts +96 -0
  114. package/lib/component/modal/setting/tanstack_general_settings/tabs/auto_processing_tab.d.ts.map +1 -1
  115. package/lib/component/modal/setting/tanstack_general_settings/tabs/axis_tab.d.ts +96 -0
  116. package/lib/component/modal/setting/tanstack_general_settings/tabs/axis_tab.d.ts.map +1 -1
  117. package/lib/component/modal/setting/tanstack_general_settings/tabs/axis_tab.js +12 -1
  118. package/lib/component/modal/setting/tanstack_general_settings/tabs/axis_tab.js.map +1 -1
  119. package/lib/component/modal/setting/tanstack_general_settings/tabs/database_tab.d.ts +96 -0
  120. package/lib/component/modal/setting/tanstack_general_settings/tabs/database_tab.d.ts.map +1 -1
  121. package/lib/component/modal/setting/tanstack_general_settings/tabs/export_tab.d.ts +96 -0
  122. package/lib/component/modal/setting/tanstack_general_settings/tabs/export_tab.d.ts.map +1 -1
  123. package/lib/component/modal/setting/tanstack_general_settings/tabs/external_api_tab.d.ts +96 -0
  124. package/lib/component/modal/setting/tanstack_general_settings/tabs/external_api_tab.d.ts.map +1 -1
  125. package/lib/component/modal/setting/tanstack_general_settings/tabs/general_tab.d.ts +96 -0
  126. package/lib/component/modal/setting/tanstack_general_settings/tabs/general_tab.d.ts.map +1 -1
  127. package/lib/component/modal/setting/tanstack_general_settings/tabs/import_filters_tab.d.ts +96 -0
  128. package/lib/component/modal/setting/tanstack_general_settings/tabs/import_filters_tab.d.ts.map +1 -1
  129. package/lib/component/modal/setting/tanstack_general_settings/tabs/nuclei_tab.d.ts +96 -0
  130. package/lib/component/modal/setting/tanstack_general_settings/tabs/nuclei_tab.d.ts.map +1 -1
  131. package/lib/component/modal/setting/tanstack_general_settings/tabs/panels_tab.d.ts +96 -0
  132. package/lib/component/modal/setting/tanstack_general_settings/tabs/panels_tab.d.ts.map +1 -1
  133. package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_colors_tab.d.ts +96 -0
  134. package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_colors_tab.d.ts.map +1 -1
  135. package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_label_tab.d.ts +96 -0
  136. package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_label_tab.d.ts.map +1 -1
  137. package/lib/component/modal/setting/tanstack_general_settings/tabs/title_block_tab.d.ts +96 -0
  138. package/lib/component/modal/setting/tanstack_general_settings/tabs/title_block_tab.d.ts.map +1 -1
  139. package/lib/component/modal/setting/tanstack_general_settings/tabs/tools_tab.d.ts +96 -0
  140. package/lib/component/modal/setting/tanstack_general_settings/tabs/tools_tab.d.ts.map +1 -1
  141. package/lib/component/modal/setting/tanstack_general_settings/validation/axis_tab_validation.d.ts +22 -0
  142. package/lib/component/modal/setting/tanstack_general_settings/validation/axis_tab_validation.d.ts.map +1 -1
  143. package/lib/component/modal/setting/tanstack_general_settings/validation/axis_tab_validation.js +15 -2
  144. package/lib/component/modal/setting/tanstack_general_settings/validation/axis_tab_validation.js.map +1 -1
  145. package/lib/component/modal/setting/tanstack_general_settings/validation.d.ts +22 -0
  146. package/lib/component/modal/setting/tanstack_general_settings/validation.d.ts.map +1 -1
  147. package/lib/component/panels/MoleculesPanel/hooks/useAtomAssignment.js +1 -1
  148. package/lib/component/panels/MoleculesPanel/hooks/useAtomAssignment.js.map +1 -1
  149. package/lib/component/panels/RangesPanel/RangesPanel.d.ts.map +1 -1
  150. package/lib/component/panels/RangesPanel/RangesPanel.js +1 -3
  151. package/lib/component/panels/RangesPanel/RangesPanel.js.map +1 -1
  152. package/lib/component/panels/RangesPanel/RangesTableRow.d.ts.map +1 -1
  153. package/lib/component/panels/RangesPanel/RangesTableRow.js +10 -12
  154. package/lib/component/panels/RangesPanel/RangesTableRow.js.map +1 -1
  155. package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.d.ts +1 -1
  156. package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.d.ts.map +1 -1
  157. package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.js +1 -1
  158. package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.js.map +1 -1
  159. package/lib/component/panels/filtersPanel/processings_sections_panel.d.ts.map +1 -1
  160. package/lib/component/panels/filtersPanel/processings_sections_panel.js +13 -23
  161. package/lib/component/panels/filtersPanel/processings_sections_panel.js.map +1 -1
  162. package/lib/component/panels/hooks/use_processings_mutation.d.ts +10 -0
  163. package/lib/component/panels/hooks/use_processings_mutation.d.ts.map +1 -0
  164. package/lib/component/panels/hooks/use_processings_mutation.js +130 -0
  165. package/lib/component/panels/hooks/use_processings_mutation.js.map +1 -0
  166. package/lib/component/panels/informationPanel/InformationPanel.js +1 -1
  167. package/lib/component/panels/informationPanel/InformationPanel.js.map +1 -1
  168. package/lib/component/reducer/Reducer.d.ts.map +1 -1
  169. package/lib/component/reducer/Reducer.js +2 -0
  170. package/lib/component/reducer/Reducer.js.map +1 -1
  171. package/lib/component/reducer/actions/CorrelationsActions.js +1 -1
  172. package/lib/component/reducer/actions/CorrelationsActions.js.map +1 -1
  173. package/lib/component/reducer/actions/FiltersActions.d.ts +2 -0
  174. package/lib/component/reducer/actions/FiltersActions.d.ts.map +1 -1
  175. package/lib/component/reducer/actions/FiltersActions.js +1 -1
  176. package/lib/component/reducer/actions/FiltersActions.js.map +1 -1
  177. package/lib/component/reducer/actions/RangesActions.d.ts.map +1 -1
  178. package/lib/component/reducer/actions/RangesActions.js +13 -24
  179. package/lib/component/reducer/actions/RangesActions.js.map +1 -1
  180. package/lib/component/reducer/actions/SpectraActions.d.ts +8 -2
  181. package/lib/component/reducer/actions/SpectraActions.d.ts.map +1 -1
  182. package/lib/component/reducer/actions/SpectraActions.js +6 -1
  183. package/lib/component/reducer/actions/SpectraActions.js.map +1 -1
  184. package/lib/component/reducer/preferences/actions/setPreferences.d.ts +2 -2
  185. package/lib/component/reducer/preferences/actions/setPreferences.d.ts.map +1 -1
  186. package/lib/component/reducer/preferences/actions/setPreferences.js +8 -5
  187. package/lib/component/reducer/preferences/actions/setPreferences.js.map +1 -1
  188. package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
  189. package/lib/component/reducer/preferences/preferencesReducer.d.ts.map +1 -1
  190. package/lib/component/toolbar/ToolTypes.d.ts +21 -1
  191. package/lib/component/toolbar/ToolTypes.d.ts.map +1 -1
  192. package/lib/component/toolbar/ToolTypes.js +40 -0
  193. package/lib/component/toolbar/ToolTypes.js.map +1 -1
  194. package/lib/component/toolbar/nmr_toolbar.d.ts.map +1 -1
  195. package/lib/component/toolbar/nmr_toolbar.js +9 -35
  196. package/lib/component/toolbar/nmr_toolbar.js.map +1 -1
  197. package/lib/component/workspaces/workspaceDefaultProperties.d.ts.map +1 -1
  198. package/lib/component/workspaces/workspaceDefaultProperties.js +19 -2
  199. package/lib/component/workspaces/workspaceDefaultProperties.js.map +1 -1
  200. package/lib/data/data1d/Spectrum1D/initiateDatum1D.d.ts.map +1 -1
  201. package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +13 -5
  202. package/lib/data/data1d/Spectrum1D/initiateDatum1D.js.map +1 -1
  203. package/lib/data/data2d/Spectrum2D/initiateDatum2D.d.ts.map +1 -1
  204. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +12 -4
  205. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js.map +1 -1
  206. package/lib/data/data2d/Spectrum2D/isSpectrum2D.d.ts +1 -1
  207. package/lib/data/data2d/Spectrum2D/isSpectrum2D.d.ts.map +1 -1
  208. package/lib/data/data2d/Spectrum2D/isSpectrum2D.js.map +1 -1
  209. package/lib/data/utilities/RangeUtilities.d.ts +1 -6
  210. package/lib/data/utilities/RangeUtilities.d.ts.map +1 -1
  211. package/lib/data/utilities/RangeUtilities.js +10 -27
  212. package/lib/data/utilities/RangeUtilities.js.map +1 -1
  213. package/lib/versionInfo.js +1 -1
  214. package/package.json +15 -14
  215. package/src/component/1d/HorizontalAxis1D.tsx +12 -2
  216. package/src/component/1d/SVGContent1D.tsx +2 -0
  217. package/src/component/1d/Viewer1D.tsx +2 -0
  218. package/src/component/1d/integral/IntegralResizable.tsx +6 -6
  219. package/src/component/1d/ranges/Range.tsx +6 -6
  220. package/src/component/1d/ranges/Signals.tsx +28 -0
  221. package/src/component/1d-2d/components/RangeIndicator.tsx +106 -0
  222. package/src/component/1d-2d/components/Signals1D.tsx +306 -0
  223. package/src/component/1d-2d/tools/CrossLinePointer.tsx +75 -32
  224. package/src/component/1d-2d/tools/CursorToolIcon.tsx +110 -0
  225. package/src/component/2d/1d-tracer/Left1DChart.tsx +4 -2
  226. package/src/component/2d/1d-tracer/Ranges1D.tsx +4 -100
  227. package/src/component/2d/1d-tracer/Top1DChart.tsx +4 -2
  228. package/src/component/2d/DirectAxis2D.tsx +12 -3
  229. package/src/component/2d/IndirectAxis2D.tsx +9 -5
  230. package/src/component/2d/Viewer2D.tsx +5 -2
  231. package/src/component/AnchorSVG.tsx +27 -28
  232. package/src/component/EventsTrackers/BrushTracker.tsx +21 -7
  233. package/src/component/EventsTrackers/MouseTracker.tsx +21 -0
  234. package/src/component/context/KeyModifierContext.tsx +27 -8
  235. package/src/component/elements/D3Axis.tsx +31 -9
  236. package/src/component/header/AutoPeakPickingOptionPanel.tsx +173 -102
  237. package/src/component/header/RangesPickingOptionPanel.tsx +72 -59
  238. package/src/component/hooks/useAddMultipletSignal.tsx +32 -0
  239. package/src/component/hooks/useFilter.ts +2 -1
  240. package/src/component/hooks/useSpectrum.ts +7 -1
  241. package/src/component/hooks/useSpectrumWithDataSource.ts +16 -8
  242. package/src/component/hooks/use_ticks_config.ts +1 -7
  243. package/src/component/modal/PublicationStringModal.tsx +3 -3
  244. package/src/component/modal/setting/tanstack_general_settings/tabs/axis_tab.tsx +76 -12
  245. package/src/component/modal/setting/tanstack_general_settings/validation/axis_tab_validation.ts +16 -2
  246. package/src/component/panels/MoleculesPanel/hooks/useAtomAssignment.tsx +1 -1
  247. package/src/component/panels/RangesPanel/RangesPanel.tsx +1 -3
  248. package/src/component/panels/RangesPanel/RangesTableRow.tsx +10 -12
  249. package/src/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.tsx +2 -2
  250. package/src/component/panels/filtersPanel/processings_sections_panel.tsx +27 -44
  251. package/src/component/panels/hooks/use_processings_mutation.ts +171 -0
  252. package/src/component/panels/informationPanel/InformationPanel.tsx +1 -1
  253. package/src/component/reducer/Reducer.ts +2 -0
  254. package/src/component/reducer/actions/CorrelationsActions.ts +1 -1
  255. package/src/component/reducer/actions/FiltersActions.ts +1 -1
  256. package/src/component/reducer/actions/RangesActions.ts +14 -25
  257. package/src/component/reducer/actions/SpectraActions.ts +20 -1
  258. package/src/component/reducer/preferences/actions/setPreferences.ts +18 -10
  259. package/src/component/reducer/preferences/preferencesReducer.ts +1 -1
  260. package/src/component/toolbar/ToolTypes.ts +92 -1
  261. package/src/component/toolbar/nmr_toolbar.tsx +12 -69
  262. package/src/component/workspaces/workspaceDefaultProperties.ts +19 -2
  263. package/src/data/data1d/Spectrum1D/initiateDatum1D.ts +14 -8
  264. package/src/data/data2d/Spectrum2D/initiateDatum2D.ts +12 -4
  265. package/src/data/data2d/Spectrum2D/isSpectrum2D.ts +1 -1
  266. package/src/data/utilities/RangeUtilities.ts +12 -36
  267. package/src/versionInfo.ts +1 -1
  268. package/lib/component/1d/integral/IntegralIndicator.d.ts +0 -9
  269. package/lib/component/1d/integral/IntegralIndicator.d.ts.map +0 -1
  270. package/lib/component/1d/integral/IntegralIndicator.js +0 -22
  271. package/lib/component/1d/integral/IntegralIndicator.js.map +0 -1
  272. package/lib/component/2d/1d-tracer/Signals1D.d.ts +0 -11
  273. package/lib/component/2d/1d-tracer/Signals1D.d.ts.map +0 -1
  274. package/lib/component/2d/1d-tracer/Signals1D.js +0 -90
  275. package/lib/component/2d/1d-tracer/Signals1D.js.map +0 -1
  276. package/src/component/1d/integral/IntegralIndicator.tsx +0 -43
  277. package/src/component/2d/1d-tracer/Signals1D.tsx +0 -145
@@ -163,6 +163,15 @@ type UpdateSpectrumMetaAction = ActionType<
163
163
  }
164
164
  >;
165
165
 
166
+ type SetSpectrumAction = ActionType<
167
+ 'SET_SPECTRUM',
168
+ {
169
+ index: number;
170
+ spectrum: Spectrum;
171
+ onProduce: (draft: Draft<State>, processedSpectrum: Spectrum) => void;
172
+ }
173
+ >;
174
+
166
175
  export type SpectrumActions =
167
176
  | ActionType<'TOGGLE_SPECTRA_LEGEND'>
168
177
  | ChangeSpectrumVisibilityByIdAction
@@ -176,7 +185,8 @@ export type SpectrumActions =
176
185
  | ImportSpectraMetaInfoAction
177
186
  | ReColorSpectraBasedOnDistinctValueAction
178
187
  | SimulateSpectrumAction
179
- | UpdateSpectrumMetaAction;
188
+ | UpdateSpectrumMetaAction
189
+ | SetSpectrumAction;
180
190
 
181
191
  function checkIsVisible2D(datum: Spectrum2D): boolean {
182
192
  if (!datum.display.isPositiveVisible && !datum.display.isNegativeVisible) {
@@ -808,6 +818,14 @@ function handleUpdateSpectrumMeta(
808
818
  }
809
819
  }
810
820
 
821
+ function setSpectrum(draft: Draft<State>, action: SetSpectrumAction) {
822
+ const { index, spectrum, onProduce } = action.payload;
823
+
824
+ draft.data[index] = spectrum;
825
+
826
+ onProduce(draft, spectrum);
827
+ }
828
+
811
829
  export {
812
830
  handleAddMissingProjectionHandler,
813
831
  handleAlignSpectraHandler,
@@ -823,4 +841,5 @@ export {
823
841
  handleToggleSpectraLegend,
824
842
  handleUpdateSpectrumMeta,
825
843
  setSpectraMetaInfo,
844
+ setSpectrum,
826
845
  };
@@ -1,22 +1,30 @@
1
1
  import type { Draft } from 'immer';
2
+ import { original } from 'immer';
2
3
  import cloneDeep from 'lodash/cloneDeep.js';
3
4
 
4
- import type { PreferencesState } from '../preferencesReducer.js';
5
+ import type {
6
+ PreferencesState,
7
+ SetPreferencesAction,
8
+ WorkspaceWithSource,
9
+ } from '../preferencesReducer.js';
5
10
  import { getActiveWorkspace } from '../utilities/getActiveWorkspace.js';
6
11
 
7
- export function setPreferences(draft: Draft<PreferencesState>, action: any) {
8
- const currentWorkspacePreferences = getActiveWorkspace(draft);
12
+ export function setPreferences(
13
+ draft: Draft<PreferencesState>,
14
+ action: SetPreferencesAction,
15
+ ) {
16
+ const currentWorkspacePreferences = getActiveWorkspace(original(draft));
9
17
 
10
- if (action.payload) {
18
+ if ('payload' in action) {
11
19
  const preferences = action.payload;
12
20
 
13
- draft.workspaces[draft.workspace.current] = {
21
+ draft.workspaces[draft.workspace.current] = cloneDeep({
14
22
  ...currentWorkspacePreferences,
15
23
  ...preferences,
16
- };
24
+ }) as WorkspaceWithSource;
25
+ } else {
26
+ draft.originalWorkspaces[draft.workspace.current] = cloneDeep(
27
+ original(draft.workspaces[draft.workspace.current]),
28
+ );
17
29
  }
18
-
19
- draft.originalWorkspaces[draft.workspace.current] = cloneDeep(
20
- draft.workspaces[draft.workspace.current],
21
- );
22
30
  }
@@ -84,7 +84,7 @@ type InitPreferencesAction = ActionType<
84
84
  }
85
85
  >;
86
86
 
87
- type SetPreferencesAction =
87
+ export type SetPreferencesAction =
88
88
  | ActionType<'SET_PREFERENCES', Partial<Workspace>>
89
89
  | ActionType<'SET_PREFERENCES'>;
90
90
 
@@ -1,12 +1,58 @@
1
1
  import type { Info1D, Info2D } from '@zakodium/nmr-types';
2
2
  import type { NMRiumToolbarPreferences } from '@zakodium/nmrium-core';
3
+ import {
4
+ SvgNmrAlignBottom,
5
+ SvgNmrAlignCenter,
6
+ SvgNmrApodization,
7
+ SvgNmrBaselineCorrection,
8
+ SvgNmrFourierTransform,
9
+ SvgNmrIntegrate,
10
+ SvgNmrMultipleAnalysis,
11
+ SvgNmrOverlay3,
12
+ SvgNmrOverlay3Aligned,
13
+ SvgNmrPeakPicking,
14
+ SvgNmrPhaseCorrection,
15
+ SvgNmrRangePicking,
16
+ SvgNmrRealImag,
17
+ SvgNmrZeroFilling,
18
+ } from 'cheminfo-font';
3
19
  import { Filters1D, Filters2D } from 'nmr-processing';
20
+ import type { ComponentType } from 'react';
21
+ import {
22
+ FaDiceFour,
23
+ FaExpand,
24
+ FaFileExport,
25
+ FaFileImport,
26
+ FaICursor,
27
+ } from 'react-icons/fa';
28
+ import { PiKnifeBold, PiSelectionPlusDuotone } from 'react-icons/pi';
29
+ import { TbZoom } from 'react-icons/tb';
4
30
 
5
31
  import type { DisplayerMode } from '../reducer/Reducer.js';
6
32
 
7
33
  type InfoKey = keyof Info1D | keyof Info2D;
8
34
 
9
- export interface ToolOptionItem {
35
+ interface StaticIcon {
36
+ icon: ToolIconComponent;
37
+ getIcon?: never;
38
+ }
39
+
40
+ interface DynamicIcon {
41
+ icon?: never;
42
+ getIcon: (ctx: IconDataContext) => ToolIconComponent;
43
+ }
44
+ export interface IconOptions {
45
+ fontSize?: number;
46
+ strokeWidth?: number;
47
+ }
48
+
49
+ export type ToolIconComponent = ComponentType<IconOptions>;
50
+
51
+ export interface IconDataContext {
52
+ verticalAlign?: 'bottom' | 'center' | 'stack';
53
+ isRealSpectrumShown?: boolean;
54
+ }
55
+ interface BaseToolOption {
10
56
  id: Tool;
11
57
  label: string;
12
58
  mode?: DisplayerMode;
@@ -32,6 +78,8 @@ export interface ToolOptionItem {
32
78
  isExperimental?: true;
33
79
  }
34
80
 
81
+ export type ToolOptionItem = BaseToolOption & (StaticIcon | DynamicIcon);
82
+
35
83
  export type MainTool = keyof NMRiumToolbarPreferences;
36
84
 
37
85
  /**
@@ -47,6 +95,7 @@ export const options: RecordOptions = {
47
95
  zoom: {
48
96
  id: 'zoom',
49
97
  label: 'Zoom in / out',
98
+ icon: TbZoom,
50
99
  hasOptionPanel: false,
51
100
  isFilter: false,
52
101
  isToggle: true,
@@ -54,6 +103,7 @@ export const options: RecordOptions = {
54
103
  peakPicking: {
55
104
  id: 'peakPicking',
56
105
  label: 'Peaks picking',
106
+ icon: SvgNmrPeakPicking,
57
107
  hasOptionPanel: true,
58
108
  isFilter: false,
59
109
  mode: '1D',
@@ -69,6 +119,7 @@ export const options: RecordOptions = {
69
119
  integral: {
70
120
  id: 'integral',
71
121
  label: 'Integral Tool',
122
+ icon: SvgNmrIntegrate,
72
123
  hasOptionPanel: false,
73
124
  isFilter: false,
74
125
  mode: '1D',
@@ -82,6 +133,7 @@ export const options: RecordOptions = {
82
133
  inset: {
83
134
  id: 'inset',
84
135
  label: 'Inset Tool',
136
+ icon: PiSelectionPlusDuotone,
85
137
  hasOptionPanel: false,
86
138
  isFilter: false,
87
139
  mode: '1D',
@@ -95,6 +147,7 @@ export const options: RecordOptions = {
95
147
  zonePicking: {
96
148
  id: 'zonePicking',
97
149
  label: 'Zone tool',
150
+ icon: FaDiceFour,
98
151
  hasOptionPanel: true,
99
152
  isFilter: false,
100
153
  mode: '2D',
@@ -108,6 +161,7 @@ export const options: RecordOptions = {
108
161
  slicing: {
109
162
  id: 'slicing',
110
163
  label: 'Slicing tool',
164
+ icon: PiKnifeBold,
111
165
  hasOptionPanel: false,
112
166
  isFilter: false,
113
167
  mode: '2D',
@@ -121,6 +175,7 @@ export const options: RecordOptions = {
121
175
  rangePicking: {
122
176
  id: 'rangePicking',
123
177
  label: 'Range picking and multiplet analysis',
178
+ icon: SvgNmrRangePicking,
124
179
  hasOptionPanel: true,
125
180
  isFilter: false,
126
181
  mode: '1D',
@@ -134,6 +189,7 @@ export const options: RecordOptions = {
134
189
  apodization: {
135
190
  id: Filters1D.apodization.name,
136
191
  label: Filters1D.apodization.label,
192
+ icon: SvgNmrApodization,
137
193
  hasOptionPanel: true,
138
194
  isFilter: true,
139
195
  mode: '1D',
@@ -150,6 +206,7 @@ export const options: RecordOptions = {
150
206
  zeroFilling: {
151
207
  id: Filters1D.zeroFilling.name,
152
208
  label: Filters1D.zeroFilling.label,
209
+ icon: SvgNmrZeroFilling,
153
210
  hasOptionPanel: true,
154
211
  isFilter: true,
155
212
  mode: '1D',
@@ -166,6 +223,7 @@ export const options: RecordOptions = {
166
223
  zeroFillingDimension1: {
167
224
  id: Filters2D.zeroFillingDimension1.name,
168
225
  label: Filters2D.zeroFillingDimension1.label,
226
+ icon: SvgNmrZeroFilling,
169
227
  hasOptionPanel: true,
170
228
  isFilter: true,
171
229
  mode: '2D',
@@ -182,6 +240,7 @@ export const options: RecordOptions = {
182
240
  zeroFillingDimension2: {
183
241
  id: Filters2D.zeroFillingDimension2.name,
184
242
  label: Filters2D.zeroFillingDimension2.label,
243
+ icon: SvgNmrZeroFilling,
185
244
  hasOptionPanel: true,
186
245
  isFilter: true,
187
246
  mode: '2D',
@@ -199,6 +258,7 @@ export const options: RecordOptions = {
199
258
  phaseCorrection: {
200
259
  id: Filters1D.phaseCorrection.name,
201
260
  label: Filters1D.phaseCorrection.label,
261
+ icon: SvgNmrPhaseCorrection,
202
262
  hasOptionPanel: true,
203
263
  isFilter: true,
204
264
  mode: '1D',
@@ -215,6 +275,7 @@ export const options: RecordOptions = {
215
275
  baselineCorrection: {
216
276
  id: Filters1D.baselineCorrection.name,
217
277
  label: Filters1D.baselineCorrection.label,
278
+ icon: SvgNmrBaselineCorrection,
218
279
  hasOptionPanel: true,
219
280
  isFilter: true,
220
281
  mode: '1D',
@@ -228,6 +289,7 @@ export const options: RecordOptions = {
228
289
  multipleSpectraAnalysis: {
229
290
  id: 'multipleSpectraAnalysis',
230
291
  label: 'Multiple spectra integration',
292
+ icon: SvgNmrMultipleAnalysis,
231
293
  hasOptionPanel: false,
232
294
  isFilter: false,
233
295
  mode: '1D',
@@ -242,6 +304,7 @@ export const options: RecordOptions = {
242
304
  exclusionZones: {
243
305
  id: 'exclusionZones',
244
306
  label: 'Exclusion zones',
307
+ icon: SvgNmrMultipleAnalysis,
245
308
  hasOptionPanel: false,
246
309
  isFilter: true,
247
310
  mode: '1D',
@@ -266,6 +329,7 @@ export const options: RecordOptions = {
266
329
  ],
267
330
  selectedSpectra: { min: 0 },
268
331
  isToggle: true,
332
+ icon: SvgNmrMultipleAnalysis,
269
333
  },
270
334
  databaseRangesSelection: {
271
335
  id: 'databaseRangesSelection',
@@ -279,10 +343,12 @@ export const options: RecordOptions = {
279
343
  },
280
344
  ],
281
345
  isToggle: true,
346
+ icon: FaICursor,
282
347
  },
283
348
  exportAs: {
284
349
  id: 'exportAs',
285
350
  label: 'Export as',
351
+ icon: FaFileExport,
286
352
  hasOptionPanel: false,
287
353
  isFilter: false,
288
354
  isToggle: false,
@@ -290,6 +356,7 @@ export const options: RecordOptions = {
290
356
  fft: {
291
357
  id: 'fft',
292
358
  label: 'Fourier transform',
359
+ icon: SvgNmrFourierTransform,
293
360
  hasOptionPanel: false,
294
361
  isFilter: true,
295
362
  mode: '1D',
@@ -306,6 +373,7 @@ export const options: RecordOptions = {
306
373
  fftDimension1: {
307
374
  id: 'fftDimension1',
308
375
  label: 'Fourier transform dimension 1',
376
+ icon: SvgNmrFourierTransform,
309
377
  hasOptionPanel: false,
310
378
  isFilter: true,
311
379
  mode: '2D',
@@ -322,6 +390,7 @@ export const options: RecordOptions = {
322
390
  fftDimension2: {
323
391
  id: 'fftDimension2',
324
392
  label: 'Fourier transform dimension 2',
393
+ icon: SvgNmrFourierTransform,
325
394
  hasOptionPanel: false,
326
395
  isFilter: true,
327
396
  mode: '2D',
@@ -339,6 +408,7 @@ export const options: RecordOptions = {
339
408
  phaseCorrectionTwoDimensions: {
340
409
  id: 'phaseCorrectionTwoDimensions',
341
410
  label: 'Phase correction two dimension',
411
+ icon: SvgNmrPhaseCorrection,
342
412
  hasOptionPanel: true,
343
413
  isFilter: true,
344
414
  mode: '2D',
@@ -352,6 +422,7 @@ export const options: RecordOptions = {
352
422
  import: {
353
423
  id: 'import',
354
424
  label: 'Import',
425
+ icon: FaFileImport,
355
426
  hasOptionPanel: false,
356
427
  isFilter: false,
357
428
  isToggle: false,
@@ -359,6 +430,7 @@ export const options: RecordOptions = {
359
430
  realImaginary: {
360
431
  id: 'realImaginary',
361
432
  label: 'Real / Imaginary',
433
+ icon: SvgNmrRealImag,
362
434
  hasOptionPanel: false,
363
435
  isFilter: false,
364
436
  mode: '1D',
@@ -372,6 +444,9 @@ export const options: RecordOptions = {
372
444
  spectraCenterAlignments: {
373
445
  id: 'spectraCenterAlignments',
374
446
  label: 'Align spectrum',
447
+ // depends on current vertical alignment state
448
+ getIcon: (idc: IconDataContext) =>
449
+ idc.verticalAlign === 'bottom' ? SvgNmrAlignCenter : SvgNmrAlignBottom,
375
450
  hasOptionPanel: false,
376
451
  isFilter: false,
377
452
  mode: '1D',
@@ -380,6 +455,9 @@ export const options: RecordOptions = {
380
455
  spectraStackAlignments: {
381
456
  id: 'spectraStackAlignments',
382
457
  label: 'Stack spectra',
458
+ // depends on current vertical alignment state
459
+ getIcon: (idc: IconDataContext) =>
460
+ idc.verticalAlign === 'stack' ? SvgNmrOverlay3Aligned : SvgNmrOverlay3,
383
461
  hasOptionPanel: false,
384
462
  isFilter: false,
385
463
  mode: '1D',
@@ -394,6 +472,7 @@ export const options: RecordOptions = {
394
472
  zoomOut: {
395
473
  id: 'zoomOut',
396
474
  label: 'Zoom out',
475
+ icon: FaExpand,
397
476
  hasOptionPanel: false,
398
477
  isFilter: false,
399
478
  isToggle: false,
@@ -404,10 +483,12 @@ export const options: RecordOptions = {
404
483
  hasOptionPanel: false,
405
484
  isFilter: false,
406
485
  isToggle: false,
486
+ icon: SvgNmrRangePicking,
407
487
  },
408
488
  apodizationDimension1: {
409
489
  id: Filters2D.apodizationDimension1.name,
410
490
  label: Filters2D.apodizationDimension1.label,
491
+ icon: SvgNmrApodization,
411
492
  hasOptionPanel: true,
412
493
  isFilter: true,
413
494
  mode: '2D',
@@ -421,6 +502,7 @@ export const options: RecordOptions = {
421
502
  apodizationDimension2: {
422
503
  id: Filters2D.apodizationDimension2.name,
423
504
  label: Filters2D.apodizationDimension2.label,
505
+ icon: SvgNmrApodization,
424
506
  hasOptionPanel: true,
425
507
  isFilter: true,
426
508
  mode: '2D',
@@ -436,3 +518,12 @@ export const options: RecordOptions = {
436
518
  isToggle: true,
437
519
  },
438
520
  };
521
+
522
+ export function getToolIcon(
523
+ id: Tool,
524
+ idc: IconDataContext = {},
525
+ ): ToolIconComponent | undefined {
526
+ const option = options[id];
527
+
528
+ return 'getIcon' in option ? option.getIcon?.(idc) : option.icon;
529
+ }
@@ -1,29 +1,5 @@
1
- import {
2
- SvgNmrAlignBottom,
3
- SvgNmrAlignCenter,
4
- SvgNmrApodization,
5
- SvgNmrBaselineCorrection,
6
- SvgNmrFourierTransform,
7
- SvgNmrIntegrate,
8
- SvgNmrMultipleAnalysis,
9
- SvgNmrOverlay3,
10
- SvgNmrOverlay3Aligned,
11
- SvgNmrPeakPicking,
12
- SvgNmrPhaseCorrection,
13
- SvgNmrRangePicking,
14
- SvgNmrRealImag,
15
- SvgNmrZeroFilling,
16
- } from 'cheminfo-font';
17
1
  import { useCallback } from 'react';
18
- import {
19
- FaDiceFour,
20
- FaDownload,
21
- FaExpand,
22
- FaFileExport,
23
- FaFileImport,
24
- } from 'react-icons/fa';
25
- import { PiKnifeBold, PiSelectionPlusDuotone } from 'react-icons/pi';
26
- import { TbZoom } from 'react-icons/tb';
2
+ import { FaDownload } from 'react-icons/fa';
27
3
  import type { ToolbarItemProps, TooltipItem } from 'react-science/ui';
28
4
  import { Toolbar, TooltipHelpContent } from 'react-science/ui';
29
5
 
@@ -51,14 +27,15 @@ import { LoadJCAMPModal } from '../modal/LoadJCAMPModal.js';
51
27
  import SaveAsModal from '../modal/SaveAsModal.js';
52
28
  import { MetaImportationModal } from '../modal/metaImportation/MetaImportationModal.js';
53
29
 
54
- import type { MainTool } from './ToolTypes.js';
55
- import { options } from './ToolTypes.js';
30
+ import type { IconOptions, MainTool } from './ToolTypes.js';
31
+ import { getToolIcon, options } from './ToolTypes.js';
56
32
  import type { ExportMenuItems } from './toolbarMenu.js';
57
33
  import { EXPORT_MENU, IMPORT_MENU } from './toolbarMenu.js';
58
34
 
59
- interface BaseToolItem extends Pick<ToolbarItemProps, 'icon' | 'disabled'> {
35
+ interface BaseToolItem extends Pick<ToolbarItemProps, 'disabled'> {
60
36
  id: MainTool;
61
37
  isVisible?: boolean;
38
+ iconProps?: IconOptions;
62
39
  }
63
40
  interface ToolItem extends BaseToolItem {
64
41
  onClick?: () => void;
@@ -226,7 +203,9 @@ export default function NMRToolbar() {
226
203
  ],
227
204
  style: { minWidth: '300px' },
228
205
  },
229
- icon: <TbZoom strokeWidth={3} />,
206
+ iconProps: {
207
+ strokeWidth: 3,
208
+ },
230
209
  },
231
210
  {
232
211
  id: 'zoomOut',
@@ -240,7 +219,6 @@ export default function NMRToolbar() {
240
219
  link: 'https://docs.nmrium.org/help/zoom-and-scale',
241
220
  },
242
221
  onClick: handleFullZoomOut,
243
- icon: <FaExpand />,
244
222
  },
245
223
  {
246
224
  id: 'peakPicking',
@@ -250,8 +228,6 @@ export default function NMRToolbar() {
250
228
  description: 'Detect peaks manually or automatically in the spectrum.',
251
229
  link: 'https://docs.nmrium.org/help/peaks',
252
230
  },
253
-
254
- icon: <SvgNmrPeakPicking />,
255
231
  },
256
232
  {
257
233
  id: 'integral',
@@ -261,7 +237,6 @@ export default function NMRToolbar() {
261
237
  description: `Manually integrate the spectrum. Click, drag, and release ${!invert ? 'while holding SHIFT' : ''} to draw the integral. Resize the integrals by moving the edges. Cut an integral with ${!invert ? 'SHIFT +' : ''} click.`,
262
238
  link: 'https://docs.nmrium.org/help/integrations',
263
239
  },
264
- icon: <SvgNmrIntegrate />,
265
240
  },
266
241
  {
267
242
  id: 'zonePicking',
@@ -271,7 +246,6 @@ export default function NMRToolbar() {
271
246
  description: `Draw 2D zones by clicking, dragging, and releasing${!invert ? 'while holding SHIFT' : ''}. Alternatively, detect zones automatically.`,
272
247
  link: 'https://docs.nmrium.org/30_2d-spectra/zones',
273
248
  },
274
- icon: <FaDiceFour />,
275
249
  },
276
250
  {
277
251
  id: 'slicing',
@@ -281,7 +255,6 @@ export default function NMRToolbar() {
281
255
  'Display the horizontal and vertical slices of the selected 2D spectrum at the level of the pointer.',
282
256
  link: 'https://docs.nmrium.org/30_2d-spectra/slicing',
283
257
  },
284
- icon: <PiKnifeBold />,
285
258
  },
286
259
  {
287
260
  id: 'rangePicking',
@@ -291,7 +264,6 @@ export default function NMRToolbar() {
291
264
  description: `Define ranges and analyse multiplet automatically or manually. Click, drag, and release ${!invert ? 'while holding SHIFT' : ''} to draw the range. Ranges can be resized by moving the edges.`,
292
265
  link: 'https://docs.nmrium.org/help/ranges',
293
266
  },
294
- icon: <SvgNmrRangePicking />,
295
267
  },
296
268
  {
297
269
  id: 'multipleSpectraAnalysis',
@@ -301,7 +273,6 @@ export default function NMRToolbar() {
301
273
  description:
302
274
  'Integrate multiple spectra at once and adjust integration zones by dragging their edges.',
303
275
  },
304
- icon: <SvgNmrMultipleAnalysis />,
305
276
  isVisible: ftCounter > 0,
306
277
  },
307
278
  {
@@ -313,21 +284,18 @@ export default function NMRToolbar() {
313
284
  'Apply mathematical function that the FID is multiplied by before Fourier Transform.',
314
285
  link: 'https://docs.nmrium.org/help/apodization',
315
286
  },
316
- icon: <SvgNmrApodization />,
317
287
  },
318
288
  {
319
289
  id: 'apodizationDimension1',
320
290
  tooltip: {
321
291
  title: options.apodizationDimension1.label,
322
292
  },
323
- icon: <SvgNmrApodization />,
324
293
  },
325
294
  {
326
295
  id: 'apodizationDimension2',
327
296
  tooltip: {
328
297
  title: options.apodizationDimension2.label,
329
298
  },
330
- icon: <SvgNmrApodization />,
331
299
  },
332
300
  {
333
301
  id: 'zeroFilling',
@@ -338,7 +306,6 @@ export default function NMRToolbar() {
338
306
  'Improve spectrum quality by increasing the number of points. By default, the number of points is twice as many as in the original FID.',
339
307
  link: 'https://docs.nmrium.org/help/zero-filling',
340
308
  },
341
- icon: <SvgNmrZeroFilling />,
342
309
  },
343
310
  {
344
311
  id: 'zeroFillingDimension1',
@@ -347,7 +314,6 @@ export default function NMRToolbar() {
347
314
  description:
348
315
  'Improve spectrum quality by increasing the number of points',
349
316
  },
350
- icon: <SvgNmrZeroFilling />,
351
317
  },
352
318
  {
353
319
  id: 'zeroFillingDimension2',
@@ -356,7 +322,6 @@ export default function NMRToolbar() {
356
322
  description:
357
323
  'Improve spectrum quality by increasing the number of points.',
358
324
  },
359
- icon: <SvgNmrZeroFilling />,
360
325
  },
361
326
  {
362
327
  id: 'phaseCorrection',
@@ -366,7 +331,6 @@ export default function NMRToolbar() {
366
331
  description: `Correct the spectrum phase manually or automatically. For manual phase correction, define the pivot${!invert ? ' using SHIFT +' : ''} click, then press the PH0 and PH1 button, and move the mouse horizontally.`,
367
332
  link: 'https://docs.nmrium.org/help/phase',
368
333
  },
369
- icon: <SvgNmrPhaseCorrection />,
370
334
  },
371
335
  {
372
336
  id: 'phaseCorrectionTwoDimensions',
@@ -375,7 +339,6 @@ export default function NMRToolbar() {
375
339
  shortcuts: ['a'],
376
340
  description: 'To phase the spectrum after the FFT.',
377
341
  },
378
- icon: <SvgNmrPhaseCorrection />,
379
342
  isVisible: isQuadrants2DSpectrum(spectrum),
380
343
  },
381
344
  {
@@ -386,7 +349,6 @@ export default function NMRToolbar() {
386
349
  description: `Correct the baseline of the spectrum. You should draw zones corresponding to the noise using click, drag, release${!invert ? 'while holding SHIFT' : ''}.`,
387
350
  link: 'https://docs.nmrium.org/help/baseline',
388
351
  },
389
- icon: <SvgNmrBaselineCorrection />,
390
352
  },
391
353
  {
392
354
  id: 'exclusionZones',
@@ -395,7 +357,6 @@ export default function NMRToolbar() {
395
357
  shortcuts: ['e'],
396
358
  description: `Define exclusion zones by clicking, dragging, releasing${!invert ? ' while holding SHIFT' : ''}. This option is practical for excluding large peaks like solvents.`,
397
359
  },
398
- icon: <SvgNmrMultipleAnalysis />,
399
360
  isVisible: ftCounter > 0,
400
361
  },
401
362
  {
@@ -407,31 +368,26 @@ export default function NMRToolbar() {
407
368
  link: 'https://docs.nmrium.org/help/ft',
408
369
  },
409
370
  onClick: handleOnFFTFilter,
410
- icon: <SvgNmrFourierTransform />,
411
371
  },
412
372
  {
413
373
  id: 'fftDimension1',
414
374
  tooltip: options.fftDimension1.label,
415
375
  onClick: handleFFtDimension1Filter,
416
- icon: <SvgNmrFourierTransform />,
417
376
  },
418
377
  {
419
378
  id: 'fftDimension2',
420
379
  tooltip: options.fftDimension2.label,
421
380
  onClick: handleFFtDimension2Filter,
422
- icon: <SvgNmrFourierTransform />,
423
381
  },
424
382
  {
425
383
  id: 'import',
426
384
  tooltip: options.import.label,
427
- icon: <FaFileImport />,
428
385
  menuItems: importMenu,
429
386
  onClick: importHandler,
430
387
  },
431
388
  {
432
389
  id: 'exportAs',
433
390
  tooltip: options.exportAs.label,
434
- icon: <FaFileExport />,
435
391
  menuItems: exportMenu,
436
392
  onClick: exportHandler,
437
393
  },
@@ -443,12 +399,6 @@ export default function NMRToolbar() {
443
399
  description:
444
400
  'Toggle between stack mode and all the spectra aligned at the bottom.',
445
401
  },
446
- icon:
447
- verticalAlign === 'stack' ? (
448
- <SvgNmrOverlay3Aligned />
449
- ) : (
450
- <SvgNmrOverlay3 />
451
- ),
452
402
  isVisible: ftCounter > 1,
453
403
  onClick: changeDisplayViewModeHandler,
454
404
  },
@@ -459,7 +409,6 @@ export default function NMRToolbar() {
459
409
  description:
460
410
  'Toggle between the imaginary and real parts of the spectrum.',
461
411
  },
462
- icon: <SvgNmrRealImag />,
463
412
  onClick: changeSpectrumViewHandler,
464
413
  },
465
414
  {
@@ -470,12 +419,6 @@ export default function NMRToolbar() {
470
419
  description:
471
420
  'Toggle between alignment of the spectra in the center or at the bottom of the display.',
472
421
  },
473
- icon:
474
- verticalAlign === 'bottom' ? (
475
- <SvgNmrAlignCenter />
476
- ) : (
477
- <SvgNmrAlignBottom />
478
- ),
479
422
  isVisible: ftCounter > 0 || fidCounter > 0,
480
423
  onClick: alignSpectraVerticallyHandler,
481
424
  },
@@ -487,7 +430,6 @@ export default function NMRToolbar() {
487
430
  description:
488
431
  'Drag a rectangle over the spectrum region to create an inset.',
489
432
  },
490
- icon: <PiSelectionPlusDuotone />,
491
433
  },
492
434
  ];
493
435
  return (
@@ -507,7 +449,8 @@ export default function NMRToolbar() {
507
449
  <SaveAsModal isOpen={dialog.saveAs} onCloseDialog={closeDialog} />
508
450
  <Toolbar vertical>
509
451
  {toolItems.map((item) => {
510
- const { id, icon, tooltip, disabled, isVisible } = item;
452
+ const { id, tooltip, disabled, isVisible, iconProps } = item;
453
+ const Icon = getToolIcon(id, { verticalAlign, isRealSpectrumShown });
511
454
  const isToolVisible =
512
455
  isButtonVisible(id) && (isVisible === undefined || isVisible);
513
456
 
@@ -531,7 +474,7 @@ export default function NMRToolbar() {
531
474
  }}
532
475
  id={id}
533
476
  active={selectedTool === id}
534
- icon={icon}
477
+ icon={Icon && <Icon {...iconProps} />}
535
478
  onClick={onClick}
536
479
  disabled={disabled}
537
480
  />
@@ -556,7 +499,7 @@ export default function NMRToolbar() {
556
499
  }}
557
500
  id={id}
558
501
  active={selectedTool === id}
559
- icon={icon}
502
+ icon={Icon && <Icon {...iconProps} />}
560
503
  disabled={disabled}
561
504
  />
562
505
  );