Commit 6f899ba3 authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge remote-tracking branch 'origin/391-dev-table-state' into dev-merge

parents 562e7fe9 30ea6365
...@@ -49,12 +49,11 @@ listsLayoutWithKey :: R2.Component ( key :: String | Props ) ...@@ -49,12 +49,11 @@ listsLayoutWithKey :: R2.Component ( key :: String | Props )
listsLayoutWithKey = R.createElement listsLayoutWithKeyCpt listsLayoutWithKey = R.createElement listsLayoutWithKeyCpt
listsLayoutWithKeyCpt :: R.Component ( key :: String | Props ) listsLayoutWithKeyCpt :: R.Component ( key :: String | Props )
listsLayoutWithKeyCpt = here.component "listsLayoutWithKey" cpt where listsLayoutWithKeyCpt = here.component "listsLayoutWithKey" cpt where
cpt { boxes: boxes@{ reloadMainPage } cpt { boxes
, nodeId , nodeId
, session , session
, sessionUpdate } _ = do , sessionUpdate } _ = do
activeTab <- T.useBox 0 activeTab <- T.useBox 0
_reloadMainPage' <- T.useLive T.unequal reloadMainPage
let path = { nodeId, session } let path = { nodeId, session }
......
...@@ -8,6 +8,7 @@ import Data.Tuple.Nested ((/\)) ...@@ -8,6 +8,7 @@ import Data.Tuple.Nested ((/\))
import Effect.Class (liftEffect) import Effect.Class (liftEffect)
import Gargantext.Components.App.Store (Boxes) import Gargantext.Components.App.Store (Boxes)
import Gargantext.Components.NgramsTable as NT import Gargantext.Components.NgramsTable as NT
import Gargantext.Components.NgramsTable.Core (PageParams)
import Gargantext.Components.NgramsTable.Core as NTC import Gargantext.Components.NgramsTable.Core as NTC
import Gargantext.Components.Nodes.Corpus.Chart.Metrics (metrics) import Gargantext.Components.Nodes.Corpus.Chart.Metrics (metrics)
import Gargantext.Components.Nodes.Corpus.Chart.Pie (pie, bar) import Gargantext.Components.Nodes.Corpus.Chart.Pie (pie, bar)
...@@ -51,9 +52,31 @@ tabsCpt = here.component "tabs" cpt where ...@@ -51,9 +52,31 @@ tabsCpt = here.component "tabs" cpt where
, "Sources" /\ view Sources [] , "Sources" /\ view Sources []
] ]
common = RX.pick props :: Record Props common = RX.pick props :: Record Props
view mode = ngramsView $ Record.merge common { mode } view mode = tab $ Record.merge common { mode }
type NgramsViewProps = ( mode :: Mode | Props ) type TabProps = ( mode :: Mode | Props )
tab :: R2.Component TabProps
tab = R.createElement tabCpt
tabCpt :: R.Component TabProps
tabCpt = here.component "tab" cpt where
cpt props _ = do
path <- T.useBox $ NTC.initialPageParams props.session initialPath.corpusId [initialPath.listId] initialPath.tabType
pure $ ngramsView (Record.merge props { path }) []
where
tabNgramType = modeTabType props.mode
tabType = TabCorpus (TabNgramType tabNgramType)
listId = props.corpusData.defaultListId
corpusId = props.corpusId
initialPath = { corpusId
-- , limit: Just 1000
, listId
, tabType
}
type NgramsViewProps = ( path :: T.Box PageParams | TabProps )
ngramsView :: R2.Component NgramsViewProps ngramsView :: R2.Component NgramsViewProps
ngramsView = R.createElement ngramsViewCpt ngramsView = R.createElement ngramsViewCpt
...@@ -62,12 +85,11 @@ ngramsViewCpt = here.component "ngramsView" cpt where ...@@ -62,12 +85,11 @@ ngramsViewCpt = here.component "ngramsView" cpt where
cpt props@{ boxes cpt props@{ boxes
, cacheState , cacheState
, corpusData: { defaultListId } , corpusData: { defaultListId }
, corpusId
, mode , mode
, session } _ = do , session
, path } _ = do
chartsReload <- T.useBox T2.newReload chartsReload <- T.useBox T2.newReload
path <- T.useBox $ NTC.initialPageParams props.session initialPath.corpusId [initialPath.listId] initialPath.tabType
{ listIds, nodeId, params } <- T.useLive T.unequal path { listIds, nodeId, params } <- T.useLive T.unequal path
pure $ pure $
...@@ -109,12 +131,6 @@ ngramsViewCpt = here.component "ngramsView" cpt where ...@@ -109,12 +131,6 @@ ngramsViewCpt = here.component "ngramsView" cpt where
tabNgramType = modeTabType mode tabNgramType = modeTabType mode
tabType = TabCorpus (TabNgramType tabNgramType) tabType = TabCorpus (TabNgramType tabNgramType)
mNgramsType = mNgramsTypeFromTabType tabType mNgramsType = mNgramsTypeFromTabType tabType
listId = defaultListId
initialPath = { corpusId
-- , limit: Just 1000
, listId
, tabType
}
......
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