No state for publicationSpec

parent ec64201f
...@@ -3,24 +3,12 @@ module Gargantext.Pages.Corpus.User.Users.Specs.Documents where ...@@ -3,24 +3,12 @@ module Gargantext.Pages.Corpus.User.Users.Specs.Documents where
import Prelude import Prelude
import React.DOM (table, tbody, td, text, th, thead, tr) import React.DOM (table, tbody, td, text, th, thead, tr)
import React.DOM.Props (className, scope) import React.DOM.Props (className, scope)
import Thermite (PerformAction, Render, Spec, modifyState, simpleSpec) import Thermite (Render, Spec, defaultPerformAction, simpleSpec)
publicationSpec :: Spec {} {} Void
type State = String publicationSpec = simpleSpec defaultPerformAction render
initialState :: State
initialState = ""
data Action = NoOp
performAction :: PerformAction State {} Action
performAction NoOp _ _ = void do
modifyState identity
publicationSpec :: Spec State {} Action
publicationSpec = simpleSpec performAction render
where where
render :: Render State {} Action render :: Render {} {} Void
render dispatch _ state _ = render dispatch _ state _ =
[ table [ className "table"] [ table [ className "table"]
[ thead [ className "thead-dark"] [ thead [ className "thead-dark"]
......
...@@ -9,7 +9,7 @@ import Gargantext.Pages.Corpus.User.Users.Types.Types (User) ...@@ -9,7 +9,7 @@ import Gargantext.Pages.Corpus.User.Users.Types.Types (User)
import Gargantext.Pages.Folder as PS import Gargantext.Pages.Folder as PS
import Gargantext.Pages.Corpus.User.Users.Specs.Documents as P import Gargantext.Pages.Corpus.User.Users.Specs.Documents as P
import Gargantext.Components.Tab as Tab import Gargantext.Components.Tab as Tab
import Thermite (Spec, focus) import Thermite (Spec, noState)
_user :: Lens' State (Maybe User) _user :: Lens' State (Maybe User)
_user = lens (\s -> s.user) (\s ss -> s{user = ss}) _user = lens (\s -> s.user) (\s ss -> s{user = ss})
...@@ -23,17 +23,8 @@ _tabAction = prism TabA \ action -> ...@@ -23,17 +23,8 @@ _tabAction = prism TabA \ action ->
TabA laction -> Right laction TabA laction -> Right laction
_-> Left action _-> 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 :: Spec State {} Action
publicationSpec = focus _publens _pubAction P.publicationSpec publicationSpec = noState P.publicationSpec
_projectslens :: Lens' State PS.State _projectslens :: Lens' State PS.State
_projectslens = lens (\s -> s.projects) (\s ss -> s {projects = ss}) _projectslens = lens (\s -> s.projects) (\s ss -> s {projects = ss})
......
...@@ -8,14 +8,12 @@ import Gargantext.Components.Tab as Tab ...@@ -8,14 +8,12 @@ import Gargantext.Components.Tab as Tab
data Action data Action
= NoOp = NoOp
| PublicationA P.Action
| ProjectsA PS.Action | ProjectsA PS.Action
| TabA Tab.Action | TabA Tab.Action
| FetchUser Int | FetchUser Int
type State = type State =
{ activeTab :: Int { activeTab :: Int
, publications :: P.State
, projects :: PS.State , projects :: PS.State
, user :: Maybe User , user :: Maybe User
} }
...@@ -23,7 +21,6 @@ type State = ...@@ -23,7 +21,6 @@ type State =
initialState :: State initialState :: State
initialState = initialState =
{ activeTab : 0 { activeTab : 0
, publications : P.initialState
, projects : PS.initialState , projects : PS.initialState
, user: Nothing , 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