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
143
Issues
143
List
Board
Labels
Milestones
Merge Requests
8
Merge Requests
8
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
gargantext
purescript-gargantext
Commits
d898d51d
Unverified
Commit
d898d51d
authored
Nov 28, 2018
by
Nicolas Pouillard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove docsView from global state
parent
24191699
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
60 deletions
+27
-60
Actions.purs
src/Gargantext/Pages/Corpus/Tabs/Actions.purs
+4
-15
Documents.purs
src/Gargantext/Pages/Corpus/Tabs/Documents.purs
+9
-1
Specs.purs
src/Gargantext/Pages/Corpus/Tabs/Specs.purs
+10
-29
States.purs
src/Gargantext/Pages/Corpus/Tabs/States.purs
+4
-15
No files found.
src/Gargantext/Pages/Corpus/Tabs/Actions.purs
View file @
d898d51d
module Gargantext.Pages.Corpus.Tabs.Actions where
import Data.Lens (Prism', prism)
import Data.Either (Either(..))
import Data.Void (Void)
import Gargantext.Pages.Corpus.Tabs.Documents as DV
import Gargantext.Pages.Corpus.Tabs.Ngrams.NgramsTable as NG
import Gargantext.Components.Tab as Tab
data Action
= DocViewA DV.Action -- = Void
| TabViewA Tab.Action -- = ChangeTab which is only used locally
_docAction :: Prism' Action DV.Action
_docAction = prism DocViewA \ action ->
case action of
DocViewA laction -> Right laction
_-> Left action
= TabAction Tab.Action -- = ChangeTab which is only used locally
_
t
abAction :: Prism' Action Tab.Action
_
tabAction = prism TabViewA
\ action ->
_
T
abAction :: Prism' Action Tab.Action
_
TabAction = prism TabAction
\ action ->
case action of
Tab
ViewA
laction -> Right laction
Tab
Action
laction -> Right laction
_-> Left action
src/Gargantext/Pages/Corpus/Tabs/Documents.purs
View file @
d898d51d
...
...
@@ -38,7 +38,7 @@ import Gargantext.Pages.Corpus.Tabs.Types (CorpusInfo(..), Props)
import Gargantext.Utils.DecodeMaybe ((.|))
import React.DOM (a, br', button, div, i, input, p, text)
import React.DOM.Props (_type, className, href, name, onClick, placeholder, style, value)
import Thermite (PerformAction, Render, Spec, defaultPerformAction, modifyState_, simpleSpec)
import Thermite (PerformAction, Render, Spec, defaultPerformAction, modifyState_, simpleSpec
, hideState
)
------------------------------------------------------------------------
-- TODO: Pagination Details are not available from the BackEnd
-- TODO: Search is pending
...
...
@@ -51,6 +51,11 @@ type State =
{ documentIdsToDelete :: Set Int
}
initialState :: State
initialState =
{ documentIdsToDelete: mempty
}
data Action
= MarkFavorites (Array Int)
| ToggleDocumentToDelete Int
...
...
@@ -134,6 +139,9 @@ filterSpec = simpleSpec defaultPerformAction render
, input []
]]
docViewSpec :: Spec {} Props Void
docViewSpec = hideState (const initialState) layoutDocview
-- | Main layout of the Documents Tab of a Corpus
layoutDocview :: Spec State Props Action
layoutDocview = simpleSpec performAction render
...
...
src/Gargantext/Pages/Corpus/Tabs/Specs.purs
View file @
d898d51d
...
...
@@ -6,8 +6,8 @@ import Data.List (fromFoldable)
import Data.Tuple (Tuple(..))
import Gargantext.Pages.Corpus.Tabs.Types (Props)
import Gargantext.Pages.Corpus.Tabs.States (State(),
_doclens, _tablens, initialState
)
import Gargantext.Pages.Corpus.Tabs.Actions (Action(), _
docAction, _t
abAction)
import Gargantext.Pages.Corpus.Tabs.States (State(),
initialState, _activeTab
)
import Gargantext.Pages.Corpus.Tabs.Actions (Action(), _
T
abAction)
import Gargantext.Pages.Corpus.Tabs.Documents as DV
import Gargantext.Pages.Corpus.Tabs.Ngrams.NgramsTable as NV
...
...
@@ -20,35 +20,16 @@ import Thermite (Spec, focus, hideState, noState, cmapProps)
statefulTabs :: Spec State Props Action
statefulTabs =
Tab.tabs _tablens _tabAction $ fromFoldable [ Tuple "Documents" docPageSpec
, Tuple "Authors" authorPageSpec
, Tuple "Sources" sourcePageSpec
, Tuple "Institutes" institutesPageSpec
, Tuple "Terms" termsPageSpec
, Tuple "Trash" trashPageSpec
]
docPageSpec :: Spec State Props Action
docPageSpec = focus _doclens _docAction DV.layoutDocview
Tab.tabs _activeTab _TabAction $ fromFoldable
[ Tuple "Documents" $ noState DV.docViewSpec
, Tuple "Authors" $ ngramsViewSpec {mode: NV.Authors}
, Tuple "Sources" $ ngramsViewSpec {mode: NV.Sources}
, Tuple "Institutes" $ ngramsViewSpec {mode: NV.Institutes}
, Tuple "Terms" $ ngramsViewSpec {mode: NV.Terms}
, Tuple "Trash" $ noState DV.docViewSpec -- TODO pass-in trash mode
]
ngramsViewSpec :: {mode :: NV.Mode} -> Spec State Props Action
ngramsViewSpec {mode} =
cmapProps (\{loaded, path, dispatch} -> {mode,loaded,path, dispatch})
(noState NV.ngramsTableSpec)
authorPageSpec :: Spec State Props Action
authorPageSpec = ngramsViewSpec {mode: NV.Authors}
sourcePageSpec :: Spec State Props Action
sourcePageSpec = ngramsViewSpec {mode: NV.Sources}
institutesPageSpec :: Spec State Props Action
institutesPageSpec = ngramsViewSpec {mode: NV.Institutes}
termsPageSpec :: Spec State Props Action
termsPageSpec = ngramsViewSpec {mode: NV.Terms}
trashPageSpec :: Spec State Props Action
trashPageSpec = focus _doclens _docAction DV.layoutDocview
src/Gargantext/Pages/Corpus/Tabs/States.purs
View file @
d898d51d
module Gargantext.Pages.Corpus.Tabs.States where
import Data.Lens (Lens', lens)
import Gargantext.Prelude
import Gargantext.Pages.Corpus.Tabs.Documents as D
import Gargantext.Pages.Corpus.Tabs.Ngrams.NgramsTable as N
import Gargantext.Components.Tab as Tab
type State =
{ docsView :: D.State
, activeTab :: Int
{ activeTab :: Int
}
initialState :: {} -> State
initialState _ =
{ docsView :
{ documentIdsToDelete : mempty
}
, activeTab : 0
{ activeTab: 0
}
_doclens :: Lens' State D.State
_doclens = lens (\s -> s.docsView) (\s ss -> s {docsView = ss})
_tablens :: Lens' State Tab.State
_tablens = lens (\s -> s.activeTab) (\s ss -> s {activeTab = ss})
_activeTab :: Lens' State Tab.State
_activeTab = lens _.activeTab (\s ss -> s {activeTab = ss})
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