Commit 6b35a344 authored by Karen Konou's avatar Karen Konou

Topbar: hide/show tree button in all views

parent d8abf3ad
......@@ -39,8 +39,7 @@ topBarCpt = here.component "topBar" cpt where
Nothing -> RH.div {} []
pure $ RH.form { className: "d-flex" }
[ Toggle.treeToggleButton { state: showTree } []
, Toggle.controlsToggleButton { state: showControls } []
[ Toggle.controlsToggleButton { state: showControls } []
, Toggle.sidebarToggleButton { state: sidePanelState } []
, search
]
......
......@@ -91,14 +91,15 @@ topBar p = R.createElement topBarCpt p []
topBarCpt :: R.Component Props
topBarCpt = here.component "topBar" cpt where
cpt props@{ boxes: boxes@{ handed
, route } } _ = do
, route
, showTree } } _ = do
route' <- T.useLive T.unequal boxes.route
let children = case route' of
GR.PGraphExplorer s g -> [ GETB.topBar { boxes } ]
_ -> []
pure $ TopBar.topBar { handed } children
pure $ TopBar.topBar { handed, showTree } children
mainPage :: R2.Leaf Props
mainPage p = R.createElement mainPageCpt p []
......
......@@ -16,7 +16,8 @@ here = R2.here "Gargantext.Components.SimpleLayout"
-- Simple layout does not accommodate the tree
type SimpleLayoutProps = (
handed :: T.Box GT.Handed
handed :: T.Box GT.Handed
, showTree :: T.Box Boolean
)
simpleLayout :: R2.Component SimpleLayoutProps
......@@ -25,7 +26,7 @@ simpleLayout = R.createElement simpleLayoutCpt
simpleLayoutCpt :: R.Component SimpleLayoutProps
simpleLayoutCpt = here.component "simpleLayout" cpt
where
cpt { handed } children = do
cpt { handed, showTree } children = do
pure $ H.div { className: "simple-layout" } (
[ topBar { handed } [] ] <> children <> [ license ]
[ topBar { handed, showTree } [] ] <> children <> [ license ]
)
......@@ -11,11 +11,12 @@ import Gargantext.Prelude
import Gargantext.Components.Themes (themeSwitcher, defaultTheme, allThemes)
import Gargantext.Types (Handed(..), reverseHanded)
import Gargantext.Utils.Reactix as R2
import Gargantext.Components.GraphExplorer.ToggleButton as Toggle
here :: R2.Here
here = R2.here "Gargantext.Components.TopBar"
type TopBarProps = ( handed :: T.Box Handed )
type TopBarProps = ( handed :: T.Box Handed, showTree :: T.Box Boolean )
topBar :: R2.Component TopBarProps
topBar = R.createElement topBarCpt
......@@ -23,7 +24,7 @@ topBar = R.createElement topBarCpt
topBarCpt :: R.Component TopBarProps
topBarCpt = here.component "topBar" cpt
where
cpt { handed } children = do
cpt { handed, showTree } children = do
handed' <- T.useLive T.unequal handed
pure $ H.div { className: "navbar navbar-expand-lg navbar-dark bg-dark fixed-top"
......@@ -42,6 +43,7 @@ topBarCpt = here.component "topBar" cpt
, smiley
, H.li { className: "nav-item" } [ themeSwitcher { theme: defaultTheme
, themes: allThemes } [] ]
, Toggle.treeToggleButton { state: showTree } []
] <> children)
]
]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment