[refactor] some more hereComponent refactoring

parent ab6bd6c3
Pipeline #5561 failed with stage
in 0 seconds
......@@ -114,13 +114,13 @@ type RatingSimpleLoaderProps =
ratingSimpleLoader :: R2.Component RatingSimpleLoaderProps
ratingSimpleLoader = R.createElement ratingSimpleLoaderCpt
ratingSimpleLoaderCpt :: R.Component RatingSimpleLoaderProps
ratingSimpleLoaderCpt = here.component "ratingSimpleLoader" cpt where
cpt { docId
ratingSimpleLoaderCpt = R2.hereComponent here "ratingSimpleLoader" hCpt where
hCpt hp { docId
, corpusId
, session
} _ = do
useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[ratingSimpleLoader]"
, herePrefix: hp
, loader: loadDocumentContext session
, path: { docId, corpusId }
, render: \{ nc_category } -> do
......
......@@ -30,9 +30,8 @@ here = R2.here "Gargantext.Components.Corpus.EditionBlock"
editionBlock :: R2.Leaf Props
editionBlock = R2.leaf editionBlockCpt
editionBlockCpt :: R.Component Props
editionBlockCpt = here.component "main" cpt where
cpt { nodeId
} _ = do
editionBlockCpt = R2.hereComponent here "editionBlock" hCpt where
hCpt hp { nodeId } _ = do
-- | States
-- |
session <- useSession
......@@ -42,7 +41,7 @@ editionBlockCpt = here.component "main" cpt where
-- | Computed
-- |
let
errorHandler = logRESTError (R2.herePrefix here "[corpusLayout]")
errorHandler = logRESTError hp
-- | Hooks
-- |
......@@ -94,7 +93,7 @@ type Props_ =
editionBlock_ :: R2.Leaf Props_
editionBlock_ = R2.leaf editionBlockCpt_
editionBlockCpt_ :: R.Component Props_
editionBlockCpt_ = here.component "main_" cpt where
editionBlockCpt_ = here.component "editionBlock_" cpt where
cpt { nodeId
, hyperdata
} _ = do
......
......@@ -36,7 +36,7 @@ import Gargantext.Components.Nodes.Texts.Types as TextsT
import Gargantext.Components.Reload (textsReloadContext)
import Gargantext.Components.Table as TT
import Gargantext.Components.Table.Types as TT
import Gargantext.Config.REST (AffRESTError, logRESTError)
import Gargantext.Config.REST (AffRESTError)
import Gargantext.Config.Utils (handleRESTError)
import Gargantext.Ends (Frontends, url)
import Gargantext.Hooks.Loader (useLoader, useLoaderWithCacheAPI, HashedResponse(..))
......@@ -121,8 +121,8 @@ type Props = (
docView :: R2.Component Props
docView = R.createElement docViewCpt
docViewCpt :: R.Component Props
docViewCpt = here.component "docView" cpt where
cpt { layout: { cacheState
docViewCpt = R2.hereComponent here "docView" hCpt where
hCpt hp { layout: { cacheState
, chart
, chartReload
, frontends
......@@ -155,7 +155,7 @@ docViewCpt = here.component "docView" cpt where
-- @onCreateDocumentEnd <AsyncProgress>
onCreateDocumentEnd <- pure $ \asyncProgress -> do
here.log2 "[DocsTables] NodeDocument task:" asyncProgress
R2.hpLog2 hp "NodeDocument task:" asyncProgress
T.write_ false onDocumentCreationPendingBox
toggleModal unit
......@@ -171,7 +171,7 @@ docViewCpt = here.component "docView" cpt where
eTask <- DFC.create session nodeId fdata
handleRESTError (R2.herePrefix here "[docView]") errors eTask
handleRESTError hp errors eTask
\t -> liftEffect $ launchDocumentCreationProgress
errors
session
......@@ -390,8 +390,8 @@ filterDocsByYear year docs = A.filter filterFunc docs
pageLayout :: R2.Component ( key :: String | PageLayoutProps )
pageLayout = R.createElement pageLayoutCpt
pageLayoutCpt :: R.Component ( key :: String | PageLayoutProps )
pageLayoutCpt = here.component "pageLayout" cpt where
cpt props@{ cacheState
pageLayoutCpt = R2.hereComponent here "pageLayout" hCpt where
hCpt hp props@{ cacheState
, listId
, mCorpusId
, nodeId
......@@ -459,7 +459,7 @@ pageLayoutCpt = here.component "pageLayout" cpt where
, localCategories
, params: paramsS } []
useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[pageLayout]"
, herePrefix: hp
, path: path { params = paramsS' }
, loader
, render }
......
......@@ -26,7 +26,6 @@ import Gargantext.Components.Document.Types (DocPath, Document(..), LoadedData,
import Gargantext.Components.GraphQL.Endpoints (getContextNgrams)
import Gargantext.Components.NgramsTable.AutoSync (useAutoSync)
import Gargantext.Components.Node (NodePoly(..))
import Gargantext.Config.REST (logRESTError)
import Gargantext.Core.NgramsTable.Functions (addNewNgramA, applyNgramsPatches, coreDispatch, findNgramRoot, setTermListA, computeCache)
import Gargantext.Core.NgramsTable.Types (CoreAction(..), NgramsTable(..), NgramsTerm, State, Versioned(..), replace)
import Gargantext.Hooks.FirstEffect (useFirstEffect')
......@@ -66,15 +65,15 @@ options =
layout :: forall r. R2.OptLeaf Options Props r
layout = R2.optLeaf layoutCpt options
layoutCpt :: R.Component Props
layoutCpt = here.component "layout" cpt where
cpt props@{ path: path@{ listIds
layoutCpt = R2.hereComponent here "layout" hCpt where
hCpt hp props@{ path: path@{ listIds
, nodeId }
, session } _ = do
case A.head listIds of
Nothing -> pure $ H.div {} [ H.text "No list supplied!" ]
Just listId ->
useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[layout]"
, herePrefix: hp
, loader: \p -> getContextNgrams session p.contextId p.listId
, path: { contextId: nodeId, listId }
, render: \contextNgrams ->
......
......@@ -343,13 +343,12 @@ type PageProps = ( rowsLoaded :: Rows | PageLayoutProps )
pageLayout :: R2.Component PageLayoutProps
pageLayout = R.createElement pageLayoutCpt
pageLayoutCpt :: R.Component PageLayoutProps
pageLayoutCpt = here.component "pageLayout" cpt
where
cpt { container, deletions, frontends, path, session, totalRecords } _ = do
pageLayoutCpt = R2.hereComponent here "pageLayout" hCpt where
hCpt hp { container, deletions, frontends, path, session, totalRecords } _ = do
path' <- T.useLive T.unequal path
useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[pageLayout]"
, herePrefix: hp
, loader: loadPage
, path: path'
, render: \rowsLoaded -> page { container, deletions, frontends, path, rowsLoaded, session, totalRecords } [] }
......
......@@ -30,7 +30,7 @@ import Gargantext.Components.Forest.Tree.Node.Tools.SubTree.Types (SubTreeOut(..
import Gargantext.Components.GraphQL.Endpoints (getNode, getTreeFirstLevel)
import Gargantext.Components.GraphQL.Node (Node)
import Gargantext.Components.GraphQL.Tree (TreeFirstLevel, TreeNode)
import Gargantext.Config.REST (AffRESTError, logRESTError)
import Gargantext.Config.REST (AffRESTError)
import Gargantext.Config.Utils (handleRESTError)
import Gargantext.Hooks.LinkHandler (useLinkHandler)
import Gargantext.Hooks.Loader (useLoader)
......@@ -57,12 +57,12 @@ data FolderStyle = FolderUp | FolderChild
folderView :: R2.Leaf Props
folderView = R2.leaf folderViewCpt
folderViewCpt :: R.Component Props
folderViewCpt = here.component "folderViewCpt" cpt where
cpt { nodeId, session } _ = do
folderViewCpt = R2.hereComponent here "folderViewCpt" hCpt where
hCpt hp { nodeId, session } _ = do
reload <- T.useBox T2.newReload
reload' <- T.useLive T.unequal reload
useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[folderView]"
, herePrefix: hp
, loader: loadFolders
, path: { nodeId, session, reload: reload'}
, render: \folders -> folderViewMain { folders
......@@ -264,12 +264,12 @@ backButtonCpt = here.component "backButton" cpt where
backButtonSmart :: R2.Component (nodeId :: Int, session :: Session)
backButtonSmart = R.createElement backButtonSmartCpt
backButtonSmartCpt :: R.Component (nodeId :: Int, session :: Session)
backButtonSmartCpt = here.component "backButtonSmart" cpt where
cpt {nodeId, session} _ = do
backButtonSmartCpt = R2.hereComponent here "backButtonSmart" hCpt where
hCpt hp { nodeId, session } _ = do
reload <- T.useBox T2.newReload
reload' <- T.useLive T.unequal reload
useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[backButtonSmart]"
, herePrefix: hp
, loader: loadNode
, path: { nodeId, session, reload: reload' }
, render: \node -> backButtonSmartMain { node, session } []
......
......@@ -37,7 +37,7 @@ import URI.Fragment as Fragment
import Effect (Effect)
import Effect.Console (log)
import Toestand as T
import Gargantext.Config.REST (AffRESTError, logRESTError)
import Gargantext.Config.REST (AffRESTError)
import Gargantext.Utils.Toestand as T2
import Gargantext.Hooks.Loader (useLoader)
......@@ -165,15 +165,15 @@ componentCpt = here.component "breadcrumb" cpt where
breadcrumbView :: R2.Leaf Props
breadcrumbView = R2.leaf breadcrumbViewCpt
breadcrumbViewCpt :: R.Component Props
breadcrumbViewCpt = here.component "breadcrumbViewCpt" cpt where
cpt { nodeId, session } _ = do
breadcrumbViewCpt = R2.hereComponent here "breadcrumbViewCpt" hCpt where
hCpt hp { nodeId, session } _ = do
let session' = session
case session' of
Nothing -> pure $ H.div {} []
Just (session') -> do
useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[breadcrumbView]"
, herePrefix: hp
, loader: loadBreadcrumbData
, path: { nodeId: nodeId
, session: session'
......
......@@ -110,11 +110,11 @@ treeLoader :: R2.Leaf ( key :: String | LoaderProps )
treeLoader = R2.leaf treeLoaderCpt
treeLoaderCpt :: R.Component ( key :: String | LoaderProps )
treeLoaderCpt = here.component "treeLoader" cpt where
treeLoaderCpt = R2.hereComponent here "treeLoader" hCpt where
-- treeLoaderCpt :: R.Memo LoaderProps
-- treeLoaderCpt = R.memo (here.component "treeLoader" cpt) memoCmp where
-- memoCmp ({ root: t1 }) ({ root: t2 }) = t1 == t2
cpt p@{ root, session } _ = do
hCpt hp p@{ root, session } _ = do
-- States
-- app <- T.useLive T.unequal p.reloadRoot
state /\ stateBox <- R2.useBox' Nothing
......@@ -144,7 +144,7 @@ treeLoaderCpt = here.component "treeLoader" cpt where
props = Record.merge common extra where
common = RecordE.pick p :: Record Common
extra = { reloadTree: p.reload, root, session, tree: tree' }
errorHandler = logRESTError (R2.herePrefix here "[treeLoader]")
errorHandler = logRESTError hp
getNodeTree :: Session -> ID -> AffRESTError FTree
getNodeTree session nodeId = get session $ GR.NodeAPI GT.Tree (Just nodeId) ""
......@@ -255,8 +255,8 @@ renderTreeChildrenCpt = here.component "renderTreeChildren" cpt where
childLoader :: R2.Component ChildLoaderProps
childLoader = R.createElement childLoaderCpt
childLoaderCpt :: R.Component ChildLoaderProps
childLoaderCpt = here.component "childLoader" cpt where
cpt p@{ reloadTree
childLoaderCpt = R2.hereComponent here "childLoader" hCpt where
hCpt hp p@{ reloadTree
, render
, root } _ = do
-- States
......@@ -287,7 +287,7 @@ childLoaderCpt = here.component "childLoader" cpt where
}
where
errorHandler = logRESTError (R2.herePrefix here "[childLoader]")
errorHandler = logRESTError hp
fetch _ = getNodeTreeFirstLevel p.session p.id
paint reload tree' = render (Record.merge base extra) where
base = nodeProps { reload = reload }
......
......@@ -30,7 +30,6 @@ import Gargantext.Components.Forest.Tree.Node.Tools.Sync (nodeActionsGraph, node
import Gargantext.Components.GraphExplorer.API as GraphAPI
import Gargantext.Components.Lang (Lang(EN))
import Gargantext.Components.Nodes.Corpus.Types (CorpusData)
import Gargantext.Config.REST (logRESTError)
import Gargantext.Context.Progress (asyncContext, asyncProgress)
import Gargantext.Ends (Frontends, url)
import Gargantext.Hooks.Loader (useLoader, useLoaderEffect)
......@@ -604,12 +603,12 @@ nodeActionsCpt = here.component "nodeActions" cpt where
graphNodeActions :: R2.Leaf NodeActionsCommon
graphNodeActions = R2.leaf graphNodeActionsCpt
graphNodeActionsCpt :: R.Component NodeActionsCommon
graphNodeActionsCpt = here.component "graphNodeActions" cpt where
cpt { id, refresh, session } _ = do
graphNodeActionsCpt = R2.hereComponent here "graphNodeActions" hCpt where
hCpt hp { id, refresh, session } _ = do
-- Hooks
useLoader
{ errorHandler: Nothing
, herePrefix: R2.herePrefix here "[graphNodeActions]"
, herePrefix: hp
, loader: graphVersions session
, path: id
, render: \gv -> graphNodeActionsLoaded { gv, id, refresh, session }
......@@ -636,12 +635,12 @@ graphNodeActionsLoadedCpt = here.component "graphNodeActionsLoaded" cpt where
listNodeActions :: R2.Leaf NodeActionsCommon
listNodeActions = R2.leaf listNodeActionsCpt
listNodeActionsCpt :: R.Component NodeActionsCommon
listNodeActionsCpt = here.component "listNodeActions" cpt where
cpt { id, refresh, session } _ = do
listNodeActionsCpt = R2.hereComponent here "listNodeActions" hCpt where
hCpt hp { id, refresh, session } _ = do
-- Hooks
useLoader
{ errorHandler: Nothing
, herePrefix: R2.herePrefix here "[listNodeActions]"
, herePrefix: hp
, loader: loadCorpusWithChild
, path: { nodeId: id, session }
, render: \corpusData -> listNodeActionsLoaded { corpusData, id, refresh, session }
......
......@@ -31,10 +31,10 @@ type ActionManageTeam = (
actionManageTeam :: R2.Component ActionManageTeam
actionManageTeam = R.createElement actionManageTeamCpt
actionManageTeamCpt :: R.Component ActionManageTeam
actionManageTeamCpt = here.component "actionManageTeam" cpt where
cpt { id, session } _ = do
actionManageTeamCpt = R2.hereComponent here "actionManageTeam" hCpt where
hCpt hp { id, session } _ = do
useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[actionManageTeam]"
, herePrefix: hp
, loader: loadTeam
, path: { nodeId: id, session }
, render: \team -> teamLayoutWrapper { team
......
......@@ -37,11 +37,11 @@ type Props =
actionSearch :: R2.Component Props
actionSearch = R.createElement actionSearchCpt
actionSearchCpt :: R.Component Props
actionSearchCpt = here.component "actionSearch" cpt where
cpt props@({ session }) _ = do
actionSearchCpt = R2.hereComponent here "actionSearch" hCpt where
hCpt hp props@({ session }) _ = do
{ errors } <- Store.use
useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[actionSearch]"
, herePrefix: hp
, loader: loadLanguages
, path: { session }
, render: \langs ->
......
......@@ -128,10 +128,10 @@ type ComponentIMTProps =
componentIMT :: R2.Component ComponentIMTProps
componentIMT = R.createElement componentIMTCpt
componentIMTCpt :: R.Component ComponentIMTProps
componentIMTCpt = here.component "componentIMT" cpt where
cpt { search, session } _ = do
componentIMTCpt = R2.hereComponent here "componentIMT" hCpt where
hCpt hp { search, session } _ = do
useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[componentIMT]"
, herePrefix: hp
, loader: \_ -> getIMTSchools session
, path: unit
, render: \schools -> componentWithIMTOrgs { schools, search } [] }
......@@ -392,10 +392,10 @@ type PubmedInputProps = (
pubmedInput :: R2.Component PubmedInputProps
pubmedInput = R.createElement pubmedInputCpt
pubmedInputCpt :: R.Component PubmedInputProps
pubmedInputCpt = here.component "pubmedInput" cpt where
cpt { search, session: session@(Session { treeId }) } _ = do
pubmedInputCpt = R2.hereComponent here "pubmedInput" hCpt where
hCpt hp { search, session: session@(Session { treeId }) } _ = do
useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[pubmedInput]"
, herePrefix: hp
, loader: \_ -> getUser session treeId
, path: unit
, render: \user -> pubmedInputLoaded { pubmedAPIKey: user.u_hyperdata.pubmed_api_key
......@@ -444,10 +444,10 @@ type EPOInputProps = (
epoInput :: R2.Component EPOInputProps
epoInput = R.createElement epoInputCpt
epoInputCpt :: R.Component EPOInputProps
epoInputCpt = here.component "epoInput" cpt where
cpt { search, session: session@(Session { treeId }) } _ = do
epoInputCpt = R2.hereComponent here "epoInput" hCpt where
hCpt hp { search, session: session@(Session { treeId }) } _ = do
useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[epoInput]"
, herePrefix: hp
, loader: \_ -> getUser session treeId
, path: unit
, render: \user -> epoInputLoaded { epoAPIUser: user.u_hyperdata.epo_api_user
......
......@@ -65,11 +65,10 @@ type ShareNode =
shareNode :: R2.Component ShareNode
shareNode = R.createElement shareNodeCpt
shareNodeCpt :: R.Component ShareNode
shareNodeCpt = here.component "shareNode" cpt
where
cpt { id, session } _ = do
shareNodeCpt = R2.hereComponent here "shareNode" hCpt where
hCpt hp { id, session } _ = do
useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[shareNode]"
, herePrefix: hp
, loader: getCompletionsReq
, path: { session }
, render: \completions -> shareNodeInner { completions, id, session } []
......
......@@ -106,10 +106,10 @@ type UploadFile =
uploadFileView :: R2.Leaf Props
uploadFileView = R2.leaf uploadFileViewCpt
uploadFileViewCpt :: R.Component Props
uploadFileViewCpt = here.component "uploadFileView" cpt where
cpt props@({ session }) _ = do
uploadFileViewCpt = R2.hereComponent here "uploadFileView" hCpt where
hCpt hp props@({ session }) _ = do
useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[uploadFileView]"
, herePrefix: hp
, loader: loadLanguages
, path: { session }
, render: \langs ->
......@@ -731,10 +731,10 @@ uploadTermButtonCpt = here.component "uploadTermButton" cpt
uploadFrameCalcView :: R2.Component Props
uploadFrameCalcView = R.createElement uploadFrameCalcViewCpt
uploadFrameCalcViewCpt :: R.Component Props
uploadFrameCalcViewCpt = here.component "uploadFrameCalcView" cpt where
cpt props@({ session }) _ = do
uploadFrameCalcViewCpt = R2.hereComponent here "uploadFrameCalcView" hCpt where
hCpt hp props@({ session }) _ = do
useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[uploadFrameCalcView]"
, herePrefix: hp
, loader: loadLanguages
, path: { session }
, render: \langs ->
......
......@@ -39,11 +39,11 @@ type ActionWriteNodesDocuments =
actionWriteNodesDocuments :: R2.Component ActionWriteNodesDocuments
actionWriteNodesDocuments = R.createElement actionWriteNodesDocumentsCpt
actionWriteNodesDocumentsCpt :: R.Component ActionWriteNodesDocuments
actionWriteNodesDocumentsCpt = here.component "actionWriteNodesDocuments" cpt where
cpt props@({ session }) _ = do
actionWriteNodesDocumentsCpt = R2.hereComponent here "actionWriteNodesDocuments" hCpt where
hCpt hp props@({ session }) _ = do
{ errors } <- Store.use
useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[actionWriteNodesDocuments]"
, herePrefix: hp
, loader: loadLanguages
, path: { session }
, render: \langs ->
......
......@@ -39,9 +39,8 @@ type Props = (
asyncProgressBar :: R2.Component Props
asyncProgressBar = R.createElement asyncProgressBarCpt
asyncProgressBarCpt :: R.Component Props
asyncProgressBarCpt = here.component "asyncProgressBar" cpt
where
cpt props@{ asyncTask: (GT.AsyncTaskWithType {task: GT.AsyncTask {id}})
asyncProgressBarCpt = R2.hereComponent here "asyncProgressBar" hCpt where
hCpt hp props@{ asyncTask: (GT.AsyncTaskWithType {task: GT.AsyncTask {id}})
, barType
, onFinish
} _ = do
......@@ -55,7 +54,7 @@ asyncProgressBarCpt = here.component "asyncProgressBar" cpt
launchAff_ $ do
let rdata = (RX.pick props :: Record QueryProgressData)
eAsyncProgress <- queryProgress rdata
handleRESTError (R2.herePrefix here "[asyncProgressBar]") errors eAsyncProgress $
handleRESTError hp errors eAsyncProgress $
\asyncProgress -> liftEffect $ do
let GT.AsyncProgress { status } = asyncProgress
T.write_ (min 100.0 $ GT.progressPercent asyncProgress) progress
......
......@@ -41,9 +41,8 @@ type SubTreeParamsProps =
subTreeView :: R2.Component SubTreeParamsProps
subTreeView = R.createElement $ R.memo' subTreeViewCpt
subTreeViewCpt :: R.Component SubTreeParamsProps
subTreeViewCpt = here.component "subTreeView" cpt
where
cpt { action
subTreeViewCpt = R2.hereComponent here "subTreeView" hCpt where
hCpt hp { action
, dispatch
, id
, nodeType
......@@ -56,7 +55,7 @@ subTreeViewCpt = here.component "subTreeView" cpt
-- _ <- pure $ setAction (const $ setTreeOut valAction Nothing)
useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[subTreeView]"
, herePrefix: hp
, loader: loadSubTree showtypes
, path: session
, render: \tree ->
......
......@@ -17,10 +17,10 @@ type ForgotPasswordProps = ( server :: String, uuid :: String )
forgotPasswordLayout :: R2.Component ForgotPasswordProps
forgotPasswordLayout = R.createElement forgotPasswordLayoutCpt
forgotPasswordLayoutCpt :: R.Component ForgotPasswordProps
forgotPasswordLayoutCpt = here.component "forgotPasswordLayout" cpt where
cpt { server, uuid } _ = do
forgotPasswordLayoutCpt = R2.hereComponent here "forgotPasswordLayout" hCpt where
hCpt hp { server, uuid } _ = do
useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[forgotPasswordLayout]"
, herePrefix: hp
, loader: loadPassword
, path: { server, uuid }
, render: \{ password } ->
......
......@@ -36,8 +36,8 @@ type Props =
docFocus :: R2.Leaf ( key :: String | Props )
docFocus = R2.leaf docFocusCpt
docFocusCpt :: R.Component ( key :: String | Props )
docFocusCpt = here.component "main" cpt where
cpt { graphSideDoc: GraphSideDoc { docId, listId, corpusId }
docFocusCpt = R2.hereComponent here "main" hCpt where
hCpt hp { graphSideDoc: GraphSideDoc { docId, listId, corpusId }
, session
, closeCallback
} _ = do
......@@ -64,7 +64,7 @@ docFocusCpt = here.component "main" cpt where
-- | Hooks
-- |
useLoaderEffect
{ errorHandler: logRESTError (R2.herePrefix here "[docFocus]")
{ errorHandler: logRESTError hp
, loader: loadData
, path
, state
......
......@@ -20,7 +20,7 @@ import Gargantext.Components.GraphQL.Team (Team, teamQuery)
import Gargantext.Components.GraphQL.Tree (TreeFirstLevel, treeFirstLevelQuery, BreadcrumbInfo, breadcrumbQuery)
import Gargantext.Components.GraphQL.User (UserInfo, userInfoQuery, User, userQuery)
import Gargantext.Components.Lang (Lang)
import Gargantext.Config.REST (RESTError(..), AffRESTError, logRESTError)
import Gargantext.Config.REST (RESTError(..), AffRESTError)
import Gargantext.Core.NgramsTable.Types (NgramsTerm(..))
import Gargantext.Sessions (Session(..))
import Gargantext.Types (CorpusId, NodeType)
......
......@@ -114,8 +114,7 @@ type LangSwitcherProps = (
langSwitcher :: R2.Component LangSwitcherProps
langSwitcher = R.createElement langSwitcherCpt
langSwitcherCpt :: R.Component LangSwitcherProps
langSwitcherCpt = here.component "langSwitcher" cpt
where
langSwitcherCpt = here.component "langSwitcher" cpt where
cpt { lang, langs} _ = do
currentLang <- T.useLive T.unequal lang
let option l = H.option { value: show l} [ H.text $ show l]
......
......@@ -117,10 +117,10 @@ type ListTreeChildrenProps =
listTreeChildren :: R2.Component ListTreeChildrenProps
listTreeChildren = R.createElement listTreeChildrenCpt
listTreeChildrenCpt :: R.Component ListTreeChildrenProps
listTreeChildrenCpt = here.component "listTreeChildren" cpt where
cpt { render, root, selection, session } _ = do
listTreeChildrenCpt = R2.hereComponent here "listTreeChildren" hCpt where
hCpt hp { render, root, selection, session } _ = do
useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[listTreeChildren]"
, herePrefix: hp
, loader: loadTreeChildren
, path: { root, session }
, render: \loaded ->
......
......@@ -17,10 +17,8 @@ type Props =
loadingSpinner :: Record Props -> R.Element
loadingSpinner props = R.createElement loadingSpinnerCpt props []
loadingSpinnerCpt :: R.Component Props
loadingSpinnerCpt = here.component "LoadingSpinner" cpt
where
loadingSpinnerCpt = here.component "LoadingSpinner" cpt where
-- cpt _ _ = H.i {className: "spinner fa fa-smile-o fa-spin fa-3x fa-fw"} [H.text ""]
-- cpt _ _ = H.i {className: "fa fa-globe fa-spin fa-3x fa-fw"} [H.text ""]
......
......@@ -23,11 +23,9 @@ type Props = ( setVisible :: R.Setter Boolean )
modal :: R2.Component Props
modal = R.createElement modalCpt
modalCpt :: R.Component Props
modalCpt = here.component "modal" cpt
where
cpt {setVisible} children = do
modalCpt = R2.hereComponent here "modal" hCpt where
hCpt _hp {setVisible} children = do
host <- R2.getPortalHost
root <- R.useRef null -- used to close when user clicks outside
R2.useLayoutEffectOnce $ modalEffect root setVisible
......
......@@ -1021,8 +1021,8 @@ type MainNgramsTableCacheProps =
mainNgramsTableCacheOn :: R2.Leaf MainNgramsTableCacheProps
mainNgramsTableCacheOn = R2.leaf mainNgramsTableCacheOnCpt
mainNgramsTableCacheOnCpt :: R.Component MainNgramsTableCacheProps
mainNgramsTableCacheOnCpt = here.component "mainNgramsTableCacheOn" cpt where
cpt { afterSync
mainNgramsTableCacheOnCpt = R2.hereComponent here "mainNgramsTableCacheOn" hCpt where
hCpt hp { afterSync
, defaultListId
, path
, session
......@@ -1052,8 +1052,9 @@ mainNgramsTableCacheOnCpt = here.component "mainNgramsTableCacheOn" cpt where
, renderer: render
, spinnerClass: Nothing
}
where
errorHandler = logRESTError hp
versionEndpoint { defaultListId, path: { nodeId, tabType, session } } _ = get session $ Routes.GetNgramsTableVersion { listId: defaultListId, tabType } (Just nodeId)
errorHandler = logRESTError (R2.herePrefix here "[mainNgramsTableCacheOn]")
mkRequest :: PageParams -> GUC.Request
mkRequest path@{ session } = GUC.makeGetRequest session $ url path
where
......@@ -1068,8 +1069,8 @@ mainNgramsTableCacheOnCpt = here.component "mainNgramsTableCacheOn" cpt where
mainNgramsTableCacheOff :: R2.Leaf MainNgramsTableCacheProps
mainNgramsTableCacheOff = R2.leaf mainNgramsTableCacheOffCpt
mainNgramsTableCacheOffCpt :: R.Component MainNgramsTableCacheProps
mainNgramsTableCacheOffCpt = here.component "mainNgramsTableCacheOff" cpt where
cpt { afterSync
mainNgramsTableCacheOffCpt = R2.hereComponent here "mainNgramsTableCacheOff" hCpt where
hCpt hp { afterSync
, path
, session
, state
......@@ -1086,7 +1087,7 @@ mainNgramsTableCacheOffCpt = here.component "mainNgramsTableCacheOff" cpt where
, versionedWithCount
, withAutoUpdate } []
useLoaderBox { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[mainNgramsTableCacheOff]"
, herePrefix: hp
, loader
, path
, render }
......
......@@ -70,13 +70,13 @@ type KeyLayoutProps =
annuaireLayoutWithKey :: R2.Leaf KeyLayoutProps
annuaireLayoutWithKey = R2.leaf annuaireLayoutWithKeyCpt
annuaireLayoutWithKeyCpt :: R.Component KeyLayoutProps
annuaireLayoutWithKeyCpt = here.component "annuaireLayoutWithKey" cpt where
cpt { frontends, nodeId, session } _ = do
annuaireLayoutWithKeyCpt = R2.hereComponent here "annuaireLayoutWithKey" hCpt where
hCpt hp { frontends, nodeId, session } _ = do
path <- T.useBox nodeId
path' <- T.useLive T.unequal path
useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[annuaireLayoutWithKey]"
, herePrefix: hp
, loader: getAnnuaireInfo session
, path: path'
, render: \info -> annuaire { frontends, info, path, session } }
......@@ -135,13 +135,12 @@ type PageLayoutProps =
pageLayout :: Record PageLayoutProps -> R.Element
pageLayout props = R.createElement pageLayoutCpt props []
pageLayoutCpt :: R.Component PageLayoutProps
pageLayoutCpt = here.component "pageLayout" cpt
where
cpt { frontends, pagePath, session } _ = do
pageLayoutCpt = R2.hereComponent here "pageLayout" hCpt where
hCpt hp { frontends, pagePath, session } _ = do
pagePath' <- T.useLive T.unequal pagePath
useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[pageLayout]"
, herePrefix: hp
, loader: loadPage session
, path: pagePath'
, render: \table -> page { session, table, frontends, pagePath } }
......
......@@ -21,7 +21,7 @@ import Gargantext.Components.InputWithEnter (inputWithEnter)
import Gargantext.Components.Nodes.Annuaire.Tabs as Tabs
import Gargantext.Components.Nodes.Annuaire.User.Contacts.Types (Contact(..), ContactData, ContactTouch(..), ContactWhere(..), ContactWho(..), HyperdataContact(..), HyperdataUser(..), _city, _country, _firstName, _labTeamDeptsJoinComma, _lastName, _mail, _office, _organizationJoinComma, _ouFirst, _phone, _role, _shared, _touch, _who, defaultContactTouch, defaultContactWhere, defaultContactWho, defaultHyperdataContact, defaultHyperdataUser)
import Gargantext.Components.Nodes.Lists.Types as LT
import Gargantext.Config.REST (AffRESTError, logRESTError)
import Gargantext.Config.REST (AffRESTError)
import Gargantext.Config.Utils (handleRESTError)
import Gargantext.Ends (Frontends)
import Gargantext.Hooks.Loader (useLoader)
......@@ -92,8 +92,9 @@ userLayoutCpt = here.component "userLayout" cpt
userLayoutWithKey :: R2.Leaf ( key :: String | LayoutProps )
userLayoutWithKey = R2.leaf userLayoutWithKeyCpt
userLayoutWithKeyCpt :: R.Component ( key :: String | LayoutProps )
userLayoutWithKeyCpt = here.component "userLayoutWithKey" cpt where
cpt { frontends
-- userLayoutWithKeyCpt = here.component "userLayoutWithKey" cpt where
userLayoutWithKeyCpt = R2.hereComponent here "userLayoutWithKey" hCpt where
hCpt hp { frontends
, nodeId
, session } _ = do
{ errors, sidePanelLists, sidePanelTexts } <- AppStore.use
......@@ -105,7 +106,7 @@ userLayoutWithKeyCpt = here.component "userLayoutWithKey" cpt where
cacheState <- T.useBox LT.CacheOn
useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[userLayoutWithKey]"
, herePrefix: hp
, loader: getUserInfoWithReload
, path: { nodeId: userId, reload: reload', session }
, render: \userInfo@{ ui_username } ->
......@@ -132,7 +133,7 @@ userLayoutWithKeyCpt = here.component "userLayoutWithKey" cpt where
launchAff_ $ do
let Session {userId} = session
res <- saveUserInfo session userId ui
handleRESTError (R2.herePrefix here "[userLayoutWithKey]") errors res $ \_ ->
handleRESTError hp errors res $ \_ ->
liftEffect $ T2.reload reload
--saveContactHyperdata :: Session -> Int -> HyperdataUser -> AffRESTError Int
......@@ -161,11 +162,11 @@ type PubmedSettingsProps =
pubmedSettings :: R2.Leaf PubmedSettingsProps
pubmedSettings = R2.leaf pubmedSettingsCpt
pubmedSettingsCpt :: R.Component PubmedSettingsProps
pubmedSettingsCpt = here.component "pubmedSettings" cpt where
cpt { nodeId
pubmedSettingsCpt = R2.hereComponent here "pubmedSettings" hCpt where
hCpt hp { nodeId
, session } _ = do
useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[pubmedSettings]"
, herePrefix: hp
, loader: \_ -> getUser session nodeId
, path: unit
, render: \user -> pubmedSettingsLoaded { nodeId
......@@ -207,11 +208,11 @@ type EPOSettingsProps =
epoSettings :: R2.Leaf EPOSettingsProps
epoSettings = R2.leaf epoSettingsCpt
epoSettingsCpt :: R.Component EPOSettingsProps
epoSettingsCpt = here.component "epoSettings" cpt where
cpt { nodeId
epoSettingsCpt = R2.hereComponent here "epoSettings" hCpt where
hCpt hp { nodeId
, session } _ = do
useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[epoSettings]"
, herePrefix: hp
, loader: \_ -> getUser session nodeId
, path: unit
, render: \user -> epoSettingsLoaded { nodeId
......@@ -258,8 +259,8 @@ type EditableUserField =
editableUserField :: R2.Leaf EditableUserField
editableUserField = R2.leaf editableUserFieldCpt
editableUserFieldCpt :: R.Component EditableUserField
editableUserFieldCpt = here.component "editableUserField" cpt where
cpt { callback
editableUserFieldCpt = R2.hereComponent here "editableUserField" hCpt where
hCpt hp { callback
, description
, mValue } _ = do
{ errors } <- AppStore.use
......@@ -278,14 +279,12 @@ editableUserFieldCpt = here.component "editableUserField" cpt where
where
onUpdate errors s = do
here.log2 ("[editableUserField] " <> description) s
case s of
"" -> pure unit
_ -> do
launchAff_ $ do
res <- callback s
handleRESTError (R2.herePrefix here "[editableUserField]") errors res $ \_result ->
liftEffect $ here.log ("[editableUserField] " <> description <> " updated")
handleRESTError hp errors res (const $ pure unit)
------------------------------------------------------------
......
......@@ -31,10 +31,9 @@ type Props =
contactLayout :: R2.Leaf ( key :: String | Props )
contactLayout = R2.leaf contactLayoutCpt
contactLayoutCpt :: R.Component ( key :: String | Props )
contactLayoutCpt = here.component "layout" cpt where
contactLayoutCpt = R2.hereComponent here "layout" hCpt where
-- Component
cpt { nodeId
} _ = do
hCpt hp { nodeId } _ = do
session <- useSession
......@@ -42,7 +41,7 @@ contactLayoutCpt = here.component "layout" cpt where
useLoader
{ errorHandler: Nothing
, herePrefix: R2.herePrefix here "[contactLayout]"
, herePrefix: hp
, loader: getAnnuaireContact session
, path: nodeId
, render:
......
......@@ -33,9 +33,8 @@ cacheName = "metrics"
metricsLoadView :: forall a. Eq a => Record (MetricsLoadViewProps a) -> R.Element
metricsLoadView p = R.createElement metricsLoadViewCpt p []
metricsLoadViewCpt :: forall a. Eq a => R.Component (MetricsLoadViewProps a)
metricsLoadViewCpt = here.component "metricsLoadView" cpt
where
cpt { getMetrics
metricsLoadViewCpt = R2.hereComponent here "metricsLoadView" hCpt where
hCpt hp { getMetrics
, loaded
, onClick
, onInit
......@@ -46,7 +45,7 @@ metricsLoadViewCpt = here.component "metricsLoadView" cpt
reload' <- T.useLive T.unequal reload
useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[metricsLoadView]"
, herePrefix: hp
, loader: getMetrics session
, path: reload' /\ path
, render: \l -> loaded { path, reload, session, onClick, onInit } l }
......
......@@ -47,12 +47,12 @@ type ViewProps =
corpusCodeLayout :: R2.Leaf Props
corpusCodeLayout = R2.leaf corpusCodeLayoutCpt
corpusCodeLayoutCpt :: R.Component Props
corpusCodeLayoutCpt = here.component "corpusCodeLayout" cpt where
cpt { nodeId, session, boxes } _ = do
corpusCodeLayoutCpt = R2.hereComponent here "corpusCodeLayout" hCpt where
hCpt hp { nodeId, session, boxes } _ = do
reload <- T.useBox T2.newReload
reload' <- T.useLive T.unequal reload
useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[corpusCodeLayout]"
, herePrefix: hp
, loader: loadCorpusWithReload
, path: { nodeId, reload: reload', session }
, render: \corpus -> corpusCodeView { corpus, nodeId, reload, session, boxes } }
......
......@@ -47,14 +47,13 @@ type KeyProps =
dashboardLayoutWithKey :: R2.Component KeyProps
dashboardLayoutWithKey = R.createElement dashboardLayoutWithKeyCpt
dashboardLayoutWithKeyCpt :: R.Component KeyProps
dashboardLayoutWithKeyCpt = here.component "dashboardLayoutWithKey" cpt
where
cpt { nodeId, session } _ = do
dashboardLayoutWithKeyCpt = R2.hereComponent here "dashboardLayoutWithKey" hCpt where
hCpt hp { nodeId, session } _ = do
reload <- T.useBox T2.newReload
reload' <- T.useLive T.unequal reload
useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[dashboardLayoutWithKey]"
, herePrefix: hp
, loader: DT.loadDashboardWithReload
, path: { nodeId, reload: reload', session }
, render: \(DT.DashboardData { hyperdata: DT.Hyperdata h, parentId }) -> do
......@@ -76,7 +75,7 @@ dashboardLayoutWithKeyCpt = here.component "dashboardLayoutWithKey" cpt
, session }
liftEffect $ do
_ <- case res of
Left err -> here.warn2 "[dashboardLayoutWithKey] onChange RESTError" err
Left err -> R2.hpWarn2 hp "onChange RESTError" err
_ -> pure unit
T2.reload reload
......
......@@ -32,8 +32,8 @@ here = R2.here "Gargantext.Components.Nodes.Corpus.Document"
node :: R2.Leaf ( key :: String | Props )
node = R2.leaf nodeCpt
nodeCpt :: R.Component ( key :: String | Props )
nodeCpt = here.component "node" cpt where
cpt { listId
nodeCpt = R2.hereComponent here "node" hCpt where
hCpt hp { listId
, mCorpusId
, nodeId
} _ = do
......@@ -55,7 +55,7 @@ nodeCpt = here.component "node" cpt where
-- | Hooks
-- |
useLoaderEffect
{ errorHandler: logRESTError (R2.herePrefix here "[documentLayoutWithKey]")
{ errorHandler: logRESTError hp
, loader: loadData
, path
, state
......
......@@ -34,8 +34,8 @@ node :: R2.Leaf MainProps
node = R2.leaf nodeCpt
nodeCpt :: R.Component MainProps
nodeCpt = here.component "node" cpt where
cpt { nodeId } _ = do
nodeCpt = R2.hereComponent here "node" hCpt where
hCpt hp { nodeId } _ = do
-- | States
-- |
session <- useSession
......@@ -45,7 +45,7 @@ nodeCpt = here.component "node" cpt where
-- | Computed
-- |
let errorHandler = logRESTError (R2.herePrefix here "[phylo]")
let errorHandler = logRESTError hp
-- | Hooks
-- |
......
......@@ -50,10 +50,10 @@ type FileLayoutProps = ( nodeId :: NodeID, session :: Session )
fileLayout :: R2.Leaf FileLayoutProps
fileLayout = R2.leaf fileLayoutCpt
fileLayoutCpt :: R.Component FileLayoutProps
fileLayoutCpt = here.component "fileLayout" cpt where
cpt { nodeId, session } _ = do
fileLayoutCpt = R2.hereComponent here "fileLayout" hCpt where
hCpt hp { nodeId, session } _ = do
useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[fileLayout]"
, herePrefix: hp
, loader: loadFile session
, path: nodeId
, render: onLoad }
......
......@@ -32,8 +32,8 @@ node :: R2.Leaf ( key :: String | Props )
node = R2.leaf nodeCpt
nodeCpt :: R.Component ( key :: String | Props )
nodeCpt = here.component "node" cpt where
cpt { nodeId
nodeCpt = R2.hereComponent here "node" hCpt where
hCpt hp { nodeId
, nodeType
} _ = do
-- | States
......@@ -46,7 +46,7 @@ nodeCpt = here.component "node" cpt where
-- | Hooks
-- |
useLoaderEffect
{ errorHandler: logRESTError (R2.herePrefix here "[frameLayout]")
{ errorHandler: logRESTError hp
, loader: loadframeWithReload
, path:
{ nodeId
......
......@@ -41,8 +41,8 @@ here = R2.here "Gargantext.Components.Nodes.Graph"
node :: R2.Leaf ( key :: String | Props )
node = R2.leaf nodeCpt
nodeCpt :: R.Component ( key :: String | Props )
nodeCpt = here.component "node" cpt where
cpt { graphId } _ = do
nodeCpt = R2.hereComponent here "node" hCpt where
hCpt hp { graphId } _ = do
-- | States
-- |
{ graphVersion
......@@ -56,7 +56,7 @@ nodeCpt = here.component "node" cpt where
-- | Computed
-- |
let errorHandler = logRESTError (R2.herePrefix here "[node]")
let errorHandler = logRESTError hp
-- | Hooks
-- |
......
......@@ -7,7 +7,7 @@ import Data.Maybe (Maybe(..))
import Data.Show.Generic (genericShow)
import Data.String (take)
import Gargantext.Config (publicBackend)
import Gargantext.Config.REST (AffRESTError, get, logRESTError)
import Gargantext.Config.REST (AffRESTError, get)
import Gargantext.Ends (backendUrl)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Utils.Reactix as R2
......@@ -68,10 +68,10 @@ loadPublicData _l = do
renderPublic :: R2.Leaf ()
renderPublic = R2.leaf renderPublicCpt
renderPublicCpt :: R.Component ()
renderPublicCpt = here.component "renderPublic" cpt where
cpt _ _ = do
renderPublicCpt = R2.hereComponent here "renderPublic" hCpt where
hCpt hp _ _ = do
useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[renderPublic]"
, herePrefix: hp
, loader: loadPublicData
, path: { reload: 0 }
, render: loaded }
......
......@@ -58,8 +58,8 @@ listsLayoutCpt = here.component "listsLayout" cpt where
listsLayoutWithKey :: R2.Component ( key :: String | Props )
listsLayoutWithKey = R.createElement listsLayoutWithKeyCpt
listsLayoutWithKeyCpt :: R.Component ( key :: String | Props )
listsLayoutWithKeyCpt = here.component "listsLayoutWithKey" cpt where
cpt { boxes
listsLayoutWithKeyCpt = R2.hereComponent here "listsLayoutWithKey" hCpt where
hCpt hp { boxes
, nodeId
, session
, sessionUpdate
......@@ -75,7 +75,7 @@ listsLayoutWithKeyCpt = here.component "listsLayoutWithKey" cpt where
T.listen (\{ new } -> afterCacheStateChange new) cacheState
useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[listsLayoutWithKey]"
, herePrefix: hp
, path
, loader: loadCorpusWithChild
, render: \corpusData@{ corpusId, corpusNode: NodePoly poly } ->
......@@ -191,19 +191,19 @@ type NgramsDocListProps =
ngramsDocList :: R2.Component NgramsDocListProps
ngramsDocList = R.createElement ngramsDocListCpt
ngramsDocListCpt :: R.Component NgramsDocListProps
ngramsDocListCpt = here.component "ngramsDocList" cpt where
cpt { mCorpusId: Nothing } _ = do
ngramsDocListCpt = R2.hereComponent here "ngramsDocList" hCpt where
hCpt hp { mCorpusId: Nothing } _ = do
pure $ H.div {} []
cpt { mListId: Nothing } _ = do
hCpt hp { mListId: Nothing } _ = do
pure $ H.div {} []
cpt { mNgrams: Nothing } _ = do
hCpt hp { mNgrams: Nothing } _ = do
pure $ H.div {} []
cpt { mCorpusId: Just corpusId
hCpt hp { mCorpusId: Just corpusId
, mListId: Just listId
, mNgrams: Just ngrams
, session } _ = do
useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[ngramsDocList]"
, herePrefix: hp
, path: { corpusId, ngrams, session }
, loader: loaderNgramsDocList
, render: \ctx -> ngramsDocListLoaded { contexts: ctx
......
......@@ -29,7 +29,6 @@ import Gargantext.Components.Nodes.Texts.Types as TextsT
import Gargantext.Components.Reload (textsReloadContext)
import Gargantext.Components.Tab as Tab
import Gargantext.Components.Table as Table
import Gargantext.Config.REST (logRESTError)
import Gargantext.Ends (Frontends)
import Gargantext.Hooks.Loader (useLoader, useLoaderEffect)
import Gargantext.Hooks.Session (useSession)
......@@ -75,8 +74,8 @@ textsLayoutCpt = here.component "textsLayout" cpt where
textsLayoutWithKey :: R2.Leaf ( key :: String | Props )
textsLayoutWithKey = R2.leaf textsLayoutWithKeyCpt
textsLayoutWithKeyCpt :: R.Component ( key :: String | Props )
textsLayoutWithKeyCpt = here.component "textsLayoutWithKey" cpt where
cpt { frontends
textsLayoutWithKeyCpt = R2.hereComponent here "textsLayoutWithKey" hCpt where
hCpt hp { frontends
, nodeId
} _ = do
session <- useSession
......@@ -92,7 +91,7 @@ textsLayoutWithKeyCpt = here.component "textsLayoutWithKey" cpt where
T.listen (\{ new } -> afterCacheStateChange new) cacheState
useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[textsLayoutWithKey]"
, herePrefix: hp
, loader: loadCorpusWithChild
, path: { nodeId, session }
, render: \corpusData@{ corpusId, corpusNode } ->
......@@ -508,8 +507,8 @@ type SideText =
sideText :: R2.Leaf ( key :: String | SideText )
sideText = R2.leaf sideTextCpt
sideTextCpt :: R.Component ( key :: String | SideText )
sideTextCpt = here.component "sideText" cpt where
cpt { sidePanelText: { corpusId, listId, nodeId }
sideTextCpt = R2.hereComponent here "sideText" hCpt where
hCpt hp { sidePanelText: { corpusId, listId, nodeId }
, session
} _ = do
-- | States
......@@ -547,7 +546,7 @@ sideTextCpt = here.component "sideText" cpt where
-- }
useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[sideText]"
, herePrefix: hp
, loader: \{ path } -> loadData path
, path: { path }
, render: \loaded -> loadedSideText { loaded
......
......@@ -36,8 +36,8 @@ type Props =
docFocus :: R2.Leaf ( key :: String | Props )
docFocus = R2.leaf docFocusCpt
docFocusCpt :: R.Component ( key :: String | Props )
docFocusCpt = here.component "main" cpt where
cpt { frameDoc: FrameDoc { docId, listId, corpusId }
docFocusCpt = R2.hereComponent here "main" hCpt where
hCpt hp { frameDoc: FrameDoc { docId, listId, corpusId }
, session
, closeCallback
} _ = do
......@@ -64,7 +64,7 @@ docFocusCpt = here.component "main" cpt where
-- | Hooks
-- |
useLoaderEffect
{ errorHandler: logRESTError (R2.herePrefix here "[docFocus]")
{ errorHandler: logRESTError hp
, loader: loadData
, path
, state
......
......@@ -63,8 +63,7 @@ data RangeUpdate = SetMin Number | SetMax Number
rangeSlider :: Record Props -> R.Element
rangeSlider props = R.createElement rangeSliderCpt props []
rangeSliderCpt :: R.Component Props
rangeSliderCpt = here.component "rangeSlider" cpt
where
rangeSliderCpt = here.component "rangeSlider" cpt where
cpt props _ = do
-- rounding precision (i.e. how many decimal digits are in epsilon)
let (Range.Closed { min: minR, max: maxR }) = props.initialValue
......
......@@ -37,7 +37,7 @@ import Gargantext.Components.Tile (tileBlock)
import Gargantext.Components.TopBar as TopBar
import Gargantext.Components.TreeSearch (treeSearch)
import Gargantext.Config (defaultFrontends, defaultBackends)
import Gargantext.Config.REST (AffRESTError, logRESTError)
import Gargantext.Config.REST (AffRESTError)
import Gargantext.Context.Session as SessionContext
import Gargantext.Ends (Backend)
import Gargantext.Hooks.Resize (ResizeType(..), useResizeHandler)
......
......@@ -62,9 +62,9 @@ tab :: R2.Component TabProps
tab = R.createElement tabCpt
-- | A tab only shows its contents if it is currently selected
tabCpt :: R.Component TabProps
tabCpt = here.component "tab" cpt
where
cpt { selected, index } children = pure $ H.div { className } children'
tabCpt = here.component "tab" cpt where
cpt { selected, index } children = do
pure $ H.div { className } children'
where
same = selected == index
className = "tab-pane" <> (if same then "show active" else "fade")
......
......@@ -75,10 +75,8 @@ type ThemeSwitcherProps = (
themeSwitcher :: R2.Component ThemeSwitcherProps
themeSwitcher = R.createElement themeSwitcherCpt
themeSwitcherCpt :: R.Component ThemeSwitcherProps
themeSwitcherCpt = here.component "themeSwitcher" cpt
where
themeSwitcherCpt = here.component "themeSwitcher" cpt where
cpt { theme, themes } _ = do
currentTheme <- T.useLive T.unequal theme
......
......@@ -9,7 +9,7 @@ import Gargantext.Components.Bootstrap (formSelect')
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (ButtonVariant(..), ModalSizing(..), Position(..), TooltipPosition(..), Variant(..))
import Gargantext.Components.InputWithEnter (inputWithEnter)
import Gargantext.Config.REST (AffRESTError, logRESTError)
import Gargantext.Config.REST (AffRESTError)
import Gargantext.Hooks.LinkHandler (useLinkHandler)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Routes (AppRoute(..), appPath, nodeTypeAppRoute)
......@@ -142,11 +142,11 @@ treeSearchContainer :: R2.Leaf ContainerProps
treeSearchContainer = R2.leaf treeSearchContainerCpt
treeSearchContainerCpt :: R.Component ContainerProps
treeSearchContainerCpt = here.component "treeSearchContainerCpt" cpt where
cpt {query, visible, session } _ = do
treeSearchContainerCpt = R2.hereComponent here "treeSearchContainerCpt" hCpt where
hCpt hp {query, visible, session } _ = do
useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[treeSearchContainer]"
, herePrefix: hp
, path: { session, query }
, loader: loadSearch
, render: \searchData -> treeSearchRenderContainer { visible, session, searchData }
......
......@@ -38,9 +38,8 @@ here = R2.here "Gargantext.Context.Progress"
asyncProgress :: R2.Component AsyncProps
asyncProgress = R2.component asyncProgressCpt
asyncProgressCpt :: R.Component AsyncProps
asyncProgressCpt = R.hooksComponent "asyncProgress" cpt where
cpt props@{ onFinish
} children = do
asyncProgressCpt = R2.hereComponent here "asyncProgress" hCpt where
hCpt hp props@{ onFinish } children = do
{ errors } <- AppStore.use
-- States
......@@ -63,7 +62,7 @@ asyncProgressCpt = R.hooksComponent "asyncProgress" cpt where
Right _ -> T.write_ 1000 interval
interval' <- T.read interval
resetInterval intervalIdRef (Just interval') exec
handleRESTError (R2.herePrefix here "[asyncProgress]") errors eAsyncProgress onProgress
handleRESTError hp errors eAsyncProgress onProgress
onProgress :: AsyncProgress -> Aff Unit
onProgress value = liftEffect do
......
......@@ -115,9 +115,21 @@ type Prefix = String
newtype HerePrefix = HerePrefix { here :: Here
, prefix :: Prefix }
hpLog2 :: forall a b. HerePrefix -> a -> b -> Effect Unit
hpLog2 (HerePrefix { here: h, prefix }) = h.log3 prefix
hpWarn2 :: forall a b. HerePrefix -> a -> b -> Effect Unit
hpWarn2 (HerePrefix { here: h, prefix }) = h.warn3 prefix
herePrefix :: Here -> Prefix -> HerePrefix
herePrefix here prefix = HerePrefix { here, prefix }
hereComponent :: forall p. Here -> Prefix -> (HerePrefix -> R.HooksComponent p) -> R.Component p
hereComponent here' prefix hpComponent = here'.component prefix (hpComponent hp)
where
hp :: HerePrefix
hp = herePrefix here' prefix
-- newtypes
type NTHooksComponent props = props -> Array R.Element -> R.Hooks R.Element
newtype NTComponent p = NTComponent (EffectFn1 p R.Element)
......
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