import type { ReactNode } from 'react'; import { ResponsiveChart } from 'react-d3-utils'; import { SVGRootContainer } from '../1d-2d/components/SVGRootContainer.js'; import { ViewerResponsiveWrapper } from '../1d-2d/components/ViewerResponsiveWrapper.js'; import BrushXY from '../1d-2d/tools/BrushXY.js'; import CrossLinePointer from '../1d-2d/tools/CrossLinePointer.js'; import { MouseTracker } from '../EventsTrackers/MouseTracker.js'; import { useChartData } from '../context/ChartContext.js'; import Spinner from '../loader/Spinner.js'; import { options } from '../toolbar/ToolTypes.js'; import { PhaseTraces } from './1d-tracer/phase-correction-traces/index.js'; import { BrushTracker2D } from './BrushTracker2D.js'; import FooterBanner from './FooterBanner.js'; import { SVGContent2D } from './SVGContent2D.js'; import SlicingView from './SlicingView.js'; import { PivotIndicator } from './tools/PivotIndicator.js'; import XYLabelPointer from './tools/XYLabelPointer.js'; import { useTracesSpectra } from './useTracesSpectra.js'; import { get2DDimensionLayout } from './utilities/DimensionLayout.js'; interface Viewer2DProps { emptyText?: ReactNode; renderSvgContentOnly?: boolean; } function Viewer2D(props: Viewer2DProps) { const { emptyText, renderSvgContentOnly = false } = props; const state = useChartData(); const { toolOptions: { selectedTool }, isLoading, data, margin, } = state; const spectrumData = useTracesSpectra(); const DIMENSION = get2DDimensionLayout(state); if (renderSvgContentOnly) { return ; } return ( {({ width, height }) => ( {data && data.length > 0 && ( {selectedTool && selectedTool === options.slicing.id && ( )} {selectedTool && selectedTool === options.phaseCorrectionTwoDimensions.id && ( )} <> {spectrumData.x && ( )} {spectrumData.y && ( )} )} )} ); } export default Viewer2D;