No state for publicationSpec

parent ec64201f
......@@ -3,24 +3,12 @@ module Gargantext.Pages.Corpus.User.Users.Specs.Documents where
import Prelude
import React.DOM (table, tbody, td, text, th, thead, tr)
import React.DOM.Props (className, scope)
import Thermite (PerformAction, Render, Spec, modifyState, simpleSpec)
import Thermite (Render, Spec, defaultPerformAction, simpleSpec)
type State = String
initialState :: State
initialState = ""
data Action = NoOp
performAction :: PerformAction State {} Action
performAction NoOp _ _ = void do
modifyState identity
publicationSpec :: Spec State {} Action
publicationSpec = simpleSpec performAction render
publicationSpec :: Spec {} {} Void
publicationSpec = simpleSpec defaultPerformAction render
where
render :: Render State {} Action
render :: Render {} {} Void
render dispatch _ state _ =
[ table [ className "table"]
[ thead [ className "thead-dark"]
......
......@@ -9,7 +9,7 @@ import Gargantext.Pages.Corpus.User.Users.Types.Types (User)
import Gargantext.Pages.Folder as PS
import Gargantext.Pages.Corpus.User.Users.Specs.Documents as P
import Gargantext.Components.Tab as Tab
import Thermite (Spec, focus)
import Thermite (Spec, noState)
_user :: Lens' State (Maybe User)
_user = lens (\s -> s.user) (\s ss -> s{user = ss})
......@@ -23,17 +23,8 @@ _tabAction = prism TabA \ action ->
TabA laction -> Right laction
_-> Left action
_publens :: Lens' State P.State
_publens = lens (\s -> s.publications) (\s ss -> s { publications= ss})
_pubAction :: Prism' Action P.Action
_pubAction = prism PublicationA \ action ->
case action of
PublicationA laction -> Right laction
_-> Left action
publicationSpec :: Spec State {} Action
publicationSpec = focus _publens _pubAction P.publicationSpec
publicationSpec = noState P.publicationSpec
_projectslens :: Lens' State PS.State
_projectslens = lens (\s -> s.projects) (\s ss -> s {projects = ss})
......
......@@ -8,14 +8,12 @@ import Gargantext.Components.Tab as Tab
data Action
= NoOp
| PublicationA P.Action
| ProjectsA PS.Action
| TabA Tab.Action
| FetchUser Int
type State =
{ activeTab :: Int
, publications :: P.State
, projects :: PS.State
, user :: Maybe User
}
......@@ -23,7 +21,6 @@ type State =
initialState :: State
initialState =
{ activeTab : 0
, publications : P.initialState
, projects : PS.initialState
, user: Nothing
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment