Commit 24d13487 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[TABS] adding Trash Tab

parent 5ea13175
...@@ -8,6 +8,7 @@ import Gargantext.Pages.Corpus.Tabs.Documents as DV ...@@ -8,6 +8,7 @@ import Gargantext.Pages.Corpus.Tabs.Documents as DV
import Gargantext.Pages.Corpus.Tabs.Sources as SV import Gargantext.Pages.Corpus.Tabs.Sources as SV
import Gargantext.Pages.Corpus.Tabs.Authors as AV import Gargantext.Pages.Corpus.Tabs.Authors as AV
import Gargantext.Pages.Corpus.Tabs.Terms as TV import Gargantext.Pages.Corpus.Tabs.Terms as TV
import Gargantext.Pages.Corpus.Tabs.Trash as TT
import Gargantext.Components.Tab as Tab import Gargantext.Components.Tab as Tab
data Action data Action
...@@ -15,6 +16,7 @@ data Action ...@@ -15,6 +16,7 @@ data Action
| SourceviewA SV.Action | SourceviewA SV.Action
| AuthorviewA AV.Action | AuthorviewA AV.Action
| TermsviewA TV.Action | TermsviewA TV.Action
| TrashviewA TT.Action
| TabViewA Tab.Action | TabViewA Tab.Action
_docAction :: Prism' Action DV.Action _docAction :: Prism' Action DV.Action
...@@ -41,6 +43,12 @@ _termsAction = prism TermsviewA \ action -> ...@@ -41,6 +43,12 @@ _termsAction = prism TermsviewA \ action ->
TermsviewA laction -> Right laction TermsviewA laction -> Right laction
_-> Left action _-> Left action
_trashAction :: Prism' Action TT.Action
_trashAction = prism TrashviewA \action ->
case action of
TrashviewA laction -> Right laction
_ -> Left action
_tabAction :: Prism' Action Tab.Action _tabAction :: Prism' Action Tab.Action
_tabAction = prism TabViewA \ action -> _tabAction = prism TabViewA \ action ->
case action of case action of
......
...@@ -16,5 +16,4 @@ authorSpec :: Spec State {} Action ...@@ -16,5 +16,4 @@ authorSpec :: Spec State {} Action
authorSpec = simpleSpec defaultPerformAction render authorSpec = simpleSpec defaultPerformAction render
where where
render :: Render State {} Action render :: Render State {} Action
render dispatch _ state _ = render dispatch _ state _ = []
[ h3 [] [text "AuthorView"]]
...@@ -16,5 +16,4 @@ sourceSpec :: Spec State {} Action ...@@ -16,5 +16,4 @@ sourceSpec :: Spec State {} Action
sourceSpec = simpleSpec defaultPerformAction render sourceSpec = simpleSpec defaultPerformAction render
where where
render :: Render State {} Action render :: Render State {} Action
render dispatch _ state _ = render dispatch _ state _ = []
[ h3 [] [text "Source view"]]
...@@ -6,13 +6,14 @@ import Data.List (fromFoldable) ...@@ -6,13 +6,14 @@ import Data.List (fromFoldable)
import Data.Tuple (Tuple(..)) import Data.Tuple (Tuple(..))
import Gargantext.Pages.Corpus.Tabs.Types (Props) import Gargantext.Pages.Corpus.Tabs.Types (Props)
import Gargantext.Pages.Corpus.Tabs.States (State(), _doclens, _sourcelens, _authorlens, _termslens, _tablens, initialState) import Gargantext.Pages.Corpus.Tabs.States (State(), _doclens, _sourcelens, _authorlens, _termslens, _tablens, initialState, _trashlens)
import Gargantext.Pages.Corpus.Tabs.Actions (Action(), _docAction, _sourceAction, _authorAction, _termsAction, _tabAction) import Gargantext.Pages.Corpus.Tabs.Actions (Action(), _docAction, _sourceAction, _authorAction, _termsAction, _tabAction, _trashAction)
import Gargantext.Pages.Corpus.Tabs.Documents as DV import Gargantext.Pages.Corpus.Tabs.Documents as DV
import Gargantext.Pages.Corpus.Tabs.Sources as SV import Gargantext.Pages.Corpus.Tabs.Sources as SV
import Gargantext.Pages.Corpus.Tabs.Authors as AV import Gargantext.Pages.Corpus.Tabs.Authors as AV
import Gargantext.Pages.Corpus.Tabs.Terms as TV import Gargantext.Pages.Corpus.Tabs.Terms as TV
import Gargantext.Pages.Corpus.Tabs.Trash as TT
import Gargantext.Components.Tab as Tab import Gargantext.Components.Tab as Tab
import Thermite (Spec, focus, hideState, cmapProps) import Thermite (Spec, focus, hideState, cmapProps)
...@@ -26,6 +27,7 @@ statefulTabs = ...@@ -26,6 +27,7 @@ statefulTabs =
, Tuple "Authors" authorPageSpec , Tuple "Authors" authorPageSpec
, Tuple "Sources" sourcePageSpec , Tuple "Sources" sourcePageSpec
, Tuple "Terms" termsPageSpec , Tuple "Terms" termsPageSpec
, Tuple "Trash" trashPageSpec
] ]
docPageSpec :: Spec State Props Action docPageSpec :: Spec State Props Action
...@@ -42,3 +44,9 @@ sourcePageSpec = cmapProps (const {}) (focus _sourcelens _sourceAction SV.source ...@@ -42,3 +44,9 @@ sourcePageSpec = cmapProps (const {}) (focus _sourcelens _sourceAction SV.source
termsPageSpec :: Spec State Props Action termsPageSpec :: Spec State Props Action
termsPageSpec = cmapProps (const {}) (focus _termslens _termsAction TV.termsSpec) termsPageSpec = cmapProps (const {}) (focus _termslens _termsAction TV.termsSpec)
<> docPageSpec <> docPageSpec
trashPageSpec :: Spec State Props Action
trashPageSpec = cmapProps (const {}) (focus _trashlens _trashAction TT.spec)
<> docPageSpec
...@@ -5,6 +5,7 @@ import Gargantext.Pages.Corpus.Tabs.Documents as D ...@@ -5,6 +5,7 @@ import Gargantext.Pages.Corpus.Tabs.Documents as D
import Gargantext.Pages.Corpus.Tabs.Sources as S import Gargantext.Pages.Corpus.Tabs.Sources as S
import Gargantext.Pages.Corpus.Tabs.Authors as A import Gargantext.Pages.Corpus.Tabs.Authors as A
import Gargantext.Pages.Corpus.Tabs.Terms as T import Gargantext.Pages.Corpus.Tabs.Terms as T
import Gargantext.Pages.Corpus.Tabs.Trash as TT
import Gargantext.Components.Tab as Tab import Gargantext.Components.Tab as Tab
...@@ -13,6 +14,7 @@ type State = ...@@ -13,6 +14,7 @@ type State =
, authorsView :: A.State , authorsView :: A.State
, sourcesView :: S.State , sourcesView :: S.State
, termsView :: T.State , termsView :: T.State
, trashView :: TT.State
, activeTab :: Int , activeTab :: Int
} }
...@@ -22,6 +24,7 @@ initialState = ...@@ -22,6 +24,7 @@ initialState =
, authorsView : A.initialState , authorsView : A.initialState
, sourcesView : S.initialState , sourcesView : S.initialState
, termsView : T.initialState , termsView : T.initialState
, trashView : TT.initialState
, activeTab : 0 , activeTab : 0
} }
...@@ -37,5 +40,8 @@ _sourcelens = lens (\s -> s.sourcesView) (\s ss -> s {sourcesView = ss}) ...@@ -37,5 +40,8 @@ _sourcelens = lens (\s -> s.sourcesView) (\s ss -> s {sourcesView = ss})
_termslens :: Lens' State T.State _termslens :: Lens' State T.State
_termslens = lens (\s -> s.termsView) (\s ss -> s {termsView = ss}) _termslens = lens (\s -> s.termsView) (\s ss -> s {termsView = ss})
_trashlens :: Lens' State TT.State
_trashlens = lens (\s -> s.trashView) (\s ss -> s {trashView = ss})
_tablens :: Lens' State Tab.State _tablens :: Lens' State Tab.State
_tablens = lens (\s -> s.activeTab) (\s ss -> s {activeTab = ss}) _tablens = lens (\s -> s.activeTab) (\s ss -> s {activeTab = ss})
...@@ -17,5 +17,4 @@ termsSpec :: Spec State {} Action ...@@ -17,5 +17,4 @@ termsSpec :: Spec State {} Action
termsSpec = simpleSpec defaultPerformAction render termsSpec = simpleSpec defaultPerformAction render
where where
render :: Render State {} Action render :: Render State {} Action
render dispatch _ state _ = render dispatch _ state _ = []
[ h3 [] [text "Terms view"]]
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