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
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Grégoire Locqueville
purescript-gargantext
Commits
89c0af1a
Unverified
Commit
89c0af1a
authored
Nov 23, 2018
by
Nicolas Pouillard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extra props for loader
parent
cae0c4bc
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
32 additions
and
21 deletions
+32
-21
Loader.purs
src/Gargantext/Components/Loader.purs
+14
-12
Annuaire.purs
src/Gargantext/Pages/Annuaire.purs
+9
-4
Corpus.purs
src/Gargantext/Pages/Corpus.purs
+3
-2
NgramsTable.purs
src/Gargantext/Pages/Corpus/Tabs/Ngrams/NgramsTable.purs
+4
-2
Specs.purs
src/Gargantext/Pages/Corpus/Tabs/Specs.purs
+1
-1
Types.purs
src/Gargantext/Pages/Corpus/Tabs/Types.purs
+1
-0
No files found.
src/Gargantext/Components/Loader.purs
View file @
89c0af1a
...
...
@@ -12,22 +12,24 @@ import Thermite (Render, PerformAction, simpleSpec, modifyState_, createReactSpe
data Action path = ForceReload | SetPath path
type InnerProps path loaded =
type InnerProps path loaded
props
=
{ path :: path
, loaded :: Maybe loaded
, dispatch :: Action path -> Effect Unit
, props :: props
, children :: Children
}
type PropsRow path loaded row =
type PropsRow path loaded
props
row =
( path :: path
, component :: ReactClass (InnerProps path loaded)
, component :: ReactClass (InnerProps path loaded props)
, props :: props
| row
)
type Props path loaded
= Record (PropsRow path loaded
(children :: Children))
type Props path loaded
props = Record (PropsRow path loaded props
(children :: Children))
type Props' path loaded
= Record (PropsRow path loaded
())
type Props' path loaded
props = Record (PropsRow path loaded props
())
type State path loaded = { currentPath :: path, loaded :: Maybe loaded }
...
...
@@ -59,23 +61,23 @@ createLoaderClass' name loader render =
{spec, dispatcher} = createReactSpec (simpleSpec performAction render) initialState
createLoaderClass :: forall path loaded
createLoaderClass :: forall path loaded
props
. Eq path
=> String
-> (path -> Aff loaded)
-> ReactClass (Record (PropsRow path loaded (children :: Children)))
-> ReactClass (Record (PropsRow path loaded
props
(children :: Children)))
createLoaderClass name loader =
createLoaderClass' name loader render
where
render :: Render (State path loaded) (Props' path loaded) (Action path)
render dispatch {component} {currentPath, loaded} c =
[React.createElement component {path: currentPath, loaded, dispatch} c]
render :: Render (State path loaded) (Props' path loaded
props
) (Action path)
render dispatch {component
, props
} {currentPath, loaded} c =
[React.createElement component {path: currentPath, loaded, dispatch
, props
} c]
{-
createLoaderClass :: forall path loaded
createLoaderClass :: forall path loaded
props
. String
-> (path -> Aff loaded)
-> ReactClass (Props path loaded)
-> ReactClass (Props path loaded
props
)
createLoaderClass name loader = React.component name mk
where
mk this =
...
...
src/Gargantext/Pages/Annuaire.purs
View file @
89c0af1a
...
...
@@ -28,7 +28,9 @@ import Gargantext.Pages.Annuaire.User.Contacts.Types (Contact(..), HyperData(..)
type Props =
{ path :: Int
, loaded :: Maybe AnnuaireInfo
, dispatch :: Loader.Action Int -> Effect Unit }
, dispatch :: Loader.Action Int -> Effect Unit
, props :: {}
}
data Action
= TabsA Tab.Action
...
...
@@ -76,6 +78,7 @@ layout = simpleSpec defaultPerformAction render
[ annuaireLoader
{ path: annuaireId
, component: createClass "LoadedAnnuaire" loadedAnnuaireSpec (const {})
, props: {}
} ]
loadedAnnuaireSpec :: Spec {} Props Void
...
...
@@ -97,6 +100,7 @@ loadedAnnuaireSpec = simpleSpec defaultPerformAction render
, pageLoader
{ path: initialPageParams nodeId
, annuaireInfo
, props: {}
}
]
...
...
@@ -108,6 +112,7 @@ initialPageParams nodeId = {nodeId, params: T.initialParams}
type PageLoaderProps =
{ path :: PageParams
, annuaireInfo :: AnnuaireInfo
, props :: {}
}
renderPage :: forall props path.
...
...
@@ -137,7 +142,7 @@ renderPage dispatch {annuaireInfo}
where
rows = (\c -> {row: renderContactCells c, delete: false}) <$> res
pageLoaderClass :: ReactClass { path :: PageParams, annuaireInfo :: AnnuaireInfo, children :: Children }
pageLoaderClass :: ReactClass { path :: PageParams, annuaireInfo :: AnnuaireInfo, children :: Children
, props :: {}
}
pageLoaderClass = Loader.createLoaderClass' "AnnuairePageLoader" loadPage renderPage
pageLoader :: PageLoaderProps -> ReactElement
...
...
@@ -210,8 +215,8 @@ getAnnuaireInfo :: Int -> Aff AnnuaireInfo
getAnnuaireInfo id = get $ toUrl Back Node (Just id)
------------------------------------------------------------------------------
annuaireLoaderClass :: ReactClass (Loader.Props Int AnnuaireInfo)
annuaireLoaderClass :: ReactClass (Loader.Props Int AnnuaireInfo
{}
)
annuaireLoaderClass = Loader.createLoaderClass "AnnuaireLoader" getAnnuaireInfo
annuaireLoader :: Loader.Props' Int AnnuaireInfo -> ReactElement
annuaireLoader :: Loader.Props' Int AnnuaireInfo
{}
-> ReactElement
annuaireLoader props = React.createElement annuaireLoaderClass props []
src/Gargantext/Pages/Corpus.purs
View file @
89c0af1a
...
...
@@ -54,6 +54,7 @@ layout = simpleSpec defaultPerformAction render
render _ {nodeId} _ _ =
[ corpusLoader { path: nodeId
, component: createClass "Layout" layout' initialState
, props: {}
} ]
layout' :: Spec State Props Action
...
...
@@ -84,8 +85,8 @@ corpusHeaderSpec = simpleSpec defaultPerformAction render
getCorpus :: Int -> Aff (NodePoly CorpusInfo)
getCorpus = get <<< toUrl Back Corpus <<< Just
corpusLoaderClass :: ReactClass (Loader.Props Int (NodePoly CorpusInfo))
corpusLoaderClass :: ReactClass (Loader.Props Int (NodePoly CorpusInfo)
{}
)
corpusLoaderClass = createLoaderClass "CorpusLoader" getCorpus
corpusLoader :: Loader.Props' Int (NodePoly CorpusInfo) -> ReactElement
corpusLoader :: Loader.Props' Int (NodePoly CorpusInfo)
{}
-> ReactElement
corpusLoader props = React.createElement corpusLoaderClass props []
src/Gargantext/Pages/Corpus/Tabs/Ngrams/NgramsTable.purs
View file @
89c0af1a
...
...
@@ -57,6 +57,7 @@ type PageParams = {nodeId :: Int, params :: T.Params}
type Props' = { path :: PageParams
, loaded :: Maybe NgramsTable
, dispatch :: Loader.Action PageParams -> Effect Unit
, props :: {}
}
type NgramsTerm = String
...
...
@@ -495,10 +496,10 @@ getTable tab = get <<< toUrl Back (Ngrams tab Nothing)
loadPage :: PageParams -> Aff NgramsTable
loadPage {nodeId} = getTable TabTerms (Just nodeId) -- TODO this ignores params
ngramsLoaderClass :: ReactClass (Loader.Props PageParams NgramsTable)
ngramsLoaderClass :: ReactClass (Loader.Props PageParams NgramsTable
{}
)
ngramsLoaderClass = Loader.createLoaderClass "NgramsLoader" loadPage
ngramsLoader :: Loader.Props' PageParams NgramsTable -> ReactElement
ngramsLoader :: Loader.Props' PageParams NgramsTable
{}
-> ReactElement
ngramsLoader props = React.createElement ngramsLoaderClass props []
ngramsTableSpec :: Spec {} Props Void
...
...
@@ -508,6 +509,7 @@ ngramsTableSpec = simpleSpec defaultPerformAction render
render _ {path: nodeId} _ _ =
-- TODO: ignored mode, ignored loaded: corpusInfo
[ ngramsLoader { path: initialPageParams nodeId
, props: {}
, component: createClass "NgramsTableLayout" ngramsTableSpec' initialState
} ]
...
...
src/Gargantext/Pages/Corpus/Tabs/Specs.purs
View file @
89c0af1a
...
...
@@ -33,7 +33,7 @@ docPageSpec = focus _doclens _docAction DV.layoutDocview
ngramsViewSpec :: {mode :: NV.Mode} -> Spec State Props Action
ngramsViewSpec {mode} =
cmapProps (\{loaded, path, dispatch
} -> {mode,loaded,path, dispatch
})
cmapProps (\{loaded, path, dispatch
,props} -> {mode,loaded,path,dispatch,props
})
(focus _ngramsView _NgramViewA NV.ngramsTableSpec)
authorPageSpec :: Spec State Props Action
...
...
src/Gargantext/Pages/Corpus/Tabs/Types.purs
View file @
89c0af1a
...
...
@@ -49,6 +49,7 @@ type PropsRow =
( path :: Int
, loaded :: Maybe (NodePoly CorpusInfo)
, dispatch :: Loader.Action Int -> Effect Unit
, props :: {}
)
type Props = Record PropsRow
...
...
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