Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
142
Issues
142
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
purescript-gargantext
Commits
754b9eb2
Commit
754b9eb2
authored
Sep 08, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ERGO] Tree.Node is not leaf then chevron
parent
305410c7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
17 deletions
+27
-17
Tree.purs
src/Gargantext/Components/Forest/Tree.purs
+6
-2
Node.purs
src/Gargantext/Components/Forest/Tree/Node.purs
+21
-15
No files found.
src/Gargantext/Components/Forest/Tree.purs
View file @
754b9eb2
...
@@ -31,7 +31,7 @@ import Gargantext.Components.Forest.Tree.Node.Tools.FTree (FTree, LNode(..), NTr
...
@@ -31,7 +31,7 @@ import Gargantext.Components.Forest.Tree.Node.Tools.FTree (FTree, LNode(..), NTr
import Gargantext.Components.Forest.Tree.Node.Tools.Task (Tasks, tasksStruct)
import Gargantext.Components.Forest.Tree.Node.Tools.Task (Tasks, tasksStruct)
import Gargantext.Ends (Frontends)
import Gargantext.Ends (Frontends)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude (Unit, bind, discard, map, pure, void, ($), (+), (<>), (==))
import Gargantext.Prelude (Unit, bind, discard, map, pure, void, ($), (+), (<>), (==)
, (<<<), not
)
import Gargantext.Routes (AppRoute)
import Gargantext.Routes (AppRoute)
import Gargantext.Routes as GR
import Gargantext.Routes as GR
import Gargantext.Sessions (OpenNodes, Session, mkNodeId, get)
import Gargantext.Sessions (OpenNodes, Session, mkNodeId, get)
...
@@ -200,7 +200,8 @@ toHtml p@{ asyncTasks
...
@@ -200,7 +200,8 @@ toHtml p@{ asyncTasks
let withId (NTree (LNode {id: id'}) _) = id'
let withId (NTree (LNode {id: id'}) _) = id'
pure $ H.li {} $
pure $ H.li {} $
[ nodeMainSpan { id
[ nodeMainSpan (isLeaf ary)
{ id
, dispatch: pAction
, dispatch: pAction
, folderOpen
, folderOpen
, frontends
, frontends
...
@@ -223,6 +224,9 @@ toHtml p@{ asyncTasks
...
@@ -223,6 +224,9 @@ toHtml p@{ asyncTasks
}
}
)
)
isLeaf :: Array FTree -> Boolean
isLeaf = not <<< A.null
type ChildNodesProps =
type ChildNodesProps =
( asyncTasks :: R.State GAT.Storage
( asyncTasks :: R.State GAT.Storage
, children :: Array FTree
, children :: Array FTree
...
...
src/Gargantext/Components/Forest/Tree/Node.purs
View file @
754b9eb2
...
@@ -49,9 +49,12 @@ type NodeMainSpanProps =
...
@@ -49,9 +49,12 @@ type NodeMainSpanProps =
| CommonProps
| CommonProps
)
)
nodeMainSpan :: Record NodeMainSpanProps
type IsLeaf = Boolean
nodeMainSpan :: IsLeaf
-> Record NodeMainSpanProps
-> R.Element
-> R.Element
nodeMainSpan p@{ dispatch, folderOpen, frontends, handed, session } = R.createElement el p []
nodeMainSpan
isLeaf
p@{ dispatch, folderOpen, frontends, handed, session } = R.createElement el p []
where
where
el = R2.hooksComponent thisModule "nodeMainSpan" cpt
el = R2.hooksComponent thisModule "nodeMainSpan" cpt
cpt props@{id, mCurrentRoute, name, nodeType, tasks: { onTaskFinish, tasks }} _ = do
cpt props@{id, mCurrentRoute, name, nodeType, tasks: { onTaskFinish, tasks }} _ = do
...
@@ -69,7 +72,7 @@ nodeMainSpan p@{ dispatch, folderOpen, frontends, handed, session } = R.createEl
...
@@ -69,7 +72,7 @@ nodeMainSpan p@{ dispatch, folderOpen, frontends, handed, session } = R.createEl
pure $ H.span (dropProps droppedFile isDragOver)
pure $ H.span (dropProps droppedFile isDragOver)
$ ordering
$ ordering
[ folderIcon nodeType folderOpen
[ folderIcon nodeType folderOpen
, chevronIcon handed nodeType folderOpen
, chevronIcon
isLeaf
handed nodeType folderOpen
, nodeLink { frontends
, nodeLink { frontends
, id
, id
, isSelected: mCurrentRoute
, isSelected: mCurrentRoute
...
@@ -123,7 +126,9 @@ nodeMainSpan p@{ dispatch, folderOpen, frontends, handed, session } = R.createEl
...
@@ -123,7 +126,9 @@ nodeMainSpan p@{ dispatch, folderOpen, frontends, handed, session } = R.createEl
then show session
then show session
else name
else name
chevronIcon handed' nodeType folderOpen'@(open /\ _) =
chevronIcon isLeaf handed' nodeType folderOpen'@(open /\ _) =
if isLeaf
then
H.a { className: "chevron-icon"
H.a { className: "chevron-icon"
, onClick: R2.effToggler folderOpen'
, onClick: R2.effToggler folderOpen'
}
}
...
@@ -134,6 +139,7 @@ nodeMainSpan p@{ dispatch, folderOpen, frontends, handed, session } = R.createEl
...
@@ -134,6 +139,7 @@ nodeMainSpan p@{ dispatch, folderOpen, frontends, handed, session } = R.createEl
then "fa fa-chevron-right"
then "fa fa-chevron-right"
else "fa fa-chevron-left"
else "fa fa-chevron-left"
} [] ]
} [] ]
else H.div {} []
folderIcon nodeType folderOpen'@(open /\ _) =
folderIcon nodeType folderOpen'@(open /\ _) =
H.a { className: "folder-icon"
H.a { className: "folder-icon"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment