From a2e5b66dc48265bbfd19a43ae03ca2e8c5a9de5b Mon Sep 17 00:00:00 2001 From: Colin Date: Wed, 21 Aug 2024 15:58:00 -0400 Subject: [PATCH] Back with main --- .../app-core/src/ui/App/FloatingViewPanel.tsx | 1 - packages/app-core/src/ui/App/ViewPanel.tsx | 70 +++++++++++++++++++ .../app-core/src/ui/App/ViewsContainer.tsx | 21 ++++-- 3 files changed, 87 insertions(+), 5 deletions(-) create mode 100644 packages/app-core/src/ui/App/ViewPanel.tsx diff --git a/packages/app-core/src/ui/App/FloatingViewPanel.tsx b/packages/app-core/src/ui/App/FloatingViewPanel.tsx index 5521e1f8d8..1be7deb15e 100644 --- a/packages/app-core/src/ui/App/FloatingViewPanel.tsx +++ b/packages/app-core/src/ui/App/FloatingViewPanel.tsx @@ -41,7 +41,6 @@ const FloatingViewPanel = observer(function ({ } }, [h, height]) - console.log(view.floatingX, view.floatingY) return ( void + popSnackbarMessage: () => unknown +} + +const ViewPanel = observer(function ({ + view, + session, +}: { + view: AbstractViewModel + session: AppSession +}) { + const { pluginManager } = getEnv(session) + const viewType = pluginManager.getViewType(view.type) + if (!viewType) { + throw new Error(`unknown view type ${view.type}`) + } + const { ReactComponent } = viewType + return ( + { + session.removeView(view) + }} + onMinimize={() => { + view.setMinimized(!view.minimized) + }} + > + {!view.minimized ? ( + } + > + }> + + + + ) : ( + false + )} + + ) +}) + +export default ViewPanel diff --git a/packages/app-core/src/ui/App/ViewsContainer.tsx b/packages/app-core/src/ui/App/ViewsContainer.tsx index caafdc9bc2..ff23713c0c 100644 --- a/packages/app-core/src/ui/App/ViewsContainer.tsx +++ b/packages/app-core/src/ui/App/ViewsContainer.tsx @@ -7,7 +7,8 @@ import { MenuItem as JBMenuItem } from '@jbrowse/core/ui/Menu' // locals import ViewLauncher from './ViewLauncher' -import ViewPanel from './ViewPanel' +import FloatingViewPanel from './FloatingViewPanel' +import StaticViewPanel from './StaticViewPanel' const useStyles = makeStyles()({ viewsContainer: { @@ -34,9 +35,21 @@ const ViewsContainer = observer(function ViewsContainer(props: Props) { return (
{views.length > 0 ? ( - views.map(view => ( - - )) + views.map(view => + view.isFloating ? ( + + ) : ( + + ), + ) ) : ( )}