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
791c88fc
Unverified
Commit
791c88fc
authored
Sep 17, 2018
by
Nicolas Pouillard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hide the state of NgramsItem
parent
8c3e1b1f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
20 deletions
+27
-20
NgramsItem.purs
src/Gargantext/Pages/Corpus/Doc/Facets/Terms/NgramsItem.purs
+10
-4
NgramsTable.purs
...Gargantext/Pages/Corpus/Doc/Facets/Terms/NgramsTable.purs
+17
-16
No files found.
src/Gargantext/Pages/Corpus/Doc/Facets/Terms/NgramsItem.purs
View file @
791c88fc
...
@@ -2,17 +2,21 @@ module Gargantext.Pages.Corpus.Doc.Facets.Terms.NgramsItem where
...
@@ -2,17 +2,21 @@ module Gargantext.Pages.Corpus.Doc.Facets.Terms.NgramsItem where
import Prelude
import Prelude
import Data.Newtype (class Newtype)
import Data.Newtype (class Newtype, unwrap)
import Data.Lens.Iso (re)
import Data.Lens.Iso.Newtype (_Newtype)
import React (ReactElement)
import React (ReactElement)
import React.DOM (input, span, td, text, tr)
import React.DOM (input, span, td, text, tr)
import React.DOM.Props (_type, checked, className, onChange, style, title)
import React.DOM.Props (_type, checked, className, onChange, style, title)
import Thermite (PerformAction, Render, Spec, modifyState, simpleSpec)
import Thermite (PerformAction, Render, Spec, modifyState, simpleSpec
, hide, focusState
)
import Gargantext.Utils (getter, setter)
import Gargantext.Utils (getter, setter)
newtype State = State
newtype State = State
{ term :: Term
{ term :: Term
}
}
derive instance newtypeState :: Newtype State _
initialState :: State
initialState :: State
initialState = State {term : Term {id : 10, term : "hello", occurrence : 10, _type : None, children : []}}
initialState = State {term : Term {id : 10, term : "hello", occurrence : 10, _type : None, children : []}}
...
@@ -40,8 +44,10 @@ performAction (SetMap b) _ _ = void do
...
@@ -40,8 +44,10 @@ performAction (SetMap b) _ _ = void do
performAction (SetStop b) _ _ = void do
performAction (SetStop b) _ _ = void do
modifyState \(State s) -> State s {term = setter (_{_type = (if b then StopTerm else None)}) s.term}
modifyState \(State s) -> State s {term = setter (_{_type = (if b then StopTerm else None)}) s.term}
ngramsItemSpec :: Spec State {} Action
ngramsItemSpec :: Spec {} {} Void
ngramsItemSpec = simpleSpec performAction render
ngramsItemSpec = hide (unwrap initialState) $
focusState (re _Newtype) $
simpleSpec performAction render
where
where
render :: Render State {} Action
render :: Render State {} Action
render dispatch _ (State state) _ =
render dispatch _ (State state) _ =
...
...
src/Gargantext/Pages/Corpus/Doc/Facets/Terms/NgramsTable.purs
View file @
791c88fc
...
@@ -15,12 +15,12 @@ import Prelude (class Eq, class Ord, class Show, map, show, void, ($), (*), (+),
...
@@ -15,12 +15,12 @@ import Prelude (class Eq, class Ord, class Show, map, show, void, ($), (*), (+),
import React (ReactElement)
import React (ReactElement)
import React.DOM hiding (style, map)
import React.DOM hiding (style, map)
import React.DOM.Props (_id, _type, className, href, name, onChange, onClick, onInput, placeholder, scope, selected, style, value)
import React.DOM.Props (_id, _type, className, href, name, onChange, onClick, onInput, placeholder, scope, selected, style, value)
import Thermite (PerformAction, Spec, _render, cotransform, focus, foreach, modifyState,
withState,
focusState, hide)
import Thermite (PerformAction, Spec, _render, cotransform, focus, foreach, modifyState, focusState, hide)
import Unsafe.Coerce (unsafeCoerce)
import Unsafe.Coerce (unsafeCoerce)
newtype State = State
newtype State = State
{ items
:: List NI.State
{ items
:: List {}
, search :: String
, search
:: String
, selectString :: String
, selectString :: String
, totalPages :: Int
, totalPages :: Int
, currentPage :: Int
, currentPage :: Int
...
@@ -31,26 +31,26 @@ newtype State = State
...
@@ -31,26 +31,26 @@ newtype State = State
derive instance newtypeState :: Newtype State _
derive instance newtypeState :: Newtype State _
initialState :: State
initialState :: State
initialState = State { items
: toUnfoldable [NI.initialState
]
initialState = State { items
: toUnfoldable [{}
]
, search : ""
, search
: ""
, selectString : ""
, selectString : ""
,totalPages : 10
,
totalPages : 10
, currentPage : 1
, currentPage : 1
, pageSize : PS10
, pageSize : PS10
, totalRecords : 100
, totalRecords : 100
}
}
data Action
data Action
= ItemAction Int
NI.Action
= ItemAction Int
Void
| ChangeString String
| ChangeString String
| SetInput String
| SetInput String
| ChangePageSize PageSizes
| ChangePageSize PageSizes
| ChangePage Int
| ChangePage Int
_itemsList :: Lens' State (List
NI.State
)
_itemsList :: Lens' State (List
{}
)
_itemsList = lens (\(State s) -> s.items) (\(State s) v -> State s { items = v })
_itemsList = lens (\(State s) -> s.items) (\(State s) v -> State s { items = v })
_ItemAction :: Prism' Action (Tuple Int
NI.Action
)
_ItemAction :: Prism' Action (Tuple Int
Void
)
_ItemAction = prism (uncurry ItemAction) \ta ->
_ItemAction = prism (uncurry ItemAction) \ta ->
case ta of
case ta of
ItemAction i a -> Right (Tuple i a)
ItemAction i a -> Right (Tuple i a)
...
@@ -153,13 +153,14 @@ tableSpec = over _render \render dispatch p (State s) c ->
...
@@ -153,13 +153,14 @@ tableSpec = over _render \render dispatch p (State s) c ->
]
]
ngramsTableSpec :: Spec {} {} Void
ngramsTableSpec :: Spec {} {} Void
ngramsTableSpec = hide (unwrap initialState) $
ngramsTableSpec =
focusState (re _Newtype) $
hide (unwrap initialState) $
container $ fold
focusState (re _Newtype) $
[ tableSpec $ withState \st ->
container $
focus _itemsList _ItemAction $
tableSpec $
foreach \_ -> NI.ngramsItemSpec
focus _itemsList _ItemAction $
]
foreach $ \ _ ->
NI.ngramsItemSpec
container :: forall state props action. Spec state props action -> Spec state props action
container :: forall state props action. Spec state props action -> Spec state props action
container = over _render \render d p s c ->
container = over _render \render d p s c ->
...
...
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