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
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Grégoire Locqueville
purescript-gargantext
Commits
edd951c2
Commit
edd951c2
authored
Apr 26, 2022
by
Karen Konou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Folder view] Merge duplicate functions
parent
4ccd62ec
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
20 deletions
+10
-20
FolderView.purs
src/Gargantext/Components/FolderView.purs
+10
-20
No files found.
src/Gargantext/Components/FolderView.purs
View file @
edd951c2
...
...
@@ -92,13 +92,13 @@ folderViewMainCpt = here.component "folderViewMainCpt" cpt where
, reload
, session
, setPopoverRef } _ = do
let folders
S
= A.sortBy sortFolders children
let folders
'
= A.sortBy sortFolders children
let parent = makeParentFolder parentNode session
let childrenEl = makeFolderElements folders
S
{ boxes, nodeId, reload, session, setPopoverRef }
let childrenEl = makeFolderElements folders
'
{ boxes, nodeId, reload, session, setPopoverRef }
pure $ H.div {className: "fv folders"} $ parent <> childrenEl
makeFolderElements folders
S props = makeFolderElementsMap <$> foldersS
where
makeFolderElements folders
' props = makeFolderElementsMap <$> folders'
where
makeFolderElementsMap :: TreeNode -> R.Element
makeFolderElementsMap node = folder { boxes: props.boxes
, nodeId: node.id
...
...
@@ -115,7 +115,6 @@ folderViewMainCpt = here.component "folderViewMainCpt" cpt where
[ folderSimple {style: FolderUp, text: "..", nodeId: parent.id, nodeType: parent.node_type, session: session} [] ]
makeParentFolder Nothing _ = []
sortFolders :: TreeNode-> TreeNode -> Ordering
sortFolders a b = compare a.id b.id
...
...
@@ -128,6 +127,13 @@ type FolderSimpleProps =
, session :: Session
)
getFolderPath :: GT.NodeType -> GT.SessionId -> Int -> AppRoute
getFolderPath nodeType sid nodeId = fromMaybe Home $ nodeTypeAppRoute nodeType sid nodeId
icon :: FolderStyle -> GT.NodeType -> String
icon FolderUp _ = "fa fa-folder-open"
icon _ nodeType = GT.fldr nodeType false
folderSimple :: R2.Component FolderSimpleProps
folderSimple = R.createElement folderSimpleCpt
...
...
@@ -147,14 +153,6 @@ folderSimpleCpt = here.component "folderSimpleCpt" cpt where
route nId rootId nType sid
| rootId == nodeId = Home
| otherwise = getFolderPath nType sid nId
icon :: FolderStyle -> GT.NodeType -> String
icon FolderUp _ = "fa fa-folder-open"
icon _ nodeType = GT.fldr nodeType false
getFolderPath :: GT.NodeType -> GT.SessionId -> Int -> AppRoute
getFolderPath nodeType sid nodeId = fromMaybe Home $ nodeTypeAppRoute nodeType sid nodeId
type FolderProps =
( boxes :: Boxes
...
...
@@ -202,14 +200,6 @@ folderCpt = here.component "folderCpt" cpt where
, H.br {}
, H.text text]]
icon :: FolderStyle -> GT.NodeType -> String
icon FolderUp _ = "fa fa-folder-open"
icon _ nodeType = GT.fldr nodeType false
getFolderPath :: GT.NodeType -> GT.SessionId -> Int -> AppRoute
getFolderPath nodeType sid nodeId = fromMaybe Home $ nodeTypeAppRoute nodeType sid nodeId
onPopoverClose popoverRef _ = Popover.setOpen popoverRef false
popOverIcon = H.span { className: "fv action" } [
...
...
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