Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8ebae0a
chore: artifact version upgraded from 3 to 4
sriramkanakam87 Feb 10, 2025
86d3f52
chore: upgraded checkout and setup node actions
sriramkanakam87 Feb 10, 2025
90f0460
Merge pull request #238 from NFDI4Chem/chore-artifact-version-bump
sriramkanakam87 Sep 4, 2025
bd24044
chore: update dependencies
hamed-musallam Sep 19, 2025
569abf0
chore: whitelist new ELN origin - https://eln.crc1333.de/
NishaSharma14 Oct 30, 2025
62727c9
chore: update dependencies
hamed-musallam Oct 20, 2025
83e3fc9
feat: update NMRium to version 1.6.1
hamed-musallam Oct 20, 2025
3e156ff
chore: update dependencies
hamed-musallam Jan 20, 2026
95c0dac
feat: update NMRium to version 1.10.1
hamed-musallam Jan 20, 2026
deb8c93
feat: create a new integration workspace
hamed-musallam Jan 20, 2026
9898a58
chore: update dependencies
hamed-musallam Jan 29, 2026
26d3874
feat: update NMRium to version 1.11.0
hamed-musallam Jan 29, 2026
ddb79b5
chore: add more test cases
hamed-musallam Jan 29, 2026
bb243c7
fix: load data
hamed-musallam Jan 29, 2026
0bca688
chore: update dependencies
hamed-musallam Feb 19, 2026
2c9599d
feat: update NMRium to version 1.12
hamed-musallam Feb 19, 2026
db616e4
test: update Triplinine test to use nmr-wrapper:load
hamed-musallam Feb 19, 2026
fd824db
chore: update dependencies
hamed-musallam Mar 6, 2026
2081ce4
feat: update nmrium to version 2.0.0
hamed-musallam Mar 6, 2026
606f0b5
fix: debounce data-change event for SET_2D_LEVEL action
hamed-musallam Mar 6, 2026
6ea0043
Revert "fix: debounce data-change event for SET_2D_LEVEL action"
hamed-musallam Mar 6, 2026
70f4530
fix: skip data-change event for SET_2D_LEVEL action
hamed-musallam Mar 6, 2026
81bed0a
fix: trigger data-change event when loading data
hamed-musallam Mar 13, 2026
f1b889d
chore: update dependencies
hamed-musallam Apr 16, 2026
e4aa9c5
chore: update dependencies
hamed-musallam May 5, 2026
2e019b6
feat: update NMRium to version 2.1.0
hamed-musallam May 5, 2026
c1284d1
chore: update package-lock.json
hamed-musallam May 5, 2026
bd8e722
Merge branch 'main' into development
hamed-musallam May 5, 2026
fe6f001
chore(build): update docker node version to 24-alpine3.22
hamed-musallam May 5, 2026
29130c9
chore(build-prod): update docker node version to 24-alpine3.22
hamed-musallam May 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# build environment
FROM node:22-alpine3.18 AS build
FROM node:24-alpine3.22 AS build

WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build stage
FROM node:22-alpine3.18 AS builder
FROM node:24-alpine3.22 AS builder

# Declare build argument
ARG RELEASE_VERSION
Expand Down
7,127 changes: 3,618 additions & 3,509 deletions package-lock.json

Large diffs are not rendered by default.

54 changes: 27 additions & 27 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@
"node": "24.4.0"
},
"dependencies": {
"@blueprintjs/core": "^6.2.1",
"@blueprintjs/icons": "^6.1.0",
"@blueprintjs/select": "^6.0.3",
"@blueprintjs/core": "^6.12.1",
"@blueprintjs/icons": "^6.9.1",
"@blueprintjs/select": "^6.1.10",
"@emotion/styled": "^11.14.1",
"@vitejs/plugin-react": "^5.0.2",
"@zakodium/nmrium-core": "^0.1.7",
"@zakodium/nmrium-core-plugins": "^0.1.10",
"@vitejs/plugin-react": "^6.0.1",
"@zakodium/nmrium-core": "^0.7.16",
"@zakodium/nmrium-core-plugins": "^0.7.20",
"fifo-logger": "^2.0.1",
"filelist-utils": "^1.11.3",
"nmr-processing": "^19.1.0",
"nmrium": "^1.3.0",
"openchemlib": "^9.7.0",
"react-science": "^19.1.0"
"nmr-processing": "^22.10.0",
"nmrium": "^2.1.0",
"openchemlib": "^9.22.1",
"react-science": "^19.11.0"
},
"scripts": {
"start": "vite --host localhost --port 3000 --open",
Expand All @@ -43,28 +43,28 @@
"test-e2e-server": "serve -l tcp://localhost:3000 dist"
},
"devDependencies": {
"@babel/plugin-transform-modules-commonjs": "^7.27.1",
"@babel/preset-react": "^7.27.1",
"@babel/preset-typescript": "^7.27.1",
"@playwright/test": "^1.55.0",
"@babel/plugin-transform-modules-commonjs": "^7.28.6",
"@babel/preset-react": "^7.28.5",
"@babel/preset-typescript": "^7.28.5",
"@playwright/test": "^1.59.1",
"@simbathesailor/use-what-changed": "^2.0.0",
"@types/jest": "^30.0.0",
"@types/node": "^24.3.0",
"@types/node": "^25.6.0",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@types/react-router-dom": "^5.3.3",
"cross-env": "^10.0.0",
"eslint": "^9.34.0",
"eslint-config-cheminfo-react": "^17.0.1",
"eslint-config-cheminfo-typescript": "^19.0.0",
"jest": "^30.1.3",
"prettier": "3.6.2",
"cross-env": "^10.1.0",
"eslint": "^9.39.2",
"eslint-config-cheminfo-react": "^20.0.1",
"eslint-config-cheminfo-typescript": "^22.0.0",
"jest": "^30.3.0",
"prettier": "3.8.3",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^7.8.2",
"serve": "^14.2.4",
"typescript": "^5.9.2",
"vite": "^7.1.4",
"vite-plugin-pwa": "^1.0.3"
"react-router-dom": "^7.14.2",
"serve": "^14.2.6",
"typescript": "^6.0.3",
"vite": "^8.0.10",
"vite-plugin-pwa": "https://pkg.pr.new/vite-plugin-pwa@924"
}
}
}
5 changes: 5 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ const viewportOverride: ViewportSize = {
const config: PlaywrightTestConfig = {
testDir: 'test-e2e',
retries: 1,
timeout: 60_000,
expect: {
timeout: 30_000,
},
use: {
headless: true,
ignoreHTTPSErrors: true,
Expand All @@ -21,6 +25,7 @@ const config: PlaywrightTestConfig = {
strictSelectors: true,
},
},

webServer: {
command: 'npm run test-e2e-server',
port: 3000,
Expand Down
45 changes: 45 additions & 0 deletions src/Loadingindicator.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { Spinner } from '@blueprintjs/core';
import styled from '@emotion/styled';

const Overlay = styled.div`
position: absolute;
inset: 0;
z-index: 10;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background-color: rgba(255, 255, 255, 0.7);
backdrop-filter: blur(4px);
-webkit-backdrop-filter: blur(4px);
gap: 12px;
user-select: none;
-webkit-user-select: none;
`;

const Label = styled.span`
font-size: 0.8125rem;
font-weight: 500;
letter-spacing: 0.08em;
text-transform: uppercase;
color: #6b7280;
`;

interface LoadingIndicatorProps {
label?: string;
visible: boolean;
}

export function LoadingIndicator({
label = 'Loading',
visible,
}: LoadingIndicatorProps) {
if (!visible) return null;

return (
<Overlay>
<Spinner size={36} />
<Label>{label}</Label>
</Overlay>
);
}
87 changes: 32 additions & 55 deletions src/NMRiumWrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,60 +1,37 @@
import type { NMRiumChangeCb, NMRiumData, NMRiumRefAPI } from 'nmrium';
import type { NMRiumChangeCb, NMRiumRefAPI } from 'nmrium';
import { NMRium } from 'nmrium';
import type { CSSProperties } from 'react';
import { useCallback, useEffect, useRef, useState } from 'react';
import { useCallback, useEffect, useRef } from 'react';
import { RootLayout } from 'react-science/ui';

import { LoadingIndicator } from './Loadingindicator.js';
import events from './events/event.js';
import { useLoadSpectra } from './hooks/useLoadSpectra.js';
import { usePreferences } from './hooks/usePreferences.js';
import { useWhiteList } from './hooks/useWhiteList.js';
import AboutUsModal from './modal/AboutUsModal.js';

const styles: Record<'container' | 'loadingContainer', CSSProperties> = {
container: {
height: '100%',
width: '100%',
position: 'relative',
},

loadingContainer: {
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
zIndex: 1,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
backgroundColor: '#ffffffc9',
fontSize: '1.4em',
userSelect: 'none',
WebkitUserSelect: 'none',
},
const containerStyle: CSSProperties = {
height: '100%',
width: '100%',
position: 'relative',
};

export default function NMRiumWrapper() {
const { allowedOrigins, isFetchAllowedOriginsPending } = useWhiteList();
const nmriumRef = useRef<NMRiumRefAPI>(null);
const [data, setDate] = useState<NMRiumData>();

const { workspace, preferences, defaultEmptyMessage, customWorkspaces } =
usePreferences();
const dataChangeHandler = useCallback<NMRiumChangeCb>((state, source) => {
events.trigger('data-change', {
state,
source,
});
}, []);

const { load: loadSpectra, isLoading, data: loadedData } = useLoadSpectra();
const { load: loadSpectra, data, isLoading } = useLoadSpectra();

useEffect(() => {
if (!isLoading) {
setDate(loadedData as unknown as NMRiumData);
const dataChangeHandler = useCallback<NMRiumChangeCb>((state, source) => {
// avoid triggering data-change event for SET_2D_LEVEL action, This should be handled internally in NMRium
if (source === 'view' && state.data.actionType === 'SET_2D_LEVEL') {
return;
}
}, [isLoading, loadedData]);
events.trigger('data-change', { state, source });
}, []);

useEffect(() => {
const clearActionListener = events.on(
Expand All @@ -73,33 +50,36 @@ export default function NMRiumWrapper() {
}
default: {
throw new Error(
`ERROR! Property 'type' accept only 'exportViewerAsBlob'.`,
`ERROR! Property 'type' accepts only 'exportViewerAsBlob'.`,
);
}
}
},
{ allowedOrigins },
);

const clearLoadListener = events.on(
'load',
(loadData) => {
switch (loadData.type) {
case 'nmrium':
setDate(loadData.data);
case 'nmrium': {
const { data, activeTab = '' } = loadData;
void loadSpectra({ nmrium: data, activeTab });
break;
}
case 'file': {
const { data: files, activeTab } = loadData;
loadSpectra({ files, activeTab });
const { data: files, activeTab = '' } = loadData;
void loadSpectra({ files, activeTab });
break;
}
case 'url': {
const { data: urls, activeTab } = loadData;
loadSpectra({ urls, activeTab });
const { data: urls, activeTab = '' } = loadData;
void loadSpectra({ urls, activeTab });
break;
}
default: {
throw new Error(
`ERROR! Property 'type' accept only nmrium, url or file.`,
`ERROR! Property 'type' accepts only 'nmrium', 'url', or 'file'.`,
);
}
}
Expand All @@ -113,28 +93,25 @@ export default function NMRiumWrapper() {
};
});

const isShowingOverlay = isFetchAllowedOriginsPending || isLoading;

return (
<RootLayout style={styles.container}>
{isFetchAllowedOriginsPending && (
<div style={styles.loadingContainer}>
<span>Loading .... </span>
</div>
)}
<RootLayout style={containerStyle}>
<LoadingIndicator visible={isShowingOverlay} />
<NMRium
ref={nmriumRef}
data={data}
state={data?.state}
aggregator={data?.aggregator}
onChange={dataChangeHandler}
preferences={preferences}
workspace={workspace}
emptyText={defaultEmptyMessage}
onError={(error) => {
events.trigger('error', error);
events.trigger('error', error as Error);
}}
customWorkspaces={customWorkspaces}
/>
<AboutUsModal />
</RootLayout>
);
}

export { type NMRiumData } from 'nmrium';
1 change: 1 addition & 0 deletions src/demo/NMRiumWrapperDemo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export default function NMRiumWrapperDemo() {
// 'https://cloud.uni-jena.de/s/jsMed9fmqWZzo6r/download/53.zip',
],
type: 'url',
activeTab: '13C',
});
}}
>
Expand Down
1 change: 1 addition & 0 deletions src/events/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type LoadData =
| {
data: NMRiumData;
type: 'nmrium';
activeTab?: string;
};

interface ActionRequest {
Expand Down
Loading
Loading