Skip to content

Commit

Permalink
wip: new nav ux
Browse files Browse the repository at this point in the history
  • Loading branch information
insmac committed Sep 15, 2023
1 parent 9e98cfd commit 8a48cd2
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 7 deletions.
8 changes: 8 additions & 0 deletions packages/web-console/src/components/Sidebar/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import styled from "styled-components"
import { Box } from "../Box"

export const Sidebar = styled(Box).attrs({ flexDirection: "column" })`
width: 4rem;
height: 100%;
background: ${({ theme }) => theme.color.backgroundDarker};
`
39 changes: 36 additions & 3 deletions packages/web-console/src/scenes/Console/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ import { useCallback } from "react"
import { BusEvent } from "../../consts"
import { useLocalStorage } from "../../providers/LocalStorageProvider"
import { StoreKey } from "../../utils/localStorage/types"
import { useSelector } from "react-redux"
import { selectors } from "../../store"
import { useSelector, useDispatch } from "react-redux"
import { selectors, actions } from "../../store"
import { Sidebar } from "../../components/Sidebar"
import { color } from "../../utils"

const Root = styled.div`
display: flex;
Expand All @@ -25,11 +27,29 @@ const Top = styled.div`
overflow: hidden;
`

const Bottom = styled.div`
display: flex;
flex: 1;
`

const Logo = styled.div`
position: relative;
display: flex;
width: 4rem;
height: 4rem;
background: ${color("black")};
z-index: 1;
align-items: center;
justify-content: center;
cursor: pointer;
`

const Console = () => {
const { sm } = useScreenSize()
const { editorSplitterBasis, resultsSplitterBasis, updateSettings } =
useLocalStorage()
const result = useSelector(selectors.query.getResult)
const dispatch = useDispatch()

const handleEditorSplitterChange = useCallback((value) => {
updateSettings(StoreKey.EDITOR_SPLITTER_BASIS, value)
Expand All @@ -55,6 +75,16 @@ const Console = () => {
onChange={handleEditorSplitterChange}
>
<Top>
<Sidebar>
<Logo
onClick={() =>
dispatch(actions.console.setActivePanel("console"))
}
>
<img alt="QuestDB Logo" height="26" src="/assets/favicon.svg" />
</Logo>
top
</Sidebar>
<Splitter
direction="horizontal"
fallback={resultsSplitterBasis}
Expand All @@ -65,7 +95,10 @@ const Console = () => {
<Editor />
</Splitter>
</Top>
{result ? <Result /> : <ZeroState />}
<Bottom>
<Sidebar>bottom</Sidebar>
{result ? <Result /> : <ZeroState />}
</Bottom>
</Splitter>
</EditorProvider>
</Root>
Expand Down
6 changes: 2 additions & 4 deletions packages/web-console/src/scenes/Layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import Import from "../Import"
import Settings from "../Settings"
import News from "../News"
import SideMenu from "../SideMenu"
import Sidebar from "../Sidebar"
import { QuestProvider } from "../../providers"
import { useSelector } from "react-redux"
import { selectors } from "../../store"
Expand Down Expand Up @@ -60,9 +59,6 @@ const Layout = () => {

return (
<QuestProvider>
<Sidebar />
<Footer />

<Page style={{ display: activePanel === "console" ? "flex" : "none" }}>
<Console />
</Page>
Expand All @@ -80,6 +76,8 @@ const Layout = () => {
</Page>

<SideMenu />

<Footer />
</QuestProvider>
)
}
Expand Down

0 comments on commit 8a48cd2

Please sign in to comment.