Commit ef97d9af authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[tree] rout props refactoring

parent 8798c47a
......@@ -64,9 +64,9 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where
let forested = forestLayout { appReload
, asyncTasksRef
, backend
, currentRoute: fst route
, frontends
, handed
, route: fst route
, sessions: fst sessions
, showLogin: snd showLogin
, treeReloadRef
......@@ -74,9 +74,9 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where
let forestedTB = forestLayoutWithTopBar { appReload
, asyncTasksRef
, backend
, currentRoute: fst route
, frontends
, handed
, route: fst route
, sessions: fst sessions
, showLogin: snd showLogin
, treeReloadRef
......@@ -138,9 +138,9 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where
appReload
, asyncTasksRef
, backend
, currentRoute: fst route
, frontends
, handed
, route: fst route
, sessions: fst sessions
, showLogin: snd showLogin
, treeReloadRef
......@@ -161,10 +161,10 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where
simpleLayout { handed } [
explorerLayout { asyncTasksRef
, backend
, currentRoute: fst route
, frontends
, graphId
, handed: fst handed
, mCurrentRoute: fst route
, session
, sessions: (fst sessions)
, showLogin
......@@ -189,9 +189,9 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where
appReload
, asyncTasksRef
, backend
, currentRoute: fst route
, frontends
, handed
, route: fst route
, sessions: fst sessions
, showLogin: snd showLogin
, treeReloadRef
......
......@@ -27,9 +27,9 @@ type Props = (
appReload :: ReloadS
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, backend :: R.State (Maybe Backend)
, currentRoute :: AppRoute
, frontends :: Frontends
, handed :: Handed
, route :: AppRoute
, sessions :: Sessions
, showLogin :: R.Setter Boolean
, treeReloadRef :: R.Ref (Maybe ReloadS)
......@@ -44,9 +44,9 @@ forest = R.createElement forestCpt
cpt { appReload
, asyncTasksRef
, backend
, currentRoute
, frontends
, handed
, route
, sessions
, showLogin
, treeReloadRef } _ = do
......@@ -64,7 +64,7 @@ forest = R.createElement forestCpt
R2.useCache (
frontends
/\ route
/\ currentRoute
/\ sessions
/\ fst openNodes
/\ fst appReload
......@@ -73,16 +73,16 @@ forest = R.createElement forestCpt
/\ handed
)
(cpt' openNodes asyncTasks appReload reload showLogin backend)
cpt' openNodes asyncTasks appReload reload showLogin backend (frontends /\ route /\ sessions /\ _ /\ _ /\ _ /\ _ /\ handed) = do
cpt' openNodes asyncTasks appReload reload showLogin backend (frontends /\ currentRoute /\ sessions /\ _ /\ _ /\ _ /\ _ /\ handed) = do
pure $ R2.row $ [plus handed showLogin backend] <> trees
where
trees = tree <$> unSessions sessions
tree s@(Session {treeId}) =
treeView { appReload
, asyncTasks
, currentRoute
, frontends
, handed
, mCurrentRoute: Just route
, openNodes
, reload
, root: treeId
......@@ -120,9 +120,9 @@ type ForestLayoutProps = (
appReload :: ReloadS
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, backend :: R.State (Maybe Backend)
, currentRoute :: AppRoute
, frontends :: Frontends
, handed :: R.State Handed
, route :: AppRoute
, sessions :: Sessions
, showLogin :: R.Setter Boolean
, treeReloadRef :: R.Ref (Maybe ReloadS)
......@@ -173,9 +173,9 @@ forestLayoutRaw props = R.createElement forestLayoutRawCpt props
cpt { appReload
, asyncTasksRef
, backend
, currentRoute
, frontends
, handed
, route
, sessions
, showLogin
, treeReloadRef } children = do
......@@ -189,9 +189,9 @@ forestLayoutRaw props = R.createElement forestLayoutRawCpt props
forest { appReload
, asyncTasksRef
, backend
, currentRoute
, frontends
, handed: fst handed
, route
, sessions
, showLogin
, treeReloadRef } []
......
......@@ -46,9 +46,9 @@ thisModule = "Gargantext.Components.Forest.Tree"
------------------------------------------------------------------------
type CommonProps = (
appReload :: GT.ReloadS
, currentRoute :: AppRoute
, frontends :: Frontends
, handed :: GT.Handed
, mCurrentRoute :: Maybe AppRoute
, openNodes :: R.State OpenNodes
, reload :: GT.ReloadS
, session :: Session
......@@ -69,9 +69,9 @@ treeView = R.createElement elCpt
cpt { appReload
, asyncTasks
, currentRoute
, frontends
, handed
, mCurrentRoute
, openNodes
, reload
, root
......@@ -79,9 +79,9 @@ treeView = R.createElement elCpt
} _children = do
pure $ treeLoadView { appReload
, asyncTasks
, currentRoute
, frontends
, handed
, mCurrentRoute
, openNodes
, reload
, root
......@@ -96,9 +96,9 @@ treeLoadView = R.createElement elCpt
cpt { appReload
, asyncTasks
, currentRoute
, frontends
, handed
, mCurrentRoute
, openNodes
, reload
, root
......@@ -106,9 +106,9 @@ treeLoadView = R.createElement elCpt
} _children = do
let fetch _ = getNodeTree session root
-- let paint loaded = loadedTreeView { asyncTasks
-- , currentRoute
-- , frontends
-- , handed
-- , mCurrentRoute
-- , openNodes
-- , reload
-- , session
......@@ -117,9 +117,9 @@ treeLoadView = R.createElement elCpt
-- } []
let paint loaded = loadedTreeViewFirstLevel { appReload
, asyncTasks
, currentRoute
, frontends
, handed
, mCurrentRoute
, openNodes
, reload
, session
......@@ -151,9 +151,9 @@ type TreeViewProps = (
-- cpt { appReload
-- , asyncTasks
-- , currentRoute
-- , frontends
-- , handed
-- , mCurrentRoute
-- , openNodes
-- , reload
-- , session
......@@ -164,9 +164,9 @@ type TreeViewProps = (
-- H.div { className: if handed == GT.RightHanded then "righthanded" else "lefthanded" } [
-- toHtml { appReload
-- , asyncTasks
-- , currentRoute
-- , frontends
-- , handed
-- , mCurrentRoute
-- , openNodes
-- , reload
-- , session
......@@ -184,9 +184,9 @@ loadedTreeViewFirstLevel = R.createElement elCpt
cpt { appReload
, asyncTasks
, currentRoute
, frontends
, handed
, mCurrentRoute
, openNodes
, reload
, session
......@@ -197,9 +197,9 @@ loadedTreeViewFirstLevel = R.createElement elCpt
H.div { className: if handed == GT.RightHanded then "righthanded" else "lefthanded" } [
toHtmlFirstLevel { appReload
, asyncTasks
, currentRoute
, frontends
, handed
, mCurrentRoute
, openNodes
, reload
, reloadTree: reload
......@@ -229,9 +229,9 @@ type ToHtmlProps = (
-- cpt p@{ appReload
-- , asyncTasks
-- , currentRoute
-- , frontends
-- , handed
-- , mCurrentRoute
-- , openNodes
-- , reload: reload@(_ /\ setReload)
-- , session
......@@ -264,13 +264,13 @@ type ToHtmlProps = (
-- pure $ H.li { className: if A.null ary then "no-children" else "with-children" }
-- [ nodeSpan { appReload
-- , asyncTasks
-- , currentRoute
-- , dispatch: pAction
-- , folderOpen
-- , frontends
-- , handed
-- , id
-- , isLeaf: A.null ary
-- , mCurrentRoute
-- , name
-- , nodeType
-- , session
......@@ -301,9 +301,9 @@ toHtmlFirstLevel = R.createElement elCpt
cpt p@{ appReload
, asyncTasks
, currentRoute
, frontends
, handed
, mCurrentRoute
, openNodes
, reload: reload@(_ /\ setReload)
, reloadTree
......@@ -330,13 +330,13 @@ toHtmlFirstLevel = R.createElement elCpt
pure $ H.li { className: if A.null ary then "no-children" else "with-children" } $
[ nodeSpan { appReload
, asyncTasks
, currentRoute
, dispatch: pAction
, folderOpen
, frontends
, handed
, id
, isLeaf: A.null ary
, mCurrentRoute
, name
, nodeType
, session
......@@ -425,11 +425,11 @@ childNodeFirstLevel = R.createElement elCpt
cpt props@{ appReload
, asyncTasks
, currentRoute
, folderOpen
, id
, frontends
, handed
, mCurrentRoute
, openNodes
, reload
, reloadTree
......@@ -439,10 +439,10 @@ childNodeFirstLevel = R.createElement elCpt
let fetch _ = getNodeTreeFirstLevel session id
let paint loaded = childNodeFirstLevelPaint { appReload
, asyncTasks
, currentRoute
, folderOpen
, frontends
, handed
, mCurrentRoute
, openNodes
, reload: cptReload
, reloadTree
......
......@@ -44,11 +44,11 @@ thisModule = "Gargantext.Components.Forest.Tree.Node"
type NodeMainSpanProps = (
appReload :: GT.ReloadS
, asyncTasks :: GAT.Reductor
, currentRoute :: Routes.AppRoute
, folderOpen :: R.State Boolean
, frontends :: Frontends
, id :: ID
, isLeaf :: IsLeaf
, mCurrentRoute :: Maybe Routes.AppRoute
, name :: Name
, nodeType :: GT.NodeType
, setPopoverRef :: R.Ref (Maybe (Boolean -> Effect Unit))
......@@ -74,13 +74,13 @@ nodeMainSpan = R.createElement nodeMainSpanCpt
cpt props@{ appReload
, asyncTasks: (asyncTasks /\ dispatchAsyncTasks)
, currentRoute
, dispatch
, folderOpen
, frontends
, handed
, id
, isLeaf
, mCurrentRoute
, name
, nodeType
, session
......@@ -100,7 +100,7 @@ nodeMainSpan = R.createElement nodeMainSpanCpt
GT.LeftHanded -> reverse
GT.RightHanded -> identity
let isSelected = mCurrentRoute == Routes.nodeTypeAppRoute nodeType (sessionId session) id
let isSelected = Just currentRoute == Routes.nodeTypeAppRoute nodeType (sessionId session) id
pure $ H.span (dropProps droppedFile isDragOver)
$ ordering
......
......@@ -44,10 +44,10 @@ thisModule = "Gargantext.Components.GraphExplorer"
type LayoutProps = (
asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, backend :: R.State (Maybe Backend)
, currentRoute :: AppRoute
, frontends :: Frontends
, graphId :: GET.GraphId
, handed :: Types.Handed
, mCurrentRoute :: AppRoute
, session :: Session
, sessions :: Sessions
, showLogin :: R.State Boolean
......@@ -94,13 +94,13 @@ explorerCpt = R.hooksComponentWithModule thisModule "explorer" cpt
where
cpt props@{ asyncTasksRef
, backend
, currentRoute
, frontends
, graph
, graphId
, graphVersion
, handed
, hyperdataGraph
, mCurrentRoute
, mMetaData
, session
, sessions
......@@ -160,9 +160,9 @@ explorerCpt = R.hooksComponentWithModule thisModule "explorer" cpt
, R2.row $ mainLayout handed $
tree { asyncTasksRef
, backend
, currentRoute
, frontends
, handed
, mCurrentRoute
, reload: treeReload
, sessions
, show: fst controls.showTree
......@@ -215,14 +215,14 @@ explorerCpt = R.hooksComponentWithModule thisModule "explorer" cpt
tree :: Record TreeProps -> R.Element
tree { show: false } = RH.div { id: "tree" } []
tree { asyncTasksRef, backend, frontends, handed, mCurrentRoute: route, reload, sessions, showLogin, treeReloadRef } =
tree { asyncTasksRef, backend, frontends, handed, currentRoute, reload, sessions, showLogin, treeReloadRef } =
RH.div {className: "col-md-2 graph-tree"} [
forest { appReload: reload
, asyncTasksRef
, backend
, currentRoute
, frontends
, handed
, route
, sessions
, showLogin
, treeReloadRef } []
......@@ -239,9 +239,9 @@ type TreeProps =
(
asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, backend :: R.State (Maybe Backend)
, currentRoute :: AppRoute
, frontends :: Frontends
, handed :: Types.Handed
, mCurrentRoute :: AppRoute
, reload :: Types.ReloadS
, sessions :: Sessions
, show :: Boolean
......
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