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
437dae32
Commit
437dae32
authored
Nov 09, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[sidebar] tag cloud show more/less link
parent
143e9929
Pipeline
#2050
canceled with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
2 deletions
+22
-2
Sidebar.purs
src/Gargantext/Components/GraphExplorer/Sidebar.purs
+22
-2
No files found.
src/Gargantext/Components/GraphExplorer/Sidebar.purs
View file @
437dae32
...
...
@@ -220,6 +220,12 @@ selectedNodesCpt = here.component "selectedNodes" cpt
where
commonProps = RX.pick props :: Record Common
data TagCloudState = Folded | Unfolded
derive instance Eq TagCloudState
flipFold :: TagCloudState -> TagCloudState
flipFold Folded = Unfolded
flipFold Unfolded = Folded
neighborhood :: R2.Component Props
neighborhood = R.createElement neighborhoodCpt
neighborhoodCpt :: R.Component Props
...
...
@@ -230,10 +236,21 @@ neighborhoodCpt = here.component "neighborhood" cpt
} _ = do
{ selectedNodeIds } <- GEST.focusedSidePanel sidePanelGraph
selectedNodeIds' <- T.useLive T.unequal selectedNodeIds
state <- T.useBox Folded
state' <- T.useLive T.unequal state
let badges' = neighbourBadges graph selectedNodeIds'
let numberOfBadgesToShowWhenFolded = 5
badges' = neighbourBadges graph selectedNodeIds'
minSize = F.foldl Math.min 0.0 (Seq.map _.size (SigmaxT.graphNodes graph))
maxSize = F.foldl Math.max 0.0 (Seq.map _.size (SigmaxT.graphNodes graph))
orderedBadges = A.sortWith (\n -> -n.size) $ Seq.toUnfoldable badges' -- reverse sort (largest size first)
displayBadges = case state' of
Folded -> A.take numberOfBadgesToShowWhenFolded orderedBadges
Unfolded -> orderedBadges
stateText = case state' of
Folded -> "Show more"
Unfolded -> "Show less"
showFoldedTooltip = A.length orderedBadges > numberOfBadgesToShowWhenFolded
pure $ RH.div { className: "tab-content", id: "myTabContent" }
[ RH.div { -- className: "flex-space-around d-flex justify-content-center"
...
...
@@ -241,8 +258,11 @@ neighborhoodCpt = here.component "neighborhood" cpt
, id: "home"
, role: "tabpanel"
}
(Seq.toUnfoldable $ Seq.map (\node -> badge { maxSize, minSize, node, selectedNodeIds }) badges')
((\node -> badge { maxSize, minSize, node, selectedNodeIds }) <$> displayBadges) <>
RH.a { on: { click: toggleUnfold state} } [ RH.text stateText ]
]
where
toggleUnfold state = T.modify_ flipFold state
type UpdateTermButtonProps = (
...
...
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