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
e93e14f2
Unverified
Commit
e93e14f2
authored
Oct 14, 2019
by
Nicolas Pouillard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NgramsTable: short export list, no warnings
parent
998ad895
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
11 deletions
+15
-11
NgramsTable.purs
src/Gargantext/Components/NgramsTable.purs
+15
-11
No files found.
src/Gargantext/Components/NgramsTable.purs
View file @
e93e14f2
module Gargantext.Components.NgramsTable where
module Gargantext.Components.NgramsTable
( MainNgramsTableProps
, mainNgramsTable
) where
import Prelude
import Prelude
( class Show, Unit, bind, const, discard, identity, map, mempty, not
( class Show, Unit, bind, const, discard, identity, map, mempty, not
, pure, show, unit, (#), ($), (&&), (+), (/=), (<$>), (<<<), (<>), (=<<)
, pure, show, unit, (#), ($), (&&), (+), (/=), (<$>), (<<<), (<>), (=<<)
, (==), (||) )
, (==), (||) )
import Data.Array as A
import Data.Array as A
import Data.Lens (to, view, (%~), (.~), (^.), (^..))
import Data.Lens (
Lens',
to, view, (%~), (.~), (^.), (^..))
import Data.Lens.Common (_Just)
import Data.Lens.Common (_Just)
import Data.Lens.At (at)
import Data.Lens.At (at)
import Data.Lens.Index (ix)
import Data.Lens.Index (ix)
...
@@ -54,6 +57,7 @@ type State =
...
@@ -54,6 +57,7 @@ type State =
-- be removed.
-- be removed.
)
)
_ngramsChildren :: forall row. Lens' { ngramsChildren :: Map NgramsTerm Boolean | row } (Map NgramsTerm Boolean)
_ngramsChildren = prop (SProxy :: SProxy "ngramsChildren")
_ngramsChildren = prop (SProxy :: SProxy "ngramsChildren")
initialState :: VersionedNgramsTable -> State
initialState :: VersionedNgramsTable -> State
...
@@ -191,11 +195,11 @@ type Props =
...
@@ -191,11 +195,11 @@ type Props =
, path :: R.State PageParams
, path :: R.State PageParams
, versioned :: VersionedNgramsTable )
, versioned :: VersionedNgramsTable )
n
gramsTable :: Record Props -> R.Element
loadedN
gramsTable :: Record Props -> R.Element
ngramsTable props = R.createElement n
gramsTableCpt props []
loadedNgramsTable props = R.createElement loadedN
gramsTableCpt props []
n
gramsTableCpt :: R.Component Props
loadedN
gramsTableCpt :: R.Component Props
ngramsTableCpt = R.hooksComponent "G.C.NgramsTable.n
gramsTable" cpt
loadedNgramsTableCpt = R.hooksComponent "G.C.NgramsTable.loadedN
gramsTable" cpt
where
where
cpt {versioned} _ = do
cpt {versioned} _ = do
state <- useNgramsReducer (initialState versioned)
state <- useNgramsReducer (initialState versioned)
...
@@ -308,7 +312,7 @@ mainNgramsTableCpt = R.hooksComponent "MainNgramsTable" cpt
...
@@ -308,7 +312,7 @@ mainNgramsTableCpt = R.hooksComponent "MainNgramsTable" cpt
cpt {nodeId, defaultListId, tabType, session, tabNgramType} _ = do
cpt {nodeId, defaultListId, tabType, session, tabNgramType} _ = do
path <- R.useState' $ initialPageParams session nodeId [defaultListId] tabType
path <- R.useState' $ initialPageParams session nodeId [defaultListId] tabType
useLoader2 path (loadNgramsTable session) $
useLoader2 path (loadNgramsTable session) $
\versioned ->
n
gramsTable {session, tabNgramType, path, versioned}
\versioned ->
loadedN
gramsTable {session, tabNgramType, path, versioned}
type NgramsDepth = {ngrams :: NgramsTerm, depth :: Int}
type NgramsDepth = {ngrams :: NgramsTerm, depth :: Int}
type NgramsClick = NgramsDepth -> Maybe (Effect Unit)
type NgramsClick = NgramsDepth -> Maybe (Effect Unit)
...
@@ -318,10 +322,10 @@ tree :: { ngramsTable :: NgramsTable
...
@@ -318,10 +322,10 @@ tree :: { ngramsTable :: NgramsTable
, ngramsEdit :: NgramsClick
, ngramsEdit :: NgramsClick
, ngramsClick :: NgramsClick
, ngramsClick :: NgramsClick
} -> NgramsDepth -> ReactElement
} -> NgramsDepth -> ReactElement
tree params@{ngramsTable, ngramsStyle, ngramsEdit, ngramsClick} nd
@{ngrams}
=
tree params@{ngramsTable, ngramsStyle, ngramsEdit, ngramsClick} nd =
li [ style {width : "100%"} ]
li [ style {width : "100%"} ]
([ i icon []
([ i icon []
, tag [text $ " " <> ngrams]
, tag [text $ " " <> n
d.n
grams]
] <> maybe [] edit (ngramsEdit nd) <>
] <> maybe [] edit (ngramsEdit nd) <>
[ forest cs
[ forest cs
])
])
...
@@ -339,7 +343,7 @@ tree params@{ngramsTable, ngramsStyle, ngramsEdit, ngramsClick} nd@{ngrams} =
...
@@ -339,7 +343,7 @@ tree params@{ngramsTable, ngramsStyle, ngramsEdit, ngramsClick} nd@{ngrams} =
icon = gray <> [className $ "glyphicon glyphicon-chevron-" <> if open then "down" else "right"]
icon = gray <> [className $ "glyphicon glyphicon-chevron-" <> if open then "down" else "right"]
open = not leaf || false {- TODO -}
open = not leaf || false {- TODO -}
gray = if leaf then [style {color: "#adb5bd"}] else []
gray = if leaf then [style {color: "#adb5bd"}] else []
cs = ngramsTable ^.. ix ngrams <<< _NgramsElement <<< _children <<< folded
cs = ngramsTable ^.. ix n
d.n
grams <<< _NgramsElement <<< _children <<< folded
forest =
forest =
let depth = nd.depth + 1 in
let depth = nd.depth + 1 in
...
...
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