Commit 650d443f authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[app] footer, simple layout refactoring

parent 5c7de476
module Gargantext.Components.App where module Gargantext.Components.App where
import Data.Array (fromFoldable, reverse) import Data.Array (fromFoldable)
import Data.Foldable (intercalate)
import Data.Maybe (Maybe(..), maybe') import Data.Maybe (Maybe(..), maybe')
import Data.Tuple (fst, snd) import Data.Tuple (fst, snd)
import Data.Tuple.Nested ((/\))
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as H
import Gargantext.Prelude import Gargantext.Prelude
import Gargantext.AsyncTasks as GAT import Gargantext.Components.Footer (footer)
import Gargantext.Components.Forest (forest, forestLayout) import Gargantext.Components.Forest (forestLayout)
import Gargantext.Components.GraphExplorer (explorerLayout) import Gargantext.Components.GraphExplorer (explorerLayout)
import Gargantext.Components.Lang (LandingLang(..)) import Gargantext.Components.Lang (LandingLang(..))
import Gargantext.Components.Login (login) import Gargantext.Components.Login (login)
...@@ -25,14 +22,12 @@ import Gargantext.Components.Nodes.Frame (frameLayout) ...@@ -25,14 +22,12 @@ import Gargantext.Components.Nodes.Frame (frameLayout)
import Gargantext.Components.Nodes.Home (homeLayout) import Gargantext.Components.Nodes.Home (homeLayout)
import Gargantext.Components.Nodes.Lists (listsLayout) import Gargantext.Components.Nodes.Lists (listsLayout)
import Gargantext.Components.Nodes.Texts (textsLayout) import Gargantext.Components.Nodes.Texts (textsLayout)
import Gargantext.Components.TopBar (topBar) import Gargantext.Components.SimpleLayout (simpleLayout)
import Gargantext.Config (defaultFrontends, defaultBackends, publicBackend) import Gargantext.Config (defaultFrontends, defaultBackends, publicBackend)
import Gargantext.Ends (Frontends, Backend)
import Gargantext.Hooks.Router (useHashRouter) import Gargantext.Hooks.Router (useHashRouter)
import Gargantext.License (license)
import Gargantext.Router (router) import Gargantext.Router (router)
import Gargantext.Routes (AppRoute(..)) import Gargantext.Routes (AppRoute(..))
import Gargantext.Sessions (Sessions, useSessions) import Gargantext.Sessions (useSessions)
import Gargantext.Sessions as Sessions import Gargantext.Sessions as Sessions
import Gargantext.Types as GT import Gargantext.Types as GT
...@@ -142,7 +137,7 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where ...@@ -142,7 +137,7 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where
PGraphExplorer sid graphId -> PGraphExplorer sid graphId ->
withSession sid $ withSession sid $
\session -> \session ->
simpleLayout handed $ simpleLayout { handed } [
explorerLayout { asyncTasksRef explorerLayout { asyncTasksRef
, backend , backend
, frontends , frontends
...@@ -153,6 +148,7 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where ...@@ -153,6 +148,7 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where
, sessions: (fst sessions) , sessions: (fst sessions)
, showLogin , showLogin
} }
]
RouteFile sid nodeId -> withSession sid $ \session -> forested [ fileLayout { nodeId, session } ] RouteFile sid nodeId -> withSession sid $ \session -> forested [ fileLayout { nodeId, session } ]
RouteFrameCalc sid nodeId -> withSession sid $ \session -> forested [ RouteFrameCalc sid nodeId -> withSession sid $ \session -> forested [
frameLayout { nodeId, nodeType: GT.NodeFrameCalc, session } frameLayout { nodeId, nodeType: GT.NodeFrameCalc, session }
...@@ -179,31 +175,3 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where ...@@ -179,31 +175,3 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where
, treeReloadRef , treeReloadRef
} }
] ]
-- Simple layout does not accommodate the tree
simpleLayout :: R.State GT.Handed -> R.Element -> R.Element
simpleLayout handed child = H.div { className: "simple-layout" } [
topBar { handed }
, child
, license
]
---------------------------------------------------------------------------
type FooterProps =
(
session :: Sessions.Session
)
footer :: Record FooterProps -> R.Element
footer props = R.createElement footerCpt props []
footerCpt :: R.Component FooterProps
footerCpt = R.hooksComponentWithModule thisModule "footer" cpt
where
cpt { session } _ = do
pure $ H.div
{ className: "container" }
[ H.hr {}
, H.footer {} []
]
module Gargantext.Components.Footer where
import Reactix as R
import Reactix.DOM.HTML as H
import Gargantext.Prelude
import Gargantext.Sessions as Sessions
thisModule :: String
thisModule = "Gargantext.Components.Footer"
---------------------------------------------------------------------------
type FooterProps =
(
session :: Sessions.Session
)
footer :: Record FooterProps -> R.Element
footer props = R.createElement footerCpt props []
footerCpt :: R.Component FooterProps
footerCpt = R.hooksComponentWithModule thisModule "footer" cpt
where
cpt { session } _ = do
pure $ H.div
{ className: "container" }
[ H.hr {}
, H.footer {} []
]
module Gargantext.Components.SimpleLayout where
import Reactix as R
import Reactix.DOM.HTML as H
import Gargantext.Prelude
import Gargantext.Components.TopBar (topBar)
import Gargantext.License (license)
import Gargantext.Types as GT
import Gargantext.Utils.Reactix as R2
thisModule :: String
thisModule = "Gargantext.Components.SimpleLayout"
-- Simple layout does not accommodate the tree
type SimpleLayoutProps = (
handed :: R.State GT.Handed
)
simpleLayout :: R2.Component SimpleLayoutProps
simpleLayout = R.createElement simpleLayoutCpt
simpleLayoutCpt :: R.Component SimpleLayoutProps
simpleLayoutCpt = R.hooksComponentWithModule thisModule "simpleLayout" cpt
where
cpt { handed } children = do
pure $ H.div { className: "simple-layout" } (
[ topBar { handed } ] <> children <> [ license ]
)
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