Skip to content

Commit deb8c93

Browse files
feat: create a new integration workspace
Add a new integration workspace cloned from the default workspace. This workspace supports disabling import and hiding the panel on load via query parameters.
1 parent 95c0dac commit deb8c93

2 files changed

Lines changed: 102 additions & 5 deletions

File tree

src/hooks/usePreferences.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import type {
44
} from '@zakodium/nmrium-core';
55
import type { NMRiumWorkspace } from 'nmrium';
66

7+
import type { WorkspaceOptions } from '../workspaces/integration.js';
8+
import { getIntegrationWorkspace } from '../workspaces/integration.js';
79
import { getNmrXivWorkspace } from '../workspaces/nmrxiv.js';
810

911
export function usePreferences() {
@@ -14,6 +16,7 @@ export function usePreferences() {
1416
let workspace: NMRiumWorkspace | undefined;
1517
let defaultEmptyMessage: string | undefined;
1618
let hidePanelOnLoad = false;
19+
let disableImport = false;
1720

1821
if (parameters.has('workspace')) {
1922
workspace = parameters.get('workspace') as NMRiumWorkspace;
@@ -30,8 +33,14 @@ export function usePreferences() {
3033
hidePanelOnLoad =
3134
parameters.get('hidePanelOnLoad')?.toLowerCase() === 'true';
3235
}
36+
if (parameters.has('disableImport')) {
37+
disableImport = parameters.get('disableImport')?.toLowerCase() === 'true';
38+
}
3339

34-
const customWorkspaces = createCustomWorkspaces({ hidePanelOnLoad });
40+
const customWorkspaces = createCustomWorkspaces({
41+
hidePanelOnLoad,
42+
disableImport,
43+
});
3544

3645
if (parameters.has('workspace')) {
3746
workspace = parameters.get('workspace') as NMRiumWorkspace;
@@ -57,16 +66,15 @@ export function usePreferences() {
5766
};
5867
}
5968

60-
interface CreateCustomWorkspacesOptions {
61-
hidePanelOnLoad?: boolean;
62-
}
69+
type CreateCustomWorkspacesOptions = WorkspaceOptions;
6370

6471
function createCustomWorkspaces(
6572
options: CreateCustomWorkspacesOptions,
6673
): CustomWorkspaces {
67-
const { hidePanelOnLoad = false } = options;
74+
const { hidePanelOnLoad, disableImport } = options;
6875

6976
return {
77+
integration: getIntegrationWorkspace({ disableImport, hidePanelOnLoad }),
7078
nmrXiv: getNmrXivWorkspace(hidePanelOnLoad),
7179
};
7280
}

src/workspaces/integration.ts

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
import type { InnerWorkspace } from '@zakodium/nmrium-core';
2+
3+
export interface WorkspaceOptions {
4+
hidePanelOnLoad?: boolean;
5+
disableImport?: boolean;
6+
}
7+
8+
export function getIntegrationWorkspace(
9+
options: WorkspaceOptions,
10+
): InnerWorkspace {
11+
const { disableImport = false, hidePanelOnLoad = false } = options;
12+
return {
13+
label: 'Integration',
14+
general: {
15+
dimmedSpectraOpacity: 0.4,
16+
verticalSplitterPosition: '560px',
17+
verticalSplitterCloseThreshold: 600,
18+
spectraRendering: 'auto',
19+
loggingLevel: 'info',
20+
popupLoggingLevel: 'error',
21+
invert: true,
22+
invertScroll: false,
23+
},
24+
display: {
25+
general: {
26+
experimentalFeatures: {
27+
display: true,
28+
visible: true,
29+
},
30+
hidePanelOnLoad,
31+
hideHelp: true,
32+
hideLogs: true,
33+
hideWorkspaces: true,
34+
hideGeneralSettings: true,
35+
},
36+
37+
panels: {
38+
spectraPanel: { display: true, visible: true, open: true },
39+
informationPanel: { display: true, visible: true, open: false },
40+
rangesPanel: { display: true, visible: true, open: false },
41+
structuresPanel: { display: true, visible: true, open: false },
42+
processingsPanel: { display: true, visible: true, open: false },
43+
zonesPanel: { display: true, visible: true, open: false },
44+
summaryPanel: { display: true, visible: true, open: false },
45+
automaticAssignmentPanel: {
46+
display: false,
47+
visible: true,
48+
open: false,
49+
},
50+
simulationPanel: { display: false, visible: true, open: false },
51+
predictionPanel: { display: false, visible: true, open: false },
52+
peaksPanel: { display: false, visible: true, open: false },
53+
multipleSpectraAnalysisPanel: {
54+
display: false,
55+
visible: true,
56+
open: false,
57+
},
58+
matrixGenerationPanel: { display: false, visible: true, open: false },
59+
integralsPanel: { display: false, visible: true, open: false },
60+
databasePanel: { display: false, visible: true, open: false },
61+
},
62+
toolBarButtons: {
63+
baselineCorrection: true,
64+
exclusionZones: true,
65+
exportAs: true,
66+
fft: true,
67+
import: !disableImport,
68+
multipleSpectraAnalysis: true,
69+
phaseCorrection: true,
70+
rangePicking: true,
71+
realImaginary: true,
72+
slicing: true,
73+
spectraCenterAlignments: true,
74+
spectraStackAlignments: true,
75+
apodization: true,
76+
zeroFilling: true,
77+
zonePicking: true,
78+
zoomOut: true,
79+
zoom: true,
80+
autoRangeAndZonePicking: true,
81+
fftDimension1: true,
82+
fftDimension2: true,
83+
},
84+
},
85+
onLoadProcessing: {
86+
autoProcessing: true,
87+
},
88+
};
89+
}

0 commit comments

Comments
 (0)