Commit d7a3bac1 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[REFACT] subtree with valid types params

parent 6b229104
...@@ -52,13 +52,14 @@ copyFromCorpusViewCpt = R.hooksComponent "G.C.F.T.N.A.U.copyFromCorpusView" cpt ...@@ -52,13 +52,14 @@ copyFromCorpusViewCpt = R.hooksComponent "G.C.F.T.N.A.U.copyFromCorpusView" cpt
, nodeType , nodeType
, session , session
, tree , tree
, subTreeParams
} }
------------------------------------------------------------------------ ------------------------------------------------------------------------
type CorpusTreeProps = type CorpusTreeProps =
( tree :: FTree ( tree :: FTree
| Props | SubTreeParamsProps
) )
copyFromCorpusViewLoaded :: Record CorpusTreeProps -> R.Element copyFromCorpusViewLoaded :: Record CorpusTreeProps -> R.Element
...@@ -79,7 +80,7 @@ copyFromCorpusTreeView props = R.createElement copyFromCorpusTreeViewCpt props [ ...@@ -79,7 +80,7 @@ copyFromCorpusTreeView props = R.createElement copyFromCorpusTreeViewCpt props [
copyFromCorpusTreeViewCpt :: R.Component CorpusTreeProps copyFromCorpusTreeViewCpt :: R.Component CorpusTreeProps
copyFromCorpusTreeViewCpt = R.hooksComponent "G.C.F.T.N.A.U.copyFromCorpusTreeViewCpt" cpt copyFromCorpusTreeViewCpt = R.hooksComponent "G.C.F.T.N.A.U.copyFromCorpusTreeViewCpt" cpt
where where
cpt p@{id, tree: NTree (LNode { id: sourceId, name, nodeType }) ary} _ = do cpt p@{id, tree: NTree (LNode { id: sourceId, name, nodeType }) ary, subTreeParams} _ = do
pure $ {- H.div {} [ H.h5 { className: GT.fldr nodeType true} [] pure $ {- H.div {} [ H.h5 { className: GT.fldr nodeType true} []
, -} H.div { className: "node" } , -} H.div { className: "node" }
( [ H.span { className: "name " <> clickable ( [ H.span { className: "name " <> clickable
...@@ -90,8 +91,9 @@ copyFromCorpusTreeViewCpt = R.hooksComponent "G.C.F.T.N.A.U.copyFromCorpusTreeVi ...@@ -90,8 +91,9 @@ copyFromCorpusTreeViewCpt = R.hooksComponent "G.C.F.T.N.A.U.copyFromCorpusTreeVi
) )
-- ] -- ]
where where
SubTreeParams { valitypes } = subTreeParams
children = map (\c -> copyFromCorpusTreeView (p { tree = c })) ary children = map (\c -> copyFromCorpusTreeView (p { tree = c })) ary
validNodeType = (A.elem nodeType [GT.NodeList]) && (id /= sourceId) validNodeType = (A.elem nodeType valitypes) && (id /= sourceId)
clickable = if validNodeType then "clickable" else "" clickable = if validNodeType then "clickable" else ""
onClick _ = case validNodeType of onClick _ = case validNodeType of
false -> pure unit false -> pure unit
......
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