From 439688c4cae2338d398629c959c0f0615a0b496c Mon Sep 17 00:00:00 2001 From: Luc Patiny Date: Fri, 2 Apr 2021 09:21:22 +0200 Subject: [PATCH] feat: rename component to NMRium --- README.md | 4 ++-- package.json | 8 ++++---- src/component/{NMRDisplayer.tsx => NMRium.tsx} | 8 ++++---- src/component/reducer/Reducer.ts | 2 +- src/component/reducer/actions/LoadActions.ts | 6 +----- src/demo/views/Exam.jsx | 4 ++-- src/demo/views/Exercise.jsx | 4 ++-- src/demo/views/SingleView.jsx | 4 ++-- src/demo/views/Test.jsx | 4 ++-- src/demo/views/TwoInstances.jsx | 6 +++--- src/demo/views/View.jsx | 4 ++-- 11 files changed, 25 insertions(+), 29 deletions(-) rename src/component/{NMRDisplayer.tsx => NMRium.tsx} (99%) diff --git a/README.md b/README.md index cfb367b25..54b4e635f 100644 --- a/README.md +++ b/README.md @@ -80,10 +80,10 @@ from `openchemlib/full` to avoid having multiple OCL versions in your bundle. ### Use the component ```jsx -import NMRDisplayer from 'nmr-displayer'; +import NMRium from 'nmr-displayer'; function MyComponent() { - return ; + return ; } ``` diff --git a/package.json b/package.json index 843fb5f72..e84c93aa3 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,10 @@ { - "name": "nmr-displayer", + "name": "nmrium", "version": "0.8.1", "license": "MIT", - "main": "lib-cjs/component/NMRDisplayer.js", - "module": "lib/component/NMRDisplayer.js", - "types": "lib/component/NMRDisplayer.d.ts", + "main": "lib-cjs/component/NMRium.js", + "module": "lib/component/NMRium.js", + "types": "lib/component/NMRium.d.ts", "files": [ "lib", "lib-cjs" diff --git a/src/component/NMRDisplayer.tsx b/src/component/NMRium.tsx similarity index 99% rename from src/component/NMRDisplayer.tsx rename to src/component/NMRium.tsx index 9065ce47a..27d2bf882 100644 --- a/src/component/NMRDisplayer.tsx +++ b/src/component/NMRium.tsx @@ -185,7 +185,7 @@ export interface NMRDisplayerData { spectra: Spectra; } -function NMRDisplayer({ +function NMRium({ data: dataProp, onDataChange, docsBaseUrl, @@ -386,7 +386,7 @@ function NMRDisplayer({ ); } -NMRDisplayer.propTypes = { +NMRium.propTypes = { docsBaseUrl: PropTypes.string, onDataChange: PropTypes.func, preferences: PropTypes.shape({ @@ -422,7 +422,7 @@ NMRDisplayer.propTypes = { }), }; -NMRDisplayer.defaultProps = { +NMRium.defaultProps = { docsBaseUrl: 'https://cheminfo.github.io/nmr-displayer/docs/v0', onDataChange: () => null, preferences: { @@ -464,4 +464,4 @@ NMRDisplayer.defaultProps = { }, }; -export default memo(NMRDisplayer); +export default memo(NMRium); diff --git a/src/component/reducer/Reducer.ts b/src/component/reducer/Reducer.ts index 1daf3de76..e2883be29 100644 --- a/src/component/reducer/Reducer.ts +++ b/src/component/reducer/Reducer.ts @@ -4,7 +4,7 @@ import { predictionProton } from 'nmr-processing'; import OCL from 'openchemlib/full'; import * as SpectraManager from '../../data/SpectraManager'; -import { Spectra } from '../NMRDisplayer'; +import { Spectra } from '../NMRium'; import { DefaultTolerance } from '../panels/SummaryPanel/CorrelationTable/Constants'; import { options } from '../toolbar/ToolTypes'; diff --git a/src/component/reducer/actions/LoadActions.ts b/src/component/reducer/actions/LoadActions.ts index ccb510d39..b248dbd3b 100644 --- a/src/component/reducer/actions/LoadActions.ts +++ b/src/component/reducer/actions/LoadActions.ts @@ -7,11 +7,7 @@ import { initiateDatum1D } from '../../../data/data1d/Datum1D'; import { initiateDatum2D } from '../../../data/data2d/Datum2D'; import * as MoleculeManager from '../../../data/molecules/MoleculeManager'; import generateID from '../../../data/utilities/generateID'; -import { - Molecules, - NMRDisplayerPreferences, - Spectra, -} from '../../NMRDisplayer'; +import { Molecules, NMRDisplayerPreferences, Spectra } from '../../NMRium'; import { DefaultTolerance } from '../../panels/SummaryPanel/CorrelationTable/Constants'; import { State } from '../Reducer'; diff --git a/src/demo/views/Exam.jsx b/src/demo/views/Exam.jsx index dc2e1d2c6..2d3b2a00a 100644 --- a/src/demo/views/Exam.jsx +++ b/src/demo/views/Exam.jsx @@ -6,7 +6,7 @@ import { FaRegCopy, FaCheck } from 'react-icons/fa'; import { MF } from 'react-mf'; import { StructureEditor } from 'react-ocl/full'; -import NMRDisplayer from '../../component/NMRDisplayer'; +import NMRium from '../../component/NMRium'; import { copyTextToClipboard } from '../../component/utility/Export.js'; let answers = JSON.parse(localStorage.getItem('nmrium-exams') || '{}'); @@ -220,7 +220,7 @@ export default function Exam(props) { css={nmrContainer} style={{ height: answerAreaVisible ? '50%' : 'calc(100% - 25px)' }} > - - )} - + ); } diff --git a/src/demo/views/Test.jsx b/src/demo/views/Test.jsx index d33342e46..a08bf267d 100644 --- a/src/demo/views/Test.jsx +++ b/src/demo/views/Test.jsx @@ -1,6 +1,6 @@ import { useState, useEffect } from 'react'; -import NMRDisplayer from '../../component/NMRDisplayer'; +import NMRium from '../../component/NMRium'; async function loadData(file) { const response = await fetch(file); @@ -62,7 +62,7 @@ export default function Test(props) { {title}

)} - )}
- +
- +
); diff --git a/src/demo/views/View.jsx b/src/demo/views/View.jsx index 6c0d63bd2..1f68b5a09 100644 --- a/src/demo/views/View.jsx +++ b/src/demo/views/View.jsx @@ -1,7 +1,7 @@ import { useState, useEffect, useCallback } from 'react'; import { ObjectInspector } from 'react-inspector'; -import NMRDisplayer from '../../component/NMRDisplayer'; +import NMRium from '../../component/NMRium'; async function loadData(file) { const response = await fetch(file); @@ -113,7 +113,7 @@ export default function View(props) { >
- +
{process.env.NODE_ENV !== 'production' && (