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
f1023aa0
Commit
f1023aa0
authored
Apr 11, 2022
by
arturo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
>>> continue
parent
28da24f3
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
57 additions
and
39 deletions
+57
-39
Node.js
src/Gargantext/Components/Forest/Tree/Node.js
+1
-0
Node.purs
src/Gargantext/Components/Forest/Tree/Node.purs
+44
-26
Sidebar.purs
src/Gargantext/Components/GraphExplorer/Sidebar.purs
+1
-4
Phylo.purs
src/Gargantext/Components/Nodes/Corpus/Phylo.purs
+2
-2
Layout.purs
src/Gargantext/Components/PhyloExplorer/Layout.purs
+4
-3
TopBar.purs
src/Gargantext/Components/PhyloExplorer/TopBar.purs
+5
-4
No files found.
src/Gargantext/Components/Forest/Tree/Node.js
0 → 100644
View file @
f1023aa0
exports
.
nodeUserRegexp
=
/
(
@
{1}
.*
)
.gargantext.org$/
;
src/Gargantext/Components/Forest/Tree/Node.purs
View file @
f1023aa0
module Gargantext.Components.Forest.Tree.Node where
module Gargantext.Components.Forest.Tree.Node
( nodeSpan
, blankNodeSpan
) where
import Gargantext.Prelude
import Gargantext.Prelude
import Data.Array.NonEmpty as NArray
import Data.Foldable (intercalate)
import Data.Foldable (intercalate)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..)
, maybe
)
import Data.Nullable (null)
import Data.Nullable (null)
import Data.String.Regex as Regex
import Data.Symbol (SProxy(..))
import Data.Symbol (SProxy(..))
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Effect (Effect)
...
@@ -43,6 +48,9 @@ import Reactix.DOM.HTML as H
...
@@ -43,6 +48,9 @@ import Reactix.DOM.HTML as H
import Record as Record
import Record as Record
import Toestand as T
import Toestand as T
-- (?) never been able to properly declare PureScript Regex...
foreign import nodeUserRegexp :: Regex.Regex
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.Forest.Tree.Node"
here = R2.here "Gargantext.Components.Forest.Tree.Node"
...
@@ -285,6 +293,7 @@ nodeSpanCpt = here.component "nodeSpan" cpt
...
@@ -285,6 +293,7 @@ nodeSpanCpt = here.component "nodeSpan" cpt
, href
, href
, id
, id
, name: name' props.name nodeType session
, name: name' props.name nodeType session
, type: nodeType
}
}
,
,
...
@@ -411,45 +420,54 @@ folderIconCpt = here.component "folderIcon" cpt where
...
@@ -411,45 +420,54 @@ folderIconCpt = here.component "folderIcon" cpt where
-----------------------------------------------
-----------------------------------------------
type NodeLinkProps =
type NodeLinkProps =
( callback :: Unit -> Effect Unit
( callback :: Unit -> Effect Unit
, href :: String
, href :: String
, id :: Int
, id :: Int
, name :: GT.Name
, name :: GT.Name
, type :: GT.NodeType
)
)
nodeLink :: R2.Leaf NodeLinkProps
nodeLink :: R2.Leaf NodeLinkProps
nodeLink = R2.leaf nodeLinkCpt
nodeLink = R2.leaf nodeLinkCpt
nodeLinkCpt :: R.Component NodeLinkProps
nodeLinkCpt :: R.Component NodeLinkProps
nodeLinkCpt = here.component "nodeLink" cpt
nodeLinkCpt = here.component "nodeLink" cpt
where
where
cpt { callback
cpt { callback
, href
, href
, id
, id
, name
, nam
e
, type: nodeTyp
e
} _ = do
} _ = do
-- Computed
let
let
tid = tooltipId name id
tid = tooltipId name id
aProps =
aProps =
{ href
{ href
} `Record.merge` B.tooltipBind tid
} `Record.merge` B.tooltipBind tid
pure $
-- Render
pure $
H.div
H.div
{ className: "mainleaf__node-link"
{ className: "mainleaf__node-link"
, on: { click: const $ callback unit }
, on: { click: const $ callback unit }
}
}
[
H.a
aProps
[
[
H.a
B.span_ $ nodeLinkText nodeType name
aProps
[
B.span_ $ textEllipsisBreak 15 name
]
]
]
]
nodeLinkText :: GT.NodeType -> String -> String
nodeLinkText GT.NodeUser s = s # (truncateNodeUser)
>>> maybe s identity
nodeLinkText _ s = textEllipsisBreak 15 s
truncateNodeUser :: String -> Maybe String
truncateNodeUser = Regex.match (nodeUserRegexp) >=> flip NArray.index 1 >>> join
---------------------------------------------------
---------------------------------------------------
...
...
src/Gargantext/Components/GraphExplorer/Sidebar.purs
View file @
f1023aa0
...
@@ -326,7 +326,7 @@ selectedNodesCpt = here.component "selectedNodes" cpt where
...
@@ -326,7 +326,7 @@ selectedNodesCpt = here.component "selectedNodes" cpt where
[
[
updateTermButton
updateTermButton
( commonProps `Record.merge`
( commonProps `Record.merge`
{ variant: ButtonVariant
Primary
{ variant: ButtonVariant
Success
, rType: CandidateTerm
, rType: CandidateTerm
, nodesMap
, nodesMap
}
}
...
@@ -344,9 +344,6 @@ selectedNodesCpt = here.component "selectedNodes" cpt where
...
@@ -344,9 +344,6 @@ selectedNodesCpt = here.component "selectedNodes" cpt where
]
]
]
]
---------------------------------------------------------
---------------------------------------------------------
neighborhood :: R2.Leaf Props
neighborhood :: R2.Leaf Props
...
...
src/Gargantext/Components/Nodes/Corpus/Phylo.purs
View file @
f1023aa0
...
@@ -93,7 +93,7 @@ phyloLayoutCpt = here.component "main" cpt where
...
@@ -93,7 +93,7 @@ phyloLayoutCpt = here.component "main" cpt where
case mEl of
case mEl of
Nothing -> R.nothing
Nothing -> R.nothing
Just el -> R2.addClass el [ "p-0
--i
" ]
Just el -> R2.addClass el [ "p-0" ]
R.useEffectOnce do
R.useEffectOnce do
pure do
pure do
...
@@ -101,7 +101,7 @@ phyloLayoutCpt = here.component "main" cpt where
...
@@ -101,7 +101,7 @@ phyloLayoutCpt = here.component "main" cpt where
case mEl of
case mEl of
Nothing -> R.nothing
Nothing -> R.nothing
Just el -> R2.removeClass el [ "p-0
--i
" ]
Just el -> R2.removeClass el [ "p-0" ]
-- | Render
-- | Render
...
...
src/Gargantext/Components/PhyloExplorer/Layout.purs
View file @
f1023aa0
...
@@ -21,7 +21,7 @@ import Gargantext.Components.PhyloExplorer.TopBar (topBar)
...
@@ -21,7 +21,7 @@ import Gargantext.Components.PhyloExplorer.TopBar (topBar)
import Gargantext.Components.PhyloExplorer.Types (DisplayView(..), PhyloDataSet(..), ExtractedTerm, ExtractedCount, Source, Term, sortSources)
import Gargantext.Components.PhyloExplorer.Types (DisplayView(..), PhyloDataSet(..), ExtractedTerm, ExtractedCount, Source, Term, sortSources)
import Gargantext.Hooks.FirstEffect (useFirstEffect')
import Gargantext.Hooks.FirstEffect (useFirstEffect')
import Gargantext.Hooks.UpdateEffect (useUpdateEffect1')
import Gargantext.Hooks.UpdateEffect (useUpdateEffect1')
import Gargantext.Types (NodeID)
import Gargantext.Types (NodeID
, SidePanelState(..)
)
import Gargantext.Utils (getter, (?))
import Gargantext.Utils (getter, (?))
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Graphics.D3.Base (d3)
import Graphics.D3.Base (d3)
...
@@ -46,6 +46,7 @@ layoutCpt = here.component "layout" cpt where
...
@@ -46,6 +46,7 @@ layoutCpt = here.component "layout" cpt where
cpt { phyloDataSet: (PhyloDataSet o)
cpt { phyloDataSet: (PhyloDataSet o)
, nodeId
, nodeId
} _ = do
} _ = do
-- States
-- States
---------
---------
...
@@ -82,7 +83,7 @@ layoutCpt = here.component "layout" cpt where
...
@@ -82,7 +83,7 @@ layoutCpt = here.component "layout" cpt where
R2.useBox' false
R2.useBox' false
sideBarDisplayed /\ sideBarDisplayedBox <-
sideBarDisplayed /\ sideBarDisplayedBox <-
R2.useBox'
false
R2.useBox'
InitialClosed
extractedTerms /\ extractedTermsBox <-
extractedTerms /\ extractedTermsBox <-
R2.useBox' (mempty :: Array ExtractedTerm)
R2.useBox' (mempty :: Array ExtractedTerm)
...
@@ -256,7 +257,7 @@ layoutCpt = here.component "layout" cpt where
...
@@ -256,7 +257,7 @@ layoutCpt = here.component "layout" cpt where
{ className: "phylo__sidebar"
{ className: "phylo__sidebar"
-- @XXX: ReactJS lack of "keep-alive" feature workaround solution
-- @XXX: ReactJS lack of "keep-alive" feature workaround solution
-- @link https://github.com/facebook/react/issues/12039
-- @link https://github.com/facebook/react/issues/12039
, style: { display: sideBarDisplayed ? "block" $ "none" }
, style: { display: sideBarDisplayed
== Opened
? "block" $ "none" }
}
}
[
[
sideBar
sideBar
...
...
src/Gargantext/Components/PhyloExplorer/TopBar.purs
View file @
f1023aa0
...
@@ -9,6 +9,7 @@ import Effect (Effect)
...
@@ -9,6 +9,7 @@ import Effect (Effect)
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (ButtonVariant(..), ComponentStatus(..), Variant(..))
import Gargantext.Components.Bootstrap.Types (ButtonVariant(..), ComponentStatus(..), Variant(..))
import Gargantext.Components.PhyloExplorer.Types (Term(..), Source(..))
import Gargantext.Components.PhyloExplorer.Types (Term(..), Source(..))
import Gargantext.Types (SidePanelState(..), toggleSidePanelState)
import Gargantext.Utils ((?))
import Gargantext.Utils ((?))
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Reactix (nothing)
import Reactix (nothing)
...
@@ -27,7 +28,7 @@ type Props =
...
@@ -27,7 +28,7 @@ type Props =
, resultCallback :: Maybe Term -> Effect Unit
, resultCallback :: Maybe Term -> Effect Unit
, toolBar :: T.Box (Boolean)
, toolBar :: T.Box (Boolean)
, sideBar :: T.Box (
Boolean
)
, sideBar :: T.Box (
SidePanelState
)
)
)
here :: R2.Here
here :: R2.Here
...
@@ -71,12 +72,12 @@ component = here.component "main" cpt where
...
@@ -71,12 +72,12 @@ component = here.component "main" cpt where
-- Sidebar toggle
-- Sidebar toggle
B.button
B.button
{ className: "phylo-topbar__sidebar"
{ className: "phylo-topbar__sidebar"
, callback: \_ -> T.modify_ (
not
) sideBar
, callback: \_ -> T.modify_ (
toggleSidePanelState
) sideBar
, variant: sideBar' ?
, variant: sideBar'
== Opened
?
ButtonVariant Light $
ButtonVariant Light $
OutlinedButtonVariant Light
OutlinedButtonVariant Light
}
}
[ H.text $ sideBar' ? "Hide sidebar" $ "Show sidebar" ]
[ H.text $ sideBar'
== Opened
? "Hide sidebar" $ "Show sidebar" ]
,
,
-- Source
-- Source
H.div
H.div
...
...
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