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
2f80ed62
Unverified
Commit
2f80ed62
authored
Sep 20, 2018
by
Nicolas Pouillard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaner modifyState usage (please avoid using cotransform)
parent
28f1450d
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
22 additions
and
25 deletions
+22
-25
Tab.purs
src/Gargantext/Components/Tab.purs
+2
-3
Tree.purs
src/Gargantext/Components/Tree.purs
+2
-3
Annotation.purs
src/Gargantext/Pages/Corpus/Doc/Annotation.purs
+1
-1
Authors.purs
src/Gargantext/Pages/Corpus/Doc/Facets/Authors.purs
+1
-1
Documents.purs
src/Gargantext/Pages/Corpus/Doc/Facets/Documents.purs
+4
-4
Terms.purs
src/Gargantext/Pages/Corpus/Doc/Facets/Terms.purs
+1
-1
NgramsTable.purs
...Gargantext/Pages/Corpus/Doc/Facets/Terms/NgramsTable.purs
+4
-5
API.purs
src/Gargantext/Pages/Corpus/User/Users/API.purs
+2
-2
Actions.purs
src/Gargantext/Pages/Layout/Specs/AddCorpus/Actions.purs
+3
-3
Specs.purs
src/Gargantext/Pages/Layout/Specs/AddCorpus/Specs.purs
+1
-1
Search.purs
src/Gargantext/Pages/Layout/Specs/Search.purs
+1
-1
No files found.
src/Gargantext/Components/Tab.purs
View file @
2f80ed62
...
...
@@ -9,7 +9,7 @@ import Data.Tuple (Tuple(..))
import React (ReactElement)
import React.DOM (a, div, nav, text)
import React.DOM.Props (className, onClick)
import Thermite (PerformAction, Render, Spec, _render,
cotransform
, focus, simpleSpec, withState)
import Thermite (PerformAction, Render, Spec, _render,
modifyState
, focus, simpleSpec, withState)
type State = Int
...
...
@@ -34,8 +34,7 @@ tab sid iid (Tuple name spec) = over _render tabRender spec
performAction :: forall props. PerformAction State props Action
performAction (ChangeTab i) _ _ = void do
cotransform \_ -> i
performAction (ChangeTab i) _ _ = void $ modifyState $ const i
render :: forall state props action. State -> List (Tuple String (Spec state props action)) -> Render State props Action
render at ls d p s c =
...
...
src/Gargantext/Components/Tree.purs
View file @
2f80ed62
...
...
@@ -19,7 +19,7 @@ import Effect.Console (log)
import React (ReactElement)
import React.DOM (a, div, i, li, text, ul)
import React.DOM.Props (Props, className, href, onClick)
import Thermite (PerformAction, Render, Spec,
cotransform,
modifyState, simpleSpec)
import Thermite (PerformAction, Render, Spec, modifyState, simpleSpec)
type Name = String
type Open = Boolean
...
...
@@ -38,8 +38,7 @@ initialState :: State
initialState = NTree (LNode {id : 1, name : "", nodeType : "", open : true}) []
performAction :: PerformAction State {} Action
performAction (ToggleFolder i) _ _ = void $
cotransform (\td -> toggleNode i td)
performAction (ToggleFolder i) _ _ = void $ modifyState $ toggleNode i
-- performAction Initialize _ _ = void $ do
-- s <- lift $ loadDefaultNode
...
...
src/Gargantext/Pages/Corpus/Doc/Annotation.purs
View file @
2f80ed62
...
...
@@ -32,7 +32,7 @@ performAction (ChangeString ps) _ _ = pure unit
performAction (ChangeAnotherString ps) _ _ = pure unit
performAction (SetInput ps) _ _ = void do
modifyState
\( state) -> state
{ inputValue = ps }
modifyState
$ _
{ inputValue = ps }
...
...
src/Gargantext/Pages/Corpus/Doc/Facets/Authors.purs
View file @
2f80ed62
...
...
@@ -5,7 +5,7 @@ import Data.Array (fold)
import Gargantext.Pages.Corpus.Doc.Facets.Documents as D
import Prelude hiding (div)
import React.DOM (h3, text)
import Thermite (PerformAction, Render, Spec, defaultPerformAction,
modifyState,
simpleSpec)
import Thermite (PerformAction, Render, Spec, defaultPerformAction, simpleSpec)
type State = D.State
...
...
src/Gargantext/Pages/Corpus/Doc/Facets/Documents.purs
View file @
2f80ed62
...
...
@@ -22,7 +22,7 @@ import Gargantext.Utils.DecodeMaybe ((.|))
import React (ReactElement)
import React.DOM (a, b, b', br', div, input, option, select, span, table, tbody, td, text, th, thead, tr)
import React.DOM.Props (_type, className, href, onChange, onClick, scope, selected, value)
import Thermite (PerformAction, Render, Spec,
cotransform, defaultPerformAction, modifyState
, simpleSpec)
import Thermite (PerformAction, Render, Spec,
modifyState, defaultPerformAction
, simpleSpec)
import Unsafe.Coerce (unsafeCoerce)
...
...
@@ -182,15 +182,15 @@ layoutDocview = simpleSpec performAction render
performAction :: PerformAction State {} Action
performAction (ChangePageSize ps) _ _ = void
(cotransform (\state -> changePageSize ps state ))
performAction (ChangePageSize ps) _ _ = void
$ modifyState $ changePageSize ps
performAction (ChangePage p) _ _ = void
(cotransform (\(TableData td) -> TableData $ td { currentPage = p} ))
performAction (ChangePage p) _ _ = void
$ modifyState \(TableData td) -> TableData $ td { currentPage = p }
performAction LoadData _ _ = do
res <- lift $ loadPage
case res of
Left err -> pure unit
Right resData -> void $ modifyState
(\s -> resData)
Right resData -> void $ modifyState
$ const resData
loadPage :: Aff (Either String CorpusTableData)
...
...
src/Gargantext/Pages/Corpus/Doc/Facets/Terms.purs
View file @
2f80ed62
...
...
@@ -4,7 +4,7 @@ import Data.Array (fold)
import Gargantext.Pages.Corpus.Doc.Facets.Documents as D
import Prelude hiding (div)
import React.DOM (h3, text)
import Thermite (PerformAction, Render, Spec, defaultPerformAction,
modifyState,
simpleSpec)
import Thermite (PerformAction, Render, Spec, defaultPerformAction, simpleSpec)
...
...
src/Gargantext/Pages/Corpus/Doc/Facets/Terms/NgramsTable.purs
View file @
2f80ed62
...
...
@@ -13,11 +13,11 @@ import Data.Void (Void)
import Data.Unit (Unit)
import Effect (Effect)
import Gargantext.Pages.Corpus.Doc.Facets.Terms.NgramsItem as NI
import Prelude (class Eq, class Ord, class Show, map, show, void, ($), (*), (+), (-), (/), (<), (<>), (==), (>), (>=))
import Prelude (class Eq, class Ord, class Show, map, show, void, ($), (*), (+), (-), (/), (<), (<>), (==), (>), (>=)
, pure, unit
)
import React (ReactElement)
import React.DOM hiding (style, map)
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, focusState, hide)
import Thermite (PerformAction, Spec, _render, focus, foreach, modifyState, focusState, hide)
import Unsafe.Coerce (unsafeCoerce)
newtype State = State
...
...
@@ -62,7 +62,7 @@ type Dispatch = Action -> Effect Unit
performAction :: PerformAction State {} Action
performAction (ChangePageSize ps) _ _ = void
(cotransform (\state -> changePageSize ps state ))
performAction (ChangePageSize ps) _ _ = void
$ modifyState $ changePageSize ps
performAction (ChangePage p) _ _ = void do
modifyState \(State state) -> State $ state {currentPage = p}
...
...
@@ -76,8 +76,7 @@ performAction (ChangeString c) _ _ = void do
performAction (SetInput s) _ _ = void do
modifyState \(State state) -> State $ state { search = s }
performAction _ _ _ = void do
modifyState \(State state) -> State $ state
performAction _ _ _ = pure unit
tableSpec :: Spec State {} Action -> Spec State {} Action
tableSpec = over _render \render dispatch p (State s) c ->
...
...
src/Gargantext/Pages/Corpus/User/Users/API.purs
View file @
2f80ed62
...
...
@@ -4,7 +4,7 @@ import Prelude
import Control.Monad.Trans.Class (lift)
import Data.Either (Either(..))
import Data.Lens (
set
)
import Data.Lens (
(?~)
)
import Data.Maybe (Maybe(..))
import Effect.Aff (Aff)
import Effect.Class (liftEffect)
...
...
@@ -21,7 +21,7 @@ performAction :: PerformAction State {} Action
performAction (FetchUser userId) _ _ = do
value <- lift $ getUser userId
_ <- case value of
(Right user) -> void $ modifyState
\state -> set _user (Just user) state
(Right user) -> void $ modifyState
$ _user ?~ user
(Left err) -> do
liftEffect $ log err
liftEffect <<< log $ "Fetching user..."
...
...
src/Gargantext/Pages/Layout/Specs/AddCorpus/Actions.purs
View file @
2f80ed62
...
...
@@ -28,17 +28,17 @@ data Action
performAction :: PerformAction State {} Action
performAction (SelectDatabase selected) _ _ = void do
modifyState
\( state) -> state
{ select_database = selected }
modifyState
$ _
{ select_database = selected }
performAction (UnselectDatabase unselected) _ _ = void do
modifyState
\( state) -> state
{ unselect_database = unselected }
modifyState
$ _
{ unselect_database = unselected }
performAction (LoadDatabaseDetails) _ _ = do
res <- lift $ getDatabaseDetails $ QueryString { query_query: "string",query_name: ["Pubmed"]}
case res of
Left err -> pure unit
Right resData -> do
void $ modifyState $
\(state) -> state
{response = resData}
void $ modifyState $
_
{response = resData}
performAction GO _ _ = do
liftEffect $ setHash "/corpus"
...
...
src/Gargantext/Pages/Layout/Specs/AddCorpus/Specs.purs
View file @
2f80ed62
...
...
@@ -21,7 +21,7 @@ import Gargantext.Components.Modals.Modal (modalHide)
import React (ReactElement)
import React.DOM (button, div, h3, h5, li, span, text, ul)
import React.DOM.Props (_data, _id, _type, aria, className, onClick, role)
import Thermite (PerformAction, Render, Spec, _render,
cotransform, modifyState,
simpleSpec)
import Thermite (PerformAction, Render, Spec, _render, simpleSpec)
modalSpec :: Boolean -> String -> Spec State {} Action -> Spec State {} Action
...
...
src/Gargantext/Pages/Layout/Specs/Search.purs
View file @
2f80ed62
...
...
@@ -29,7 +29,7 @@ data Action
performAction :: PerformAction State {} Action
performAction (SetQuery q) _ _ = void do
modifyState
\( state) -> state
{ query = q }
modifyState
$ _
{ query = q }
performAction GO _ _ = void do
...
...
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