import type { IconName } from '@blueprintjs/icons'; import type { NMRiumPanelPreferences } from '@zakodium/nmrium-core'; import { SvgNmrAssignment2, SvgNmrIntegrate, SvgNmrMultipleAnalysis, SvgNmrPeakPicking, SvgNmrRangePicking, } from 'cheminfo-font'; import type { CSSProperties, ReactElement } from 'react'; import { FaDiceFour } from 'react-icons/fa'; import type { AccordionItemProps } from 'react-science/ui'; import type { DisplayerMode } from '../reducer/Reducer.js'; import type { Tool } from '../toolbar/ToolTypes.js'; import AutomaticAssignment from './AutomaticAssignment/AutomaticAssignment.js'; import IntegralPanel from './IntegralsPanel/IntegralPanel.js'; import { MatrixGenerationPanel } from './MatrixGenerationPanel/MatrixGenerationPanel.js'; import MoleculePanel from './MoleculesPanel/MoleculePanel.js'; import PeaksPanel from './PeaksPanel/PeaksPanel.js'; import RangesPanel from './RangesPanel/RangesPanel.js'; import SpectrumListPanel from './SpectraPanel/SpectrumListPanel.js'; import SummaryPanel from './SummaryPanel/SummaryPanel.js'; import ZonesPanel from './ZonesPanel/ZonesPanel.js'; import DatabasePanel from './databasePanel/DatabasePanel.js'; import FilterPanel from './filtersPanel/FilterPanel.js'; import { InformationPanel } from './informationPanel/InformationPanel.js'; import MultipleSpectraAnalysisPanel from './multipleAnalysisPanel/MultipleSpectraAnalysisPanel.js'; import PredictionPane from './predictionPanel/PredictionPanel.js'; import SpectrumSimulation from './spectrumSimulation/SpectrumSimulation.js'; export interface AccordionItem extends Omit< AccordionItemProps, 'children' | 'defaultOpened' > { id: keyof NMRiumPanelPreferences; component: ReactElement; style?: CSSProperties; mode: DisplayerMode | null; isExperimental?: boolean; icon: IconName | ReactElement; openWithTool?: Tool; } const accordions: Record< keyof NMRiumPanelPreferences, Omit > = { spectraPanel: { title: 'Spectra', component: , mode: null, icon: 'list-columns', openWithTool: 'zoom', }, informationPanel: { title: 'Information', component: , style: { overflow: 'hidden' }, mode: null, icon: 'info-sign', }, peaksPanel: { title: 'Peaks', component: , mode: '1D', icon: , openWithTool: 'peakPicking', }, processingsPanel: { title: 'Processing', component: , mode: null, icon: 'series-derived', }, integralsPanel: { title: 'Integrals', component: , mode: '1D', icon: , openWithTool: 'integral', }, rangesPanel: { title: 'Ranges / Multiplet analysis', component: , mode: '1D', icon: , openWithTool: 'rangePicking', }, multipleSpectraAnalysisPanel: { title: 'Multiple spectra analysis', component: , mode: null, icon: , openWithTool: 'multipleSpectraAnalysis', }, matrixGenerationPanel: { title: 'Matrix generation', component: , mode: '1D', icon: 'derive-column', }, zonesPanel: { title: 'Zones', component: , mode: '2D', icon: , openWithTool: 'zonePicking', }, summaryPanel: { title: 'Summary', component: , mode: null, icon: 'document', }, structuresPanel: { title: 'Chemical structures', component: , mode: null, icon: 'hexagon', }, databasePanel: { title: 'Databases', component: , mode: null, icon: 'database', }, automaticAssignmentPanel: { title: 'Automatic assignment', component: , mode: null, icon: , }, predictionPanel: { title: 'Prediction', component: , mode: null, icon: 'new-grid-item', }, simulationPanel: { title: 'Spectrum simulation', component: , mode: '1D', icon: 'lab-test', }, }; export const accordionItems: AccordionItem[] = Object.entries(accordions).map( ([id, item]) => ({ id: id as keyof NMRiumPanelPreferences, ...item }), ); function mapToolsToPanels( accordions: Record>, ): Record { const toolToPanelMap: Record = {}; for (const [key, { openWithTool }] of Object.entries(accordions)) { if (openWithTool) { toolToPanelMap[openWithTool] = key as keyof NMRiumPanelPreferences; } } return toolToPanelMap; } export const toolPanelLookup = mapToolsToPanels(accordions);