Skip to content

Commit

Permalink
feat: use nmr-load-save (#1753)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Kostro <kostro.d@gmail.com>
  • Loading branch information
jobo322 and stropitek committed Sep 22, 2022
1 parent ff529ed commit 11a6fa3
Show file tree
Hide file tree
Showing 26 changed files with 249 additions and 1,398 deletions.
7 changes: 4 additions & 3 deletions .eslintrc.yml
Expand Up @@ -10,9 +10,6 @@ rules:
'@typescript-eslint/restrict-plus-operands': off
'jest/no-standalone-expect': off
'react/no-unstable-nested-components': off
'react/no-unknown-property':
- error
- ignore: ['css']
no-restricted-properties:
- warn
- property: reduce
Expand All @@ -27,5 +24,9 @@ rules:
message: "Use 'openchemlib/full'"
- name: react-ocl
message: "Use 'react-ocl/full"
react/no-unknown-property:
- error
- ignore:
- 'css'
parserOptions:
sourceType: module
206 changes: 201 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -74,7 +74,8 @@
"ml-stat": "^1.3.3",
"multiplet-analysis": "^2.0.0",
"nmr-correlation": "^2.3.3",
"nmr-parser": "^1.9.1",
"nmr-load-save": "^0.2.1",
"nmr-parser": "^2.0.1",
"nmr-processing": "^9.1.0",
"nmredata": "^0.7.1",
"numeral": "^2.0.6",
Expand Down
21 changes: 0 additions & 21 deletions src/component/hooks/useExport.tsx
Expand Up @@ -9,11 +9,9 @@ import SaveAsModal from '../modal/SaveAsModal';
import {
copyPNGToClipboard,
exportAsJSON,
exportAsNMRE,
exportAsPng,
exportAsSVG,
} from '../utility/Export';
import { nmriumToNmredata } from '../utility/nmriumToNmredata';

export default function useExport() {
const { rootRef } = useGlobal();
Expand Down Expand Up @@ -62,24 +60,6 @@ export default function useExport() {
[alert, state],
);

const saveAsNMREHandler = useCallback(async () => {
if (state.data.length > 0) {
const hideLoading = await alert.showLoading(
'Exporting as NMRE process in progress',
);
setTimeout(() => {
async function handle() {
const fileName = state.data[0]?.display?.name;
const exportedData = await nmriumToNmredata(state);
exportAsNMRE(exportedData, fileName);
hideLoading();
}

void handle();
}, 0);
}
}, [alert, state]);

const saveAsSVGHandler = useCallback(async () => {
if (state.data.length > 0 && rootRef) {
const hideLoading = await alert.showLoading(
Expand Down Expand Up @@ -141,7 +121,6 @@ export default function useExport() {
return {
saveToClipboardHandler,
saveAsJSONHandler,
saveAsNMREHandler,
saveAsSVGHandler,
saveAsPNGHandler,
saveAsHandler,
Expand Down

0 comments on commit 11a6fa3

Please sign in to comment.