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
133
Issues
133
List
Board
Labels
Milestones
Merge Requests
5
Merge Requests
5
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
module Gargantext.Pages.Corpus.Tabs.Actions where
import Data.Lens (Prism', prism)
import Data.Lens (Prism', prism)
import Data.Either (Either(..))
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
import Gargantext.Components.Tab as Tab
data Action
data Action
= DocViewA DV.Action -- = Void
= TabAction Tab.Action -- = ChangeTab which is only used locally
| 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
_
t
abAction :: Prism' Action Tab.Action
_
T
abAction :: Prism' Action Tab.Action
_
tabAction = prism TabViewA
\ action ->
_
TabAction = prism TabAction
\ action ->
case action of
case action of
Tab
ViewA
laction -> Right laction
Tab
Action
laction -> Right laction
_-> Left action
_-> Left action
src/Gargantext/Pages/Corpus/Tabs/Documents.purs
View file @
d898d51d
...
@@ -38,7 +38,7 @@ import Gargantext.Pages.Corpus.Tabs.Types (CorpusInfo(..), Props)
...
@@ -38,7 +38,7 @@ import Gargantext.Pages.Corpus.Tabs.Types (CorpusInfo(..), Props)
import Gargantext.Utils.DecodeMaybe ((.|))
import Gargantext.Utils.DecodeMaybe ((.|))
import React.DOM (a, br', button, div, i, input, p, text)
import React.DOM (a, br', button, div, i, input, p, text)
import React.DOM.Props (_type, className, href, name, onClick, placeholder, style, value)
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: Pagination Details are not available from the BackEnd
-- TODO: Search is pending
-- TODO: Search is pending
...
@@ -51,6 +51,11 @@ type State =
...
@@ -51,6 +51,11 @@ type State =
{ documentIdsToDelete :: Set Int
{ documentIdsToDelete :: Set Int
}
}
initialState :: State
initialState =
{ documentIdsToDelete: mempty
}
data Action
data Action
= MarkFavorites (Array Int)
= MarkFavorites (Array Int)
| ToggleDocumentToDelete Int
| ToggleDocumentToDelete Int
...
@@ -134,6 +139,9 @@ filterSpec = simpleSpec defaultPerformAction render
...
@@ -134,6 +139,9 @@ filterSpec = simpleSpec defaultPerformAction render
, input []
, input []
]]
]]
docViewSpec :: Spec {} Props Void
docViewSpec = hideState (const initialState) layoutDocview
-- | Main layout of the Documents Tab of a Corpus
-- | Main layout of the Documents Tab of a Corpus
layoutDocview :: Spec State Props Action
layoutDocview :: Spec State Props Action
layoutDocview = simpleSpec performAction render
layoutDocview = simpleSpec performAction render
...
...
src/Gargantext/Pages/Corpus/Tabs/Specs.purs
View file @
d898d51d
...
@@ -6,8 +6,8 @@ import Data.List (fromFoldable)
...
@@ -6,8 +6,8 @@ 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, _tablens, initialState
)
import Gargantext.Pages.Corpus.Tabs.States (State(),
initialState, _activeTab
)
import Gargantext.Pages.Corpus.Tabs.Actions (Action(), _
docAction, _t
abAction)
import Gargantext.Pages.Corpus.Tabs.Actions (Action(), _
T
abAction)
import Gargantext.Pages.Corpus.Tabs.Documents as DV
import Gargantext.Pages.Corpus.Tabs.Documents as DV
import Gargantext.Pages.Corpus.Tabs.Ngrams.NgramsTable as NV
import Gargantext.Pages.Corpus.Tabs.Ngrams.NgramsTable as NV
...
@@ -20,35 +20,16 @@ import Thermite (Spec, focus, hideState, noState, cmapProps)
...
@@ -20,35 +20,16 @@ import Thermite (Spec, focus, hideState, noState, cmapProps)
statefulTabs :: Spec State Props Action
statefulTabs :: Spec State Props Action
statefulTabs =
statefulTabs =
Tab.tabs _tablens _tabAction $ fromFoldable [ Tuple "Documents" docPageSpec
Tab.tabs _activeTab _TabAction $ fromFoldable
, Tuple "Authors" authorPageSpec
[ Tuple "Documents" $ noState DV.docViewSpec
, Tuple "Sources" sourcePageSpec
, Tuple "Authors" $ ngramsViewSpec {mode: NV.Authors}
, Tuple "Institutes" institutesPageSpec
, Tuple "Sources" $ ngramsViewSpec {mode: NV.Sources}
, Tuple "Terms" termsPageSpec
, Tuple "Institutes" $ ngramsViewSpec {mode: NV.Institutes}
, Tuple "Trash" trashPageSpec
, Tuple "Terms" $ ngramsViewSpec {mode: NV.Terms}
]
, Tuple "Trash" $ noState DV.docViewSpec -- TODO pass-in trash mode
]
docPageSpec :: Spec State Props Action
docPageSpec = focus _doclens _docAction DV.layoutDocview
ngramsViewSpec :: {mode :: NV.Mode} -> Spec State Props Action
ngramsViewSpec :: {mode :: NV.Mode} -> Spec State Props Action
ngramsViewSpec {mode} =
ngramsViewSpec {mode} =
cmapProps (\{loaded, path, dispatch} -> {mode,loaded,path, dispatch})
cmapProps (\{loaded, path, dispatch} -> {mode,loaded,path, dispatch})
(noState NV.ngramsTableSpec)
(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
module Gargantext.Pages.Corpus.Tabs.States where
import Data.Lens (Lens', lens)
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
import Gargantext.Components.Tab as Tab
type State =
type State =
{ docsView :: D.State
{ activeTab :: Int
, activeTab :: Int
}
}
initialState :: {} -> State
initialState :: {} -> State
initialState _ =
initialState _ =
{ docsView :
{ activeTab: 0
{ documentIdsToDelete : mempty
}
, activeTab : 0
}
}
_doclens :: Lens' State D.State
_activeTab :: Lens' State Tab.State
_doclens = lens (\s -> s.docsView) (\s ss -> s {docsView = ss})
_activeTab = lens _.activeTab (\s ss -> s {activeTab = ss})
_tablens :: Lens' State Tab.State
_tablens = lens (\s -> s.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