From 4d69ad62b3b023c635de45f92e7bb4a6fed1e148 Mon Sep 17 00:00:00 2001 From: hamed musallam Date: Tue, 14 Jan 2025 16:04:11 +0100 Subject: [PATCH] refactor: viewer node tree --- src/component/main/InnerNMRiumContents.tsx | 30 +++++-------------- ...aneWrapper.tsx => NMRiumViewerWrapper.tsx} | 18 +++++++++-- 2 files changed, 23 insertions(+), 25 deletions(-) rename src/component/main/{SplitPaneWrapper.tsx => NMRiumViewerWrapper.tsx} (69%) diff --git a/src/component/main/InnerNMRiumContents.tsx b/src/component/main/InnerNMRiumContents.tsx index 1dd10397a..90f796789 100644 --- a/src/component/main/InnerNMRiumContents.tsx +++ b/src/component/main/InnerNMRiumContents.tsx @@ -14,26 +14,17 @@ import { ExportManagerController } from '../elements/export/ExportManager.js'; import { PrintContent } from '../elements/print/PrintContent.js'; import { Header } from '../header/Header.js'; import DropZone from '../loader/DropZone.js'; -import { PanelOpenProviderProvider, Panels } from '../panels/Panels.js'; +import { PanelOpenProviderProvider } from '../panels/Panels.js'; import { PanelsBar } from '../panels/PanelsBar.js'; import ToolBar from '../toolbar/ToolBar.js'; import { useNMRiumRefAPI } from './NMRiumRefAPI.js'; import { NMRiumViewer } from './NMRiumViewer.js'; -import { SplitPaneWrapper } from './SplitPaneWrapper.js'; +import { NMRiumViewerWrapper } from './NMRiumViewerWrapper.js'; import { StateError } from './StateError.js'; import type { NMRiumProps, NMRiumRefAPI } from './index.js'; -const viewerContainerStyle = css` - border: 0.55px #e6e6e6 solid; - display: flex; - flex: 1; - flex-direction: column; - height: 100%; - margin-left: -1px; -`; - const containerStyles = css` background-color: white; width: 100%; @@ -151,19 +142,14 @@ export function InnerNMRiumContents(props: InnerNMRiumContentsProps) { height: '100%', }} > + + - -
- - - -
- -
+
; + emptyText: NMRiumProps['emptyText']; +} + +export function NMRiumViewerWrapper(props: NMRiumViewerWrapperProps) { + const { emptyText, viewerRef } = props; const { current, dispatch } = usePreferences(); const getPanelPreferences = useGetPanelOptions(); @@ -31,7 +42,7 @@ export function SplitPaneWrapper({ children }) { const hasDisplayedPanels = displayedPanels.length > 0; if (items?.length === 0 || !hasDisplayedPanels) { - return
{children}
; + return ; } const closed: number | boolean = general?.hidePanelOnLoad @@ -46,7 +57,8 @@ export function SplitPaneWrapper({ children }) { closed={closed} onResize={resizeHandler} > - {children} + + ); }