[ngrams] a stub for a sidebar for ngrams contexts

parent 55589ac8
...@@ -19,6 +19,7 @@ import Data.Map as Map ...@@ -19,6 +19,7 @@ import Data.Map as Map
import Gargantext.AsyncTasks as GAT import Gargantext.AsyncTasks as GAT
import Gargantext.Components.Lang as Lang import Gargantext.Components.Lang as Lang
import Gargantext.Components.Login.Types (TreeId) import Gargantext.Components.Login.Types (TreeId)
import Gargantext.Components.Nodes.Lists.SidePanel as ListsSP
import Gargantext.Components.Nodes.Lists.Types as ListsT import Gargantext.Components.Nodes.Lists.Types as ListsT
import Gargantext.Components.Nodes.Texts.Types as TextsT import Gargantext.Components.Nodes.Texts.Types as TextsT
import Gargantext.Components.Themes as Themes import Gargantext.Components.Themes as Themes
...@@ -55,7 +56,7 @@ type Store = ...@@ -55,7 +56,7 @@ type Store =
, showCorpus :: T.Box Boolean , showCorpus :: T.Box Boolean
, showLogin :: T.Box Boolean , showLogin :: T.Box Boolean
, showTree :: T.Box Boolean , showTree :: T.Box Boolean
, sidePanelLists :: T.Box (Maybe (Record ListsT.SidePanel)) , sidePanelLists :: T.Box (Maybe (Record ListsSP.SidePanel))
, sidePanelTexts :: T.Box (Maybe (Record TextsT.SidePanel)) , sidePanelTexts :: T.Box (Maybe (Record TextsT.SidePanel))
, sidePanelState :: T.Box SidePanelState , sidePanelState :: T.Box SidePanelState
, tasks :: T.Box GAT.Storage , tasks :: T.Box GAT.Storage
...@@ -82,7 +83,7 @@ type State = ...@@ -82,7 +83,7 @@ type State =
, showCorpus :: Boolean , showCorpus :: Boolean
, showLogin :: Boolean , showLogin :: Boolean
, showTree :: Boolean , showTree :: Boolean
, sidePanelLists :: Maybe (Record ListsT.SidePanel) , sidePanelLists :: Maybe (Record ListsSP.SidePanel)
, sidePanelTexts :: Maybe (Record TextsT.SidePanel) , sidePanelTexts :: Maybe (Record TextsT.SidePanel)
, sidePanelState :: SidePanelState , sidePanelState :: SidePanelState
, tasks :: GAT.Storage , tasks :: GAT.Storage
...@@ -110,7 +111,7 @@ options = ...@@ -110,7 +111,7 @@ options =
, showCorpus : false , showCorpus : false
, showLogin : false , showLogin : false
, showTree : true , showTree : true
, sidePanelLists : ListsT.initialSidePanel , sidePanelLists : ListsSP.initialSidePanel
, sidePanelTexts : TextsT.initialSidePanel , sidePanelTexts : TextsT.initialSidePanel
, sidePanelState : InitialClosed , sidePanelState : InitialClosed
, tasks : GAT.empty , tasks : GAT.empty
......
...@@ -41,6 +41,7 @@ import Gargantext.Components.NgramsTable.Search as NTS ...@@ -41,6 +41,7 @@ import Gargantext.Components.NgramsTable.Search as NTS
import Gargantext.Components.NgramsTable.SelectionCheckbox as NTSC import Gargantext.Components.NgramsTable.SelectionCheckbox as NTSC
import Gargantext.Components.NgramsTable.SyncResetButton (syncResetButtons) import Gargantext.Components.NgramsTable.SyncResetButton (syncResetButtons)
import Gargantext.Components.NgramsTable.Tree (renderNgramsItem, renderNgramsTree) import Gargantext.Components.NgramsTable.Tree (renderNgramsItem, renderNgramsTree)
import Gargantext.Components.Nodes.Lists.SidePanel (SidePanel)
import Gargantext.Components.Nodes.Lists.Types as NT import Gargantext.Components.Nodes.Lists.Types as NT
import Gargantext.Components.Table (changePage) import Gargantext.Components.Table (changePage)
import Gargantext.Components.Table as TT import Gargantext.Components.Table as TT
...@@ -415,6 +416,8 @@ type PropsNoReload = ...@@ -415,6 +416,8 @@ type PropsNoReload =
( cacheState :: NT.CacheState ( cacheState :: NT.CacheState
, mTotalRows :: Maybe Int , mTotalRows :: Maybe Int
, path :: T.Box PageParams , path :: T.Box PageParams
, session :: Session
, sidePanel :: T.Box (Maybe (Record SidePanel))
, state :: T.Box State , state :: T.Box State
, treeEdit :: Record NgramsTreeEditProps , treeEdit :: Record NgramsTreeEditProps
, versioned :: VersionedNgramsTable , versioned :: VersionedNgramsTable
...@@ -486,11 +489,13 @@ loadedNgramsTableBody = R.createElement loadedNgramsTableBodyCpt ...@@ -486,11 +489,13 @@ loadedNgramsTableBody = R.createElement loadedNgramsTableBodyCpt
loadedNgramsTableBodyCpt :: R.Component PropsNoReload loadedNgramsTableBodyCpt :: R.Component PropsNoReload
loadedNgramsTableBodyCpt = here.component "loadedNgramsTableBody" cpt where loadedNgramsTableBodyCpt = here.component "loadedNgramsTableBody" cpt where
cpt { afterSync cpt { afterSync
, boxes: { errors , boxes: boxes@{ errors
, tasks } , tasks }
, cacheState , cacheState
, mTotalRows , mTotalRows
, path , path
, session
, sidePanel
, state , state
, tabNgramType , tabNgramType
, treeEdit: treeEdit@{ getNgramsChildrenAff, getNgramsChildren } , treeEdit: treeEdit@{ getNgramsChildrenAff, getNgramsChildren }
...@@ -557,7 +562,8 @@ loadedNgramsTableBodyCpt = here.component "loadedNgramsTableBody" cpt where ...@@ -557,7 +562,8 @@ loadedNgramsTableBodyCpt = here.component "loadedNgramsTableBody" cpt where
filteredConvertedRows = convertRow <$> filteredRows filteredConvertedRows = convertRow <$> filteredRows
convertRow ngramsElement = convertRow ngramsElement =
{ row: renderNgramsItem { dispatch: performAction { row: renderNgramsItem { boxes
, dispatch: performAction
, getNgramsChildrenAff , getNgramsChildrenAff
, getNgramsChildren , getNgramsChildren
, isEditing , isEditing
...@@ -565,7 +571,9 @@ loadedNgramsTableBodyCpt = here.component "loadedNgramsTableBody" cpt where ...@@ -565,7 +571,9 @@ loadedNgramsTableBodyCpt = here.component "loadedNgramsTableBody" cpt where
, ngramsElement , ngramsElement
, ngramsLocalPatch , ngramsLocalPatch
, ngramsSelection , ngramsSelection
, ngramsTable } [] , ngramsTable
, session
, sidePanel } []
, delete: false , delete: false
} }
...@@ -649,7 +657,7 @@ loadedNgramsTableBodyCpt = here.component "loadedNgramsTableBody" cpt where ...@@ -649,7 +657,7 @@ loadedNgramsTableBodyCpt = here.component "loadedNgramsTableBody" cpt where
scoreType scoreType
} }
where where
colNames = TT.ColumnName <$> [ "Select", "Score", "Terms"] -- see convOrderBy colNames = TT.ColumnName <$> [ "Show", "Select", "Score", "Terms"] -- see convOrderBy
ngramsTableOrderWith :: Maybe (TT.OrderByDirection TT.ColumnName) ngramsTableOrderWith :: Maybe (TT.OrderByDirection TT.ColumnName)
-> Seq.Seq NgramsElement -> Seq.Seq NgramsElement
...@@ -777,6 +785,7 @@ type MainNgramsTableProps = ( ...@@ -777,6 +785,7 @@ type MainNgramsTableProps = (
-- ^ This node can be a corpus or contact. -- ^ This node can be a corpus or contact.
, path :: T.Box PageParams , path :: T.Box PageParams
, session :: Session , session :: Session
, sidePanel :: T.Box (Maybe (Record SidePanel))
, tabType :: TabType , tabType :: TabType
, treeEdit :: Record NgramsTreeEditProps , treeEdit :: Record NgramsTreeEditProps
| CommonProps | CommonProps
...@@ -1014,6 +1023,8 @@ mainNgramsTableCacheOnCpt = here.component "mainNgramsTableCacheOn" cpt where ...@@ -1014,6 +1023,8 @@ mainNgramsTableCacheOnCpt = here.component "mainNgramsTableCacheOn" cpt where
, boxes , boxes
, defaultListId , defaultListId
, path , path
, session
, sidePanel
, state , state
, tabNgramType , tabNgramType
, treeEdit , treeEdit
...@@ -1026,6 +1037,8 @@ mainNgramsTableCacheOnCpt = here.component "mainNgramsTableCacheOn" cpt where ...@@ -1026,6 +1037,8 @@ mainNgramsTableCacheOnCpt = here.component "mainNgramsTableCacheOn" cpt where
, boxes , boxes
, cacheState: NT.CacheOn , cacheState: NT.CacheOn
, path , path
, session
, sidePanel
, state , state
, tabNgramType , tabNgramType
, treeEdit , treeEdit
...@@ -1060,6 +1073,8 @@ mainNgramsTableCacheOffCpt = here.component "mainNgramsTableCacheOff" cpt where ...@@ -1060,6 +1073,8 @@ mainNgramsTableCacheOffCpt = here.component "mainNgramsTableCacheOff" cpt where
cpt { afterSync cpt { afterSync
, boxes , boxes
, path , path
, session
, sidePanel
, state , state
, tabNgramType , tabNgramType
, treeEdit , treeEdit
...@@ -1068,6 +1083,8 @@ mainNgramsTableCacheOffCpt = here.component "mainNgramsTableCacheOff" cpt where ...@@ -1068,6 +1083,8 @@ mainNgramsTableCacheOffCpt = here.component "mainNgramsTableCacheOff" cpt where
, boxes , boxes
, cacheState: NT.CacheOff , cacheState: NT.CacheOff
, path , path
, session
, sidePanel
, state , state
, tabNgramType , tabNgramType
, treeEdit , treeEdit
...@@ -1106,6 +1123,8 @@ mainNgramsTableCacheOffCpt = here.component "mainNgramsTableCacheOff" cpt where ...@@ -1106,6 +1123,8 @@ mainNgramsTableCacheOffCpt = here.component "mainNgramsTableCacheOff" cpt where
type MainNgramsTablePaintProps = ( type MainNgramsTablePaintProps = (
cacheState :: NT.CacheState cacheState :: NT.CacheState
, path :: T.Box PageParams , path :: T.Box PageParams
, session :: Session
, sidePanel :: T.Box (Maybe (Record SidePanel))
, state :: T.Box State , state :: T.Box State
, treeEdit :: Record NgramsTreeEditProps , treeEdit :: Record NgramsTreeEditProps
, versioned :: VersionedNgramsTable , versioned :: VersionedNgramsTable
...@@ -1121,6 +1140,8 @@ mainNgramsTablePaintCpt = here.component "mainNgramsTablePaint" cpt ...@@ -1121,6 +1140,8 @@ mainNgramsTablePaintCpt = here.component "mainNgramsTablePaint" cpt
, boxes , boxes
, cacheState , cacheState
, path , path
, session
, sidePanel
, state , state
, tabNgramType , tabNgramType
, treeEdit , treeEdit
...@@ -1137,6 +1158,8 @@ mainNgramsTablePaintCpt = here.component "mainNgramsTablePaint" cpt ...@@ -1137,6 +1158,8 @@ mainNgramsTablePaintCpt = here.component "mainNgramsTablePaint" cpt
, cacheState , cacheState
, mTotalRows: Nothing , mTotalRows: Nothing
, path , path
, session
, sidePanel
, state , state
, tabNgramType , tabNgramType
, treeEdit , treeEdit
...@@ -1147,6 +1170,8 @@ mainNgramsTablePaintCpt = here.component "mainNgramsTablePaint" cpt ...@@ -1147,6 +1170,8 @@ mainNgramsTablePaintCpt = here.component "mainNgramsTablePaint" cpt
type MainNgramsTablePaintNoCacheProps = ( type MainNgramsTablePaintNoCacheProps = (
cacheState :: NT.CacheState cacheState :: NT.CacheState
, path :: T.Box PageParams , path :: T.Box PageParams
, session :: Session
, sidePanel :: T.Box (Maybe (Record SidePanel))
, state :: T.Box State , state :: T.Box State
, treeEdit :: Record NgramsTreeEditProps , treeEdit :: Record NgramsTreeEditProps
, versionedWithCount :: VersionedWithCountNgramsTable , versionedWithCount :: VersionedWithCountNgramsTable
...@@ -1162,6 +1187,8 @@ mainNgramsTablePaintNoCacheCpt = here.component "mainNgramsTablePaintNoCache" cp ...@@ -1162,6 +1187,8 @@ mainNgramsTablePaintNoCacheCpt = here.component "mainNgramsTablePaintNoCache" cp
, boxes , boxes
, cacheState , cacheState
, path , path
, session
, sidePanel
, state , state
, tabNgramType , tabNgramType
, treeEdit , treeEdit
...@@ -1181,6 +1208,8 @@ mainNgramsTablePaintNoCacheCpt = here.component "mainNgramsTablePaintNoCache" cp ...@@ -1181,6 +1208,8 @@ mainNgramsTablePaintNoCacheCpt = here.component "mainNgramsTablePaintNoCache" cp
, cacheState , cacheState
, mTotalRows: Just count , mTotalRows: Just count
, path , path
, session
, sidePanel
, state , state
, tabNgramType , tabNgramType
, treeEdit , treeEdit
......
...@@ -15,12 +15,15 @@ import Data.Tuple.Nested ((/\)) ...@@ -15,12 +15,15 @@ import Data.Tuple.Nested ((/\))
import Effect (Effect) import Effect (Effect)
import Effect.Aff (Aff, launchAff_) import Effect.Aff (Aff, launchAff_)
import Effect.Class (liftEffect) import Effect.Class (liftEffect)
import Gargantext.Components.App.Store (Boxes)
import Gargantext.Components.Bootstrap as B import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (Variant(..)) import Gargantext.Components.Bootstrap.Types (Variant(..))
import Gargantext.Components.Nodes.Lists.SidePanel (SidePanel)
import Gargantext.Components.Table as Tbl import Gargantext.Components.Table as Tbl
import Gargantext.Core.NgramsTable.Functions (applyNgramsPatches, setTermListA, tablePatchHasNgrams) import Gargantext.Core.NgramsTable.Functions (applyNgramsPatches, setTermListA, tablePatchHasNgrams)
import Gargantext.Core.NgramsTable.Types (Action(..), NgramsClick, NgramsDepth, NgramsElement, NgramsTable, NgramsTablePatch, NgramsTerm, _NgramsElement, _NgramsRepoElement, _children, _list, _ngrams, _occurrences, ngramsTermText, replace) import Gargantext.Core.NgramsTable.Types (Action(..), NgramsClick, NgramsDepth, NgramsElement, NgramsTable, NgramsTablePatch, NgramsTerm, _NgramsElement, _NgramsRepoElement, _children, _list, _ngrams, _occurrences, ngramsTermText, replace)
import Gargantext.Hooks.FirstEffect (useFirstEffect') import Gargantext.Hooks.FirstEffect (useFirstEffect')
import Gargantext.Sessions (Session)
import Gargantext.Types as GT import Gargantext.Types as GT
import Gargantext.Utils ((?)) import Gargantext.Utils ((?))
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
...@@ -224,7 +227,8 @@ treeLoadedCpt = here.component "treeLoaded" cpt where ...@@ -224,7 +227,8 @@ treeLoadedCpt = here.component "treeLoaded" cpt where
H.ul {} <<< map (\ngrams -> tree ((Record.delete (Proxy :: Proxy "ngramsChildren") params) { ngramsDepth = {depth, ngrams} })) <<< L.toUnfoldable H.ul {} <<< map (\ngrams -> tree ((Record.delete (Proxy :: Proxy "ngramsChildren") params) { ngramsDepth = {depth, ngrams} })) <<< L.toUnfoldable
type RenderNgramsItem = type RenderNgramsItem =
( dispatch :: Action -> Effect Unit ( boxes :: Boxes
, dispatch :: Action -> Effect Unit
, getNgramsChildrenAff :: Maybe (NgramsTerm -> Aff (Array NgramsTerm)) , getNgramsChildrenAff :: Maybe (NgramsTerm -> Aff (Array NgramsTerm))
, getNgramsChildren :: Maybe (NgramsTerm -> Array NgramsTerm) , getNgramsChildren :: Maybe (NgramsTerm -> Array NgramsTerm)
, isEditing :: T.Box Boolean , isEditing :: T.Box Boolean
...@@ -233,6 +237,8 @@ type RenderNgramsItem = ...@@ -233,6 +237,8 @@ type RenderNgramsItem =
, ngramsLocalPatch :: NgramsTablePatch , ngramsLocalPatch :: NgramsTablePatch
, ngramsSelection :: Set NgramsTerm , ngramsSelection :: Set NgramsTerm
, ngramsTable :: NgramsTable , ngramsTable :: NgramsTable
, session :: Session
, sidePanel :: T.Box (Maybe (Record SidePanel))
) )
renderNgramsItem :: R2.Component RenderNgramsItem renderNgramsItem :: R2.Component RenderNgramsItem
...@@ -240,7 +246,8 @@ renderNgramsItem = R.createElement renderNgramsItemCpt ...@@ -240,7 +246,8 @@ renderNgramsItem = R.createElement renderNgramsItemCpt
renderNgramsItemCpt :: R.Component RenderNgramsItem renderNgramsItemCpt :: R.Component RenderNgramsItem
renderNgramsItemCpt = here.component "renderNgramsItem" cpt renderNgramsItemCpt = here.component "renderNgramsItem" cpt
where where
cpt { dispatch cpt { boxes
, dispatch
--, getNgramsChildren --, getNgramsChildren
, isEditing , isEditing
, ngrams , ngrams
...@@ -248,11 +255,27 @@ renderNgramsItemCpt = here.component "renderNgramsItem" cpt ...@@ -248,11 +255,27 @@ renderNgramsItemCpt = here.component "renderNgramsItem" cpt
, ngramsLocalPatch , ngramsLocalPatch
, ngramsSelection , ngramsSelection
, ngramsTable , ngramsTable
, session
, sidePanel
} _ = do } _ = do
isEditing' <- T.useLive T.unequal isEditing isEditing' <- T.useLive T.unequal isEditing
pure $ Tbl.makeRow mCurrentNgrams <-
T.useFocused
(maybe Nothing _.mCurrentNgrams)
(\val -> maybe Nothing (\sp -> Just $ sp { mCurrentNgrams = val })) sidePanel
mCurrentNgrams' <- T.useLive T.unequal mCurrentNgrams
let currentRowSelected = mCurrentNgrams' == Just ngrams
className = currentRowSelected ? "page-paint-raw page-paint-raw--selected" $ ""
pure $ Tbl.makeRow' { className }
[ [
ngramsContext { boxes
, ngrams
, session
, sidePanel } []
,
selected selected
, ,
B.wad' B.wad'
...@@ -385,3 +408,50 @@ nextTermList :: GT.TermList -> GT.TermList ...@@ -385,3 +408,50 @@ nextTermList :: GT.TermList -> GT.TermList
nextTermList GT.MapTerm = GT.StopTerm nextTermList GT.MapTerm = GT.StopTerm
nextTermList GT.StopTerm = GT.CandidateTerm nextTermList GT.StopTerm = GT.CandidateTerm
nextTermList GT.CandidateTerm = GT.MapTerm nextTermList GT.CandidateTerm = GT.MapTerm
type NgramsContextProps =
( boxes :: Boxes
, ngrams :: NgramsTerm
, session :: Session
, sidePanel :: T.Box (Maybe (Record SidePanel)))
ngramsContext :: R2.Component NgramsContextProps
ngramsContext = R.createElement ngramsContextCpt
ngramsContextCpt :: R.Component NgramsContextProps
ngramsContextCpt = here.component "ngramsContext" cpt where
cpt { ngrams
, boxes: { sidePanelState }
, session
, sidePanel } _ = do
mCurrentNgrams <-
T.useFocused
(maybe Nothing _.mCurrentNgrams)
(\val -> maybe Nothing (\sp -> Just $ sp { mCurrentNgrams = val })) sidePanel
mCurrentNgrams' <- T.useLive T.unequal mCurrentNgrams
let selected = mCurrentNgrams' == Just ngrams
eyeClass = selected ? "eye" $ "eye-slash"
variant = selected ? Info $ Dark
onClick selected _ = do
-- here.log2 "[docChooser] onClick, listId" listId
-- here.log2 "[docChooser] onClick, corpusId" corpusId
-- here.log2 "[docChooser] onClick, nodeId" nodeId
-- R2.callTrigger triggerAnnotatedDocIdChange { corpusId, listId, nodeId }
-- T2.reload tableReload
if selected then do
T.write_ Nothing sidePanel
T.write_ GT.Closed sidePanelState
else do
T.write_ (Just { mCurrentNgrams: Just ngrams }) sidePanel
T.write_ GT.Opened sidePanelState
pure $ H.div { className: "doc-chooser"}
[ B.iconButton
{ name: eyeClass
, overlay: false
, variant
, callback: onClick selected }
]
...@@ -13,6 +13,7 @@ import Gargantext.Components.DocsTable as DT ...@@ -13,6 +13,7 @@ import Gargantext.Components.DocsTable as DT
import Gargantext.Components.DocsTable.Types (Year) import Gargantext.Components.DocsTable.Types (Year)
import Gargantext.Components.NgramsTable as NT import Gargantext.Components.NgramsTable as NT
import Gargantext.Core.NgramsTable.Functions as NTC import Gargantext.Core.NgramsTable.Functions as NTC
import Gargantext.Components.Nodes.Lists.SidePanel as LSidePanel
import Gargantext.Components.Nodes.Lists.Types as LTypes import Gargantext.Components.Nodes.Lists.Types as LTypes
import Gargantext.Components.Nodes.Texts.Types as TextsT import Gargantext.Components.Nodes.Texts.Types as TextsT
import Gargantext.Components.Tab as Tab import Gargantext.Components.Tab as Tab
...@@ -57,6 +58,7 @@ type TabsProps = ...@@ -57,6 +58,7 @@ type TabsProps =
, nodeId :: Int , nodeId :: Int
, session :: Session , session :: Session
, sidePanel :: T.Box (Maybe (Record TextsT.SidePanel)) , sidePanel :: T.Box (Maybe (Record TextsT.SidePanel))
, sidePanelList :: T.Box (Maybe (Record LSidePanel.SidePanel))
) )
tabs :: R2.Leaf TabsProps tabs :: R2.Leaf TabsProps
...@@ -81,7 +83,15 @@ tabsCpt = here.component "tabs" cpt where ...@@ -81,7 +83,15 @@ tabsCpt = here.component "tabs" cpt where
, "Communication" /\ ngramsView (viewProps Communication) , "Communication" /\ ngramsView (viewProps Communication)
, "Trash" /\ docs -- TODO pass-in trash mode , "Trash" /\ docs -- TODO pass-in trash mode
] where ] where
viewProps mode = Record.merge props { mode } viewProps mode = { boxes : props.boxes
, cacheState : props.cacheState
, defaultListId : props.defaultListId
, frontends : props.frontends
, mode
, nodeId : props.nodeId
, session : props.session
, sidePanel : props.sidePanel
, sidePanelList : props.sidePanelList }
totalRecords = 4736 -- TODO lol totalRecords = 4736 -- TODO lol
docs = DT.docViewLayout (Record.merge { boxes, chartReload, sidePanel } $ Record.merge dtCommon dtExtra) docs = DT.docViewLayout (Record.merge { boxes, chartReload, sidePanel } $ Record.merge dtCommon dtExtra)
dtCommon = RX.pick props :: Record DTCommon dtCommon = RX.pick props :: Record DTCommon
...@@ -102,7 +112,6 @@ type DTCommon = ...@@ -102,7 +112,6 @@ type DTCommon =
, frontends :: Frontends , frontends :: Frontends
, nodeId :: Int , nodeId :: Int
, session :: Session , session :: Session
-- , sidePanel :: T.Box (Record SidePanel)
) )
type NgramsViewTabsProps = type NgramsViewTabsProps =
...@@ -113,7 +122,11 @@ ngramsView :: R2.Leaf NgramsViewTabsProps ...@@ -113,7 +122,11 @@ ngramsView :: R2.Leaf NgramsViewTabsProps
ngramsView = R2.leaf ngramsViewCpt ngramsView = R2.leaf ngramsViewCpt
ngramsViewCpt :: R.Component NgramsViewTabsProps ngramsViewCpt :: R.Component NgramsViewTabsProps
ngramsViewCpt = here.component "ngramsView" cpt where ngramsViewCpt = here.component "ngramsView" cpt where
cpt props@{ defaultListId, mode, nodeId, session } _ = do cpt props@{ defaultListId
, mode
, nodeId
, session
, sidePanelList } _ = do
path <- T.useBox $ path <- T.useBox $
NTC.initialPageParams session nodeId NTC.initialPageParams session nodeId
[ defaultListId ] (TabDocument TabDocs) [ defaultListId ] (TabDocument TabDocs)
...@@ -128,6 +141,7 @@ ngramsViewCpt = here.component "ngramsView" cpt where ...@@ -128,6 +141,7 @@ ngramsViewCpt = here.component "ngramsView" cpt where
(Record.merge most (Record.merge most
{ afterSync { afterSync
, path , path
, sidePanel: sidePanelList
, tabType: TabPairing (TabNgramType $ modeTabType mode) , tabType: TabPairing (TabNgramType $ modeTabType mode)
, tabNgramType: modeTabType' mode , tabNgramType: modeTabType' mode
, treeEdit: { box: treeEditBox , treeEdit: { box: treeEditBox
......
...@@ -94,7 +94,8 @@ userLayoutWithKey :: R2.Leaf ( key :: String | LayoutProps ) ...@@ -94,7 +94,8 @@ userLayoutWithKey :: R2.Leaf ( key :: String | LayoutProps )
userLayoutWithKey = R2.leaf userLayoutWithKeyCpt userLayoutWithKey = R2.leaf userLayoutWithKeyCpt
userLayoutWithKeyCpt :: R.Component ( key :: String | LayoutProps ) userLayoutWithKeyCpt :: R.Component ( key :: String | LayoutProps )
userLayoutWithKeyCpt = here.component "userLayoutWithKey" cpt where userLayoutWithKeyCpt = here.component "userLayoutWithKey" cpt where
cpt { boxes: boxes@{ sidePanelTexts } cpt { boxes: boxes@{ sidePanelLists
, sidePanelTexts }
, frontends , frontends
, nodeId , nodeId
, session } _ = do , session } _ = do
...@@ -120,6 +121,7 @@ userLayoutWithKeyCpt = here.component "userLayoutWithKey" cpt where ...@@ -120,6 +121,7 @@ userLayoutWithKeyCpt = here.component "userLayoutWithKey" cpt where
, nodeId , nodeId
, session , session
, sidePanel: sidePanelTexts , sidePanel: sidePanelTexts
, sidePanelList: sidePanelLists
} }
] ]
} }
......
...@@ -12,6 +12,7 @@ import Gargantext.Components.DocsTable as DT ...@@ -12,6 +12,7 @@ import Gargantext.Components.DocsTable as DT
import Gargantext.Components.DocsTable.Types (Year) import Gargantext.Components.DocsTable.Types (Year)
import Gargantext.Components.NgramsTable as NT import Gargantext.Components.NgramsTable as NT
import Gargantext.Core.NgramsTable.Functions as NTC import Gargantext.Core.NgramsTable.Functions as NTC
import Gargantext.Components.Nodes.Lists.SidePanel as LSidePanel
import Gargantext.Components.Nodes.Lists.Types as LTypes import Gargantext.Components.Nodes.Lists.Types as LTypes
import Gargantext.Components.Nodes.Texts.Types as TTypes import Gargantext.Components.Nodes.Texts.Types as TTypes
import Gargantext.Components.Tab as Tab import Gargantext.Components.Tab as Tab
...@@ -55,6 +56,7 @@ type TabsProps = ...@@ -55,6 +56,7 @@ type TabsProps =
, nodeId :: Int , nodeId :: Int
, session :: Session , session :: Session
, sidePanel :: T.Box (Maybe (Record TTypes.SidePanel)) , sidePanel :: T.Box (Maybe (Record TTypes.SidePanel))
, sidePanelList :: T.Box (Maybe (Record LSidePanel.SidePanel))
) )
tabs :: R2.Leaf TabsProps tabs :: R2.Leaf TabsProps
...@@ -69,6 +71,7 @@ tabsCpt = here.component "tabs" cpt ...@@ -69,6 +71,7 @@ tabsCpt = here.component "tabs" cpt
, nodeId , nodeId
, session , session
, sidePanel , sidePanel
, sidePanelList
} _ = do } _ = do
activeTab <- T.useBox 0 activeTab <- T.useBox 0
yearFilter <- T.useBox (Nothing :: Maybe Year) yearFilter <- T.useBox (Nothing :: Maybe Year)
...@@ -90,6 +93,7 @@ tabsCpt = here.component "tabs" cpt ...@@ -90,6 +93,7 @@ tabsCpt = here.component "tabs" cpt
, mode: Patents , mode: Patents
, nodeId , nodeId
, session , session
, sidePanel: sidePanelList
} }
booksView = { boxes booksView = { boxes
, cacheState , cacheState
...@@ -97,6 +101,7 @@ tabsCpt = here.component "tabs" cpt ...@@ -97,6 +101,7 @@ tabsCpt = here.component "tabs" cpt
, mode: Books , mode: Books
, nodeId , nodeId
, session , session
, sidePanel: sidePanelList
} }
commView = { boxes commView = { boxes
, cacheState , cacheState
...@@ -104,6 +109,7 @@ tabsCpt = here.component "tabs" cpt ...@@ -104,6 +109,7 @@ tabsCpt = here.component "tabs" cpt
, mode: Communication , mode: Communication
, nodeId , nodeId
, session , session
, sidePanel: sidePanelList
} }
chart = mempty chart = mempty
totalRecords = 4736 -- TODO totalRecords = 4736 -- TODO
...@@ -132,6 +138,7 @@ type NgramsViewTabsProps = ( ...@@ -132,6 +138,7 @@ type NgramsViewTabsProps = (
, mode :: Mode , mode :: Mode
, nodeId :: Int , nodeId :: Int
, session :: Session , session :: Session
, sidePanel :: T.Box (Maybe (Record LSidePanel.SidePanel))
) )
ngramsView :: R2.Component NgramsViewTabsProps ngramsView :: R2.Component NgramsViewTabsProps
...@@ -144,7 +151,8 @@ ngramsViewCpt = here.component "ngramsView" cpt ...@@ -144,7 +151,8 @@ ngramsViewCpt = here.component "ngramsView" cpt
, defaultListId , defaultListId
, mode , mode
, nodeId , nodeId
, session } _ = do , session
, sidePanel } _ = do
path <- T.useBox $ NTC.initialPageParams session nodeId [defaultListId] (TabDocument TabDocs) path <- T.useBox $ NTC.initialPageParams session nodeId [defaultListId] (TabDocument TabDocs)
onCancelRef <- R.useRef Nothing onCancelRef <- R.useRef Nothing
onNgramsClickRef <- R.useRef Nothing onNgramsClickRef <- R.useRef Nothing
...@@ -158,6 +166,7 @@ ngramsViewCpt = here.component "ngramsView" cpt ...@@ -158,6 +166,7 @@ ngramsViewCpt = here.component "ngramsView" cpt
, defaultListId , defaultListId
, path , path
, session , session
, sidePanel
, tabNgramType , tabNgramType
, tabType , tabType
, treeEdit: { box: treeEditBox , treeEdit: { box: treeEditBox
......
...@@ -2,12 +2,15 @@ module Gargantext.Components.Nodes.Lists where ...@@ -2,12 +2,15 @@ module Gargantext.Components.Nodes.Lists where
import Gargantext.Prelude import Gargantext.Prelude
import Data.Maybe (Maybe)
import Effect (Effect) import Effect (Effect)
import Effect.Aff (launchAff_) import Effect.Aff (launchAff_)
import Gargantext.Components.App.Store (Boxes) import Gargantext.Components.App.Store (Boxes)
import Gargantext.Core.NgramsTable.Types (NgramsTerm)
import Gargantext.Components.Corpus.CodeSection (loadCorpusWithChild) import Gargantext.Components.Corpus.CodeSection (loadCorpusWithChild)
import Gargantext.Components.NgramsTable.Loader (clearCache) import Gargantext.Components.NgramsTable.Loader (clearCache)
import Gargantext.Components.Node (NodePoly(..)) import Gargantext.Components.Node (NodePoly(..))
import Gargantext.Components.Nodes.Lists.SidePanel (SidePanel)
import Gargantext.Components.Nodes.Lists.Tabs as Tabs import Gargantext.Components.Nodes.Lists.Tabs as Tabs
import Gargantext.Components.Nodes.Lists.Types (CacheState(..)) import Gargantext.Components.Nodes.Lists.Types (CacheState(..))
import Gargantext.Components.Table as Table import Gargantext.Components.Table as Table
...@@ -29,6 +32,7 @@ type CommonPropsNoSession = ...@@ -29,6 +32,7 @@ type CommonPropsNoSession =
( boxes :: Boxes ( boxes :: Boxes
, nodeId :: Int , nodeId :: Int
, sessionUpdate :: Session -> Effect Unit , sessionUpdate :: Session -> Effect Unit
, sidePanel :: T.Box (Maybe (Record SidePanel))
) )
type Props = WithSession CommonPropsNoSession type Props = WithSession CommonPropsNoSession
...@@ -52,7 +56,8 @@ listsLayoutWithKeyCpt = here.component "listsLayoutWithKey" cpt where ...@@ -52,7 +56,8 @@ listsLayoutWithKeyCpt = here.component "listsLayoutWithKey" cpt where
cpt { boxes cpt { boxes
, nodeId , nodeId
, session , session
, sessionUpdate } _ = do , sessionUpdate
, sidePanel } _ = do
activeTab <- T.useBox 0 activeTab <- T.useBox 0
let path = { nodeId, session } let path = { nodeId, session }
...@@ -87,6 +92,7 @@ listsLayoutWithKeyCpt = here.component "listsLayoutWithKey" cpt where ...@@ -87,6 +92,7 @@ listsLayoutWithKeyCpt = here.component "listsLayoutWithKey" cpt where
, corpusId , corpusId
, key: "listsLayoutWithKey-tabs-" <> (show cacheState') , key: "listsLayoutWithKey-tabs-" <> (show cacheState')
, session , session
, sidePanel
} }
] } ] }
where where
...@@ -96,7 +102,8 @@ listsLayoutWithKeyCpt = here.component "listsLayoutWithKey" cpt where ...@@ -96,7 +102,8 @@ listsLayoutWithKeyCpt = here.component "listsLayoutWithKey" cpt where
sessionUpdate $ setCacheState session nodeId cacheState sessionUpdate $ setCacheState session nodeId cacheState
type SidePanelProps = type SidePanelProps =
( session :: Session ( selectedNgrams :: T.Box (Maybe NgramsTerm)
, session :: Session
, sidePanelState :: T.Box GT.SidePanelState , sidePanelState :: T.Box GT.SidePanelState
) )
...@@ -106,6 +113,7 @@ sidePanelCpt :: R.Component SidePanelProps ...@@ -106,6 +113,7 @@ sidePanelCpt :: R.Component SidePanelProps
sidePanelCpt = here.component "sidePanel" cpt sidePanelCpt = here.component "sidePanel" cpt
where where
cpt { session cpt { session
, selectedNgrams
, sidePanelState } _ = do , sidePanelState } _ = do
sidePanelState' <- T.useLive T.unequal sidePanelState sidePanelState' <- T.useLive T.unequal sidePanelState
...@@ -123,15 +131,19 @@ sidePanelCpt = here.component "sidePanel" cpt ...@@ -123,15 +131,19 @@ sidePanelCpt = here.component "sidePanel" cpt
H.span { className: "fa fa-times" } [] H.span { className: "fa fa-times" } []
] ]
] ]
, sidePanelDocView { session } [] , sidePanelNgramsContextView { selectedNgrams
, session } []
] ]
type SidePanelDocView = ( session :: Session ) type SidePanelNgramsContextView =
( selectedNgrams :: T.Box (Maybe NgramsTerm)
, session :: Session )
sidePanelDocView :: R2.Component SidePanelDocView sidePanelNgramsContextView :: R2.Component SidePanelNgramsContextView
sidePanelDocView = R.createElement sidePanelDocViewCpt sidePanelNgramsContextView = R.createElement sidePanelNgramsContextViewCpt
sidePanelDocViewCpt :: R.Component SidePanelDocView sidePanelNgramsContextViewCpt :: R.Component SidePanelNgramsContextView
sidePanelDocViewCpt = here.component "sidePanelDocView" cpt where sidePanelNgramsContextViewCpt = here.component "sidePanelNgramsContextView" cpt where
cpt { } _ = do cpt { selectedNgrams
, session } _ = do
-- pure $ H.h4 {} [ H.text txt ] -- pure $ H.h4 {} [ H.text txt ]
pure $ H.div {} [ H.text "Hello ngrams" ] pure $ H.div {} [ H.text "Hello ngrams" ]
...@@ -14,6 +14,7 @@ import Gargantext.Components.Nodes.Corpus.Chart.Pie (pie, bar) ...@@ -14,6 +14,7 @@ import Gargantext.Components.Nodes.Corpus.Chart.Pie (pie, bar)
import Gargantext.Components.Nodes.Corpus.Chart.Tree (tree) import Gargantext.Components.Nodes.Corpus.Chart.Tree (tree)
import Gargantext.Components.Nodes.Corpus.Chart.Utils (mNgramsTypeFromTabType) import Gargantext.Components.Nodes.Corpus.Chart.Utils (mNgramsTypeFromTabType)
import Gargantext.Components.Nodes.Corpus.Types (CorpusData) import Gargantext.Components.Nodes.Corpus.Types (CorpusData)
import Gargantext.Components.Nodes.Lists.SidePanel (SidePanel)
import Gargantext.Components.Tab as Tab import Gargantext.Components.Tab as Tab
import Gargantext.Components.Table.Types (Params) import Gargantext.Components.Table.Types (Params)
import Gargantext.Core.NgramsTable.Types (PageParams) import Gargantext.Core.NgramsTable.Types (PageParams)
...@@ -37,6 +38,7 @@ type Props = ( ...@@ -37,6 +38,7 @@ type Props = (
, corpusData :: CorpusData , corpusData :: CorpusData
, corpusId :: Int , corpusId :: Int
, session :: Session , session :: Session
, sidePanel :: T.Box (Maybe (Record SidePanel))
) )
tabs :: Record ( key :: String | Props ) -> R.Element tabs :: Record ( key :: String | Props ) -> R.Element
...@@ -60,7 +62,6 @@ type TabProps = ( mode :: Mode | Props ) ...@@ -60,7 +62,6 @@ type TabProps = ( mode :: Mode | Props )
tab :: R2.Component TabProps tab :: R2.Component TabProps
tab = R.createElement tabCpt tab = R.createElement tabCpt
tabCpt :: R.Component TabProps tabCpt :: R.Component TabProps
tabCpt = here.component "tab" cpt where tabCpt = here.component "tab" cpt where
cpt props _ = do cpt props _ = do
...@@ -78,7 +79,9 @@ tabCpt = here.component "tab" cpt where ...@@ -78,7 +79,9 @@ tabCpt = here.component "tab" cpt where
} }
type NgramsViewProps = ( path :: T.Box PageParams | TabProps ) type NgramsViewProps =
( path :: T.Box PageParams
| TabProps )
ngramsView :: R2.Component NgramsViewProps ngramsView :: R2.Component NgramsViewProps
ngramsView = R.createElement ngramsViewCpt ngramsView = R.createElement ngramsViewCpt
...@@ -89,7 +92,8 @@ ngramsViewCpt = here.component "ngramsView" cpt where ...@@ -89,7 +92,8 @@ ngramsViewCpt = here.component "ngramsView" cpt where
, corpusData: { defaultListId } , corpusData: { defaultListId }
, mode , mode
, session , session
, path } _ = do , path
, sidePanel } _ = do
chartsReload <- T.useBox T2.newReload chartsReload <- T.useBox T2.newReload
onCancelRef <- R.useRef Nothing onCancelRef <- R.useRef Nothing
onNgramsClickRef <- R.useRef Nothing onNgramsClickRef <- R.useRef Nothing
...@@ -118,6 +122,7 @@ ngramsViewCpt = here.component "ngramsView" cpt where ...@@ -118,6 +122,7 @@ ngramsViewCpt = here.component "ngramsView" cpt where
, defaultListId , defaultListId
, path , path
, session , session
, sidePanel
, tabNgramType , tabNgramType
, tabType , tabType
, treeEdit: { box: treeEditBox , treeEdit: { box: treeEditBox
......
...@@ -24,9 +24,3 @@ instance Eq CacheState where ...@@ -24,9 +24,3 @@ instance Eq CacheState where
eq = genericEq eq = genericEq
instance Show CacheState where instance Show CacheState where
show = genericShow show = genericShow
type SidePanel :: forall k. Row k
type SidePanel = ()
initialSidePanel :: Maybe (Record SidePanel)
initialSidePanel = Nothing
...@@ -215,7 +215,6 @@ mainPageCpt = here.component "mainPage" cpt where ...@@ -215,7 +215,6 @@ mainPageCpt = here.component "mainPage" cpt where
forest :: R2.Leaf Props forest :: R2.Leaf Props
forest = R2.leaf forestCpt forest = R2.leaf forestCpt
forestCpt :: R.Memo Props forestCpt :: R.Memo Props
forestCpt = R.memo' $ here.component "forest" cpt where forestCpt = R.memo' $ here.component "forest" cpt where
cpt { boxes } _ = do cpt { boxes } _ = do
...@@ -362,7 +361,6 @@ authedCpt = here.component "authed" cpt where ...@@ -362,7 +361,6 @@ authedCpt = here.component "authed" cpt where
openedSidePanel :: R2.Leaf Props openedSidePanel :: R2.Leaf Props
openedSidePanel = R2.leaf openedSidePanelCpt openedSidePanel = R2.leaf openedSidePanelCpt
openedSidePanelCpt :: R.Component Props openedSidePanelCpt :: R.Component Props
openedSidePanelCpt = here.component "openedSidePanel" cpt where openedSidePanelCpt = here.component "openedSidePanel" cpt where
cpt { boxes: cpt { boxes:
...@@ -376,10 +374,13 @@ openedSidePanelCpt = here.component "openedSidePanel" cpt where ...@@ -376,10 +374,13 @@ openedSidePanelCpt = here.component "openedSidePanel" cpt where
let wrapper = H.div { className: "side-panel shadow" } let wrapper = H.div { className: "side-panel shadow" }
selectedNgrams <- T.useBox Nothing
case route' of case route' of
GR.Lists _s _n -> do GR.Lists _s _n -> do
pure $ wrapper pure $ wrapper
[ Lists.sidePanel { session [ Lists.sidePanel { session
, selectedNgrams
, sidePanelState } [] ] , sidePanelState } [] ]
GR.NodeTexts _s _n -> GR.NodeTexts _s _n ->
pure $ wrapper [ Texts.textsSidePanel {} ] pure $ wrapper [ Texts.textsSidePanel {} ]
...@@ -544,7 +545,6 @@ graphExplorerCpt = here.component "graphExplorer" cpt where ...@@ -544,7 +545,6 @@ graphExplorerCpt = here.component "graphExplorer" cpt where
phyloExplorer :: R2.Component SessionNodeProps phyloExplorer :: R2.Component SessionNodeProps
phyloExplorer = R.createElement phyloExplorerCpt phyloExplorer = R.createElement phyloExplorerCpt
phyloExplorerCpt :: R.Component SessionNodeProps phyloExplorerCpt :: R.Component SessionNodeProps
phyloExplorerCpt = here.component "phylo" cpt where phyloExplorerCpt = here.component "phylo" cpt where
cpt props@{ nodeId } _ = do cpt props@{ nodeId } _ = do
...@@ -584,7 +584,8 @@ listsCpt = here.component "lists" cpt where ...@@ -584,7 +584,8 @@ listsCpt = here.component "lists" cpt where
Lists.listsLayout { boxes Lists.listsLayout { boxes
, nodeId , nodeId
, session , session
, sessionUpdate: \_ -> pure unit } [] } sessionProps) [] , sessionUpdate: \_ -> pure unit
, sidePanel: boxes.sidePanelLists } [] } sessionProps) []
-------------------------------------------------------------- --------------------------------------------------------------
...@@ -665,7 +666,6 @@ teamCpt = here.component "team" cpt where ...@@ -665,7 +666,6 @@ teamCpt = here.component "team" cpt where
texts :: R2.Component SessionNodeProps texts :: R2.Component SessionNodeProps
texts = R.createElement textsCpt texts = R.createElement textsCpt
textsCpt :: R.Component SessionNodeProps textsCpt :: R.Component SessionNodeProps
textsCpt = here.component "texts" cpt where textsCpt = here.component "texts" cpt where
cpt props@{ nodeId } _ = do cpt props@{ nodeId } _ = do
......
...@@ -20,20 +20,20 @@ data AppRoute ...@@ -20,20 +20,20 @@ data AppRoute
| FolderPrivate SessionId Int | FolderPrivate SessionId Int
| FolderPublic SessionId Int | FolderPublic SessionId Int
| FolderShared SessionId Int | FolderShared SessionId Int
| ForgotPassword (M.Map String String)
| Home | Home
| Lists SessionId Int | Lists SessionId Int
| Login | Login
| NodeTexts SessionId Int
| PGraphExplorer SessionId Int | PGraphExplorer SessionId Int
| PhyloExplorer SessionId Int | PhyloExplorer SessionId Int
| RouteFile SessionId Int | RouteFile SessionId Int
| RouteFrameCalc SessionId Int | RouteFrameCalc SessionId Int
| RouteFrameCode SessionId Int | RouteFrameCode SessionId Int
| RouteFrameWrite SessionId Int
| RouteFrameVisio SessionId Int | RouteFrameVisio SessionId Int
| RouteFrameWrite SessionId Int
| Team SessionId Int | Team SessionId Int
| NodeTexts SessionId Int
| UserPage SessionId Int | UserPage SessionId Int
| ForgotPassword (M.Map String String)
derive instance Eq AppRoute derive instance Eq AppRoute
......
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