From 6608c63cdbdf21f0a2ae30ea3aadadf80c7a1023 Mon Sep 17 00:00:00 2001 From: Maciej Bodek Date: Wed, 8 Nov 2023 15:14:29 +0100 Subject: [PATCH] Convert vertical splitter --- .../web-console/src/scenes/Console/index.tsx | 216 ++++++++++-------- .../web-console/src/scenes/Layout/index.tsx | 2 +- .../web-console/src/theme/global-styles.ts | 10 + 3 files changed, 126 insertions(+), 102 deletions(-) diff --git a/packages/web-console/src/scenes/Console/index.tsx b/packages/web-console/src/scenes/Console/index.tsx index 683aa5e12..255bcfc38 100644 --- a/packages/web-console/src/scenes/Console/index.tsx +++ b/packages/web-console/src/scenes/Console/index.tsx @@ -31,12 +31,16 @@ const Root = styled.div` ` const Top = styled.div` + display: flex; + height: 100%; + flex: 1; position: relative; overflow: hidden; ` const Bottom = styled.div` display: flex; + height: 100%; flex: 1; min-height: 0px; ` @@ -119,120 +123,130 @@ const Console = () => { return ( - { + updateSettings(StoreKey.EDITOR_SPLITTER_BASIS, sizes[0]) + setTimeout(() => { + window.bus.trigger(BusEvent.MSG_ACTIVE_SIDEBAR) + }, 0) + }} > - - - {!sm && ( - { - dispatch( - actions.console.setActiveTopPanel( - resultsSplitterBasis === 0 ? "tables" : undefined, - ), - ) - updateSettings( - StoreKey.RESULTS_SPLITTER_BASIS, - resultsSplitterBasis === 0 ? 300 : 0, - ) - }} - selected={resultsSplitterBasis !== 0} - > - - - } - > - - {resultsSplitterBasis === 0 ? "Show" : "Hide"} tables - - - )} - - { - updateSettings(StoreKey.RESULTS_SPLITTER_BASIS, sizes[0]) - setTimeout(() => { - window.bus.trigger(BusEvent.MSG_ACTIVE_SIDEBAR) - }, 0) - }} - snap - > - - - - - - - - - - - {result && - viewModes.map(({ icon, mode, tooltipText }) => ( + + + + {!sm && ( { - dispatch(actions.console.setActiveBottomPanel("result")) - setResultViewMode(mode) + dispatch( + actions.console.setActiveTopPanel( + resultsSplitterBasis === 0 ? "tables" : undefined, + ), + ) + updateSettings( + StoreKey.RESULTS_SPLITTER_BASIS, + resultsSplitterBasis === 0 ? 300 : 0, + ) }} - selected={ - activeBottomPanel === "result" && - resultViewMode === mode - } + selected={resultsSplitterBasis !== 0} > - {icon} + } > - {tooltipText} + + {resultsSplitterBasis === 0 ? "Show" : "Hide"} tables + - ))} - { - dispatch(actions.console.setActiveBottomPanel("import")) - }} - selected={activeBottomPanel === "import"} - data-hook="import-panel-button" - > - - - } + )} + + { + updateSettings(StoreKey.RESULTS_SPLITTER_BASIS, sizes[0]) + setTimeout(() => { + window.bus.trigger(BusEvent.MSG_ACTIVE_SIDEBAR) + }, 0) + }} + snap > - Import files from CSV - - - - {result && } - - - - - - - - - + + + + + + + + + + + + + + {result && + viewModes.map(({ icon, mode, tooltipText }) => ( + { + dispatch( + actions.console.setActiveBottomPanel("result"), + ) + setResultViewMode(mode) + }} + selected={ + activeBottomPanel === "result" && + resultViewMode === mode + } + > + {icon} + + } + > + {tooltipText} + + ))} + { + dispatch(actions.console.setActiveBottomPanel("import")) + }} + selected={activeBottomPanel === "import"} + data-hook="import-panel-button" + > + + + } + > + Import files from CSV + + + + {result && } + + + + + + + + + + ) } diff --git a/packages/web-console/src/scenes/Layout/index.tsx b/packages/web-console/src/scenes/Layout/index.tsx index f8fb65a05..f1c2891ae 100644 --- a/packages/web-console/src/scenes/Layout/index.tsx +++ b/packages/web-console/src/scenes/Layout/index.tsx @@ -35,7 +35,7 @@ import { useSelector } from "react-redux" import { selectors } from "../../store" import News from "../../scenes/News" import { CreateTableDialog } from "../../components/CreateTableDialog" -import { EditorProvider } from "../../providers/EditorProvider" +import { EditorProvider } from "../../providers" import { Help } from "./help" import "allotment/dist/style.css" diff --git a/packages/web-console/src/theme/global-styles.ts b/packages/web-console/src/theme/global-styles.ts index b6642affe..228df64f9 100644 --- a/packages/web-console/src/theme/global-styles.ts +++ b/packages/web-console/src/theme/global-styles.ts @@ -36,6 +36,16 @@ const DocSearchStyles = css` --separator-border: ${({ theme }) => theme.color.backgroundDarker}; --sash-size: 2rem; --sash-hover-size: 0.5rem; + .allotment-module_splitView__L-yRc.allotment-module_separatorBorder__x-rDS.allotment-module_vertical__WSwwa + > .allotment-module_splitViewContainer__rQnVa + > .allotment-module_splitViewView__MGZ6O:not(:first-child)::before { + height: 2px; + } + .allotment-module_splitView__L-yRc.allotment-module_separatorBorder__x-rDS.allotment-module_horizontal__7doS8 + > .allotment-module_splitViewContainer__rQnVa + > .allotment-module_splitViewView__MGZ6O:not(:first-child)::before { + width: 2px; + } } .DocSearch-Button {