Commit b8e9ded9 authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge remote-tracking branch 'origin/547-dev-ngrams-context-sidebar' into dev

parents 95f4a9c1 80d78594
...@@ -11359,6 +11359,26 @@ select.form-control { ...@@ -11359,6 +11359,26 @@ select.form-control {
text-align: center; text-align: center;
} }
.side-panel {
z-index: 10;
}
.side-panel .ngrams-doc-list .list-group {
max-height: 40em;
overflow-y: scroll;
}
.side-panel .ngrams-doc-list .list-group .context-item-title {
line-height: 1.3;
margin-bottom: 4px;
}
.side-panel .ngrams-doc-list .list-group .context-item-source {
color: #CED4DA;
font-variant-caps: small-caps;
}
.side-panel .ngrams-doc-list .list-group .context-item-date {
color: #CED4DA;
font-size: 0.85rem;
}
.annotation-run { .annotation-run {
cursor: pointer; cursor: pointer;
} }
......
...@@ -11162,6 +11162,26 @@ select.form-control { ...@@ -11162,6 +11162,26 @@ select.form-control {
text-align: center; text-align: center;
} }
.side-panel {
z-index: 10;
}
.side-panel .ngrams-doc-list .list-group {
max-height: 40em;
overflow-y: scroll;
}
.side-panel .ngrams-doc-list .list-group .context-item-title {
line-height: 1.3;
margin-bottom: 4px;
}
.side-panel .ngrams-doc-list .list-group .context-item-source {
color: #6C757D;
font-variant-caps: small-caps;
}
.side-panel .ngrams-doc-list .list-group .context-item-date {
color: #6C757D;
font-size: 0.85rem;
}
.annotation-run { .annotation-run {
cursor: pointer; cursor: pointer;
} }
......
...@@ -10925,6 +10925,26 @@ select.form-control { ...@@ -10925,6 +10925,26 @@ select.form-control {
text-align: center; text-align: center;
} }
.side-panel {
z-index: 10;
}
.side-panel .ngrams-doc-list .list-group {
max-height: 40em;
overflow-y: scroll;
}
.side-panel .ngrams-doc-list .list-group .context-item-title {
line-height: 1.3;
margin-bottom: 4px;
}
.side-panel .ngrams-doc-list .list-group .context-item-source {
color: #6C757D;
font-variant-caps: small-caps;
}
.side-panel .ngrams-doc-list .list-group .context-item-date {
color: #6C757D;
font-size: 0.85rem;
}
.annotation-run { .annotation-run {
cursor: pointer; cursor: pointer;
} }
......
...@@ -11173,6 +11173,26 @@ select.form-control { ...@@ -11173,6 +11173,26 @@ select.form-control {
text-align: center; text-align: center;
} }
.side-panel {
z-index: 10;
}
.side-panel .ngrams-doc-list .list-group {
max-height: 40em;
overflow-y: scroll;
}
.side-panel .ngrams-doc-list .list-group .context-item-title {
line-height: 1.3;
margin-bottom: 4px;
}
.side-panel .ngrams-doc-list .list-group .context-item-source {
color: #6C757D;
font-variant-caps: small-caps;
}
.side-panel .ngrams-doc-list .list-group .context-item-date {
color: #6C757D;
font-size: 0.85rem;
}
.annotation-run { .annotation-run {
cursor: pointer; cursor: pointer;
} }
......
...@@ -11174,6 +11174,26 @@ select.form-control { ...@@ -11174,6 +11174,26 @@ select.form-control {
text-align: center; text-align: center;
} }
.side-panel {
z-index: 10;
}
.side-panel .ngrams-doc-list .list-group {
max-height: 40em;
overflow-y: scroll;
}
.side-panel .ngrams-doc-list .list-group .context-item-title {
line-height: 1.3;
margin-bottom: 4px;
}
.side-panel .ngrams-doc-list .list-group .context-item-source {
color: #6C757D;
font-variant-caps: small-caps;
}
.side-panel .ngrams-doc-list .list-group .context-item-date {
color: #6C757D;
font-size: 0.85rem;
}
.annotation-run { .annotation-run {
cursor: pointer; cursor: pointer;
} }
......
...@@ -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
...@@ -56,7 +57,7 @@ type Store = ...@@ -56,7 +57,7 @@ type Store =
, showLogin :: T.Box Boolean , showLogin :: T.Box Boolean
, showTree :: T.Box Boolean , showTree :: T.Box Boolean
, showSearch :: T.Box Boolean , showSearch :: 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
...@@ -84,7 +85,7 @@ type State = ...@@ -84,7 +85,7 @@ type State =
, showLogin :: Boolean , showLogin :: Boolean
, showTree :: Boolean , showTree :: Boolean
, showSearch :: Boolean , showSearch :: 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
...@@ -113,7 +114,7 @@ options = ...@@ -113,7 +114,7 @@ options =
, showLogin : false , showLogin : false
, showTree : true , showTree : true
, showSearch : false , showSearch : false
, sidePanelLists : ListsT.initialSidePanel , sidePanelLists : ListsSP.initialSidePanel
, sidePanelTexts : TextsT.initialSidePanel , sidePanelTexts : TextsT.initialSidePanel
, sidePanelState : InitialClosed , sidePanelState : InitialClosed
, tasks : GAT.empty , tasks : GAT.empty
......
...@@ -273,7 +273,6 @@ type ItemProps = ...@@ -273,7 +273,6 @@ type ItemProps =
item :: R2.Leaf ItemProps item :: R2.Leaf ItemProps
item = R2.leaf itemCpt item = R2.leaf itemCpt
itemCpt :: R.Component ItemProps itemCpt :: R.Component ItemProps
itemCpt = here.component "item" cpt where itemCpt = here.component "item" cpt where
cpt { documentView: dv@(DocumentsView { id, title, source }) cpt { documentView: dv@(DocumentsView { id, title, source })
......
...@@ -22,7 +22,7 @@ import Gargantext.Components.Lang (Lang) ...@@ -22,7 +22,7 @@ import Gargantext.Components.Lang (Lang)
import Gargantext.Config.REST (RESTError(..), AffRESTError) import Gargantext.Config.REST (RESTError(..), AffRESTError)
import Gargantext.Core.NgramsTable.Types (NgramsTerm(..)) import Gargantext.Core.NgramsTable.Types (NgramsTerm(..))
import Gargantext.Sessions (Session(..)) import Gargantext.Sessions (Session(..))
import Gargantext.Types (NodeType) import Gargantext.Types (CorpusId, NodeType)
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import GraphQL.Client.Args (onlyArgs) import GraphQL.Client.Args (onlyArgs)
import GraphQL.Client.Query (mutation) import GraphQL.Client.Query (mutation)
...@@ -123,7 +123,7 @@ getNodeContext session context_id node_id = do ...@@ -123,7 +123,7 @@ getNodeContext session context_id node_id = do
Just context -> pure $ Right context -- TODO: error handling Just context -> pure $ Right context -- TODO: error handling
type ContextsForNgramsGQL = { contexts_for_ngrams :: Array GQLCTX.Context } type ContextsForNgramsGQL = { contexts_for_ngrams :: Array GQLCTX.Context }
getContextsForNgrams :: Session -> Int -> Array String -> AffRESTError (Array GQLCTX.Context) getContextsForNgrams :: Session -> CorpusId -> Array String -> AffRESTError (Array GQLCTX.Context)
getContextsForNgrams session corpus_id ngrams_terms = do getContextsForNgrams session corpus_id ngrams_terms = do
let query = GQLCTX.contextsForNgramsQuery `withVars` { corpus_id let query = GQLCTX.contextsForNgramsQuery `withVars` { corpus_id
, ngrams_terms: GQLCTX.NgramsTerms ngrams_terms } , ngrams_terms: GQLCTX.NgramsTerms ngrams_terms }
......
...@@ -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,15 +562,20 @@ loadedNgramsTableBodyCpt = here.component "loadedNgramsTableBody" cpt where ...@@ -557,15 +562,20 @@ loadedNgramsTableBodyCpt = here.component "loadedNgramsTableBody" cpt where
filteredConvertedRows = convertRow <$> filteredRows filteredConvertedRows = convertRow <$> filteredRows
convertRow ngramsElement = convertRow ngramsElement =
{ row: renderNgramsItem { dispatch: performAction { row: renderNgramsItem { boxes
, corpusId: path'.nodeId
, dispatch: performAction
, getNgramsChildrenAff , getNgramsChildrenAff
, getNgramsChildren , getNgramsChildren
, isEditing , isEditing
, mListId: A.head path'.listIds
, ngrams: ngramsElement ^. _NgramsElement <<< _ngrams , ngrams: ngramsElement ^. _NgramsElement <<< _ngrams
, ngramsElement , ngramsElement
, ngramsLocalPatch , ngramsLocalPatch
, ngramsSelection , ngramsSelection
, ngramsTable } [] , ngramsTable
, session: path'.session
, sidePanel } []
, delete: false , delete: false
} }
...@@ -649,7 +659,7 @@ loadedNgramsTableBodyCpt = here.component "loadedNgramsTableBody" cpt where ...@@ -649,7 +659,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 +787,7 @@ type MainNgramsTableProps = ( ...@@ -777,6 +787,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 +1025,8 @@ mainNgramsTableCacheOnCpt = here.component "mainNgramsTableCacheOn" cpt where ...@@ -1014,6 +1025,8 @@ mainNgramsTableCacheOnCpt = here.component "mainNgramsTableCacheOn" cpt where
, boxes , boxes
, defaultListId , defaultListId
, path , path
, session
, sidePanel
, state , state
, tabNgramType , tabNgramType
, treeEdit , treeEdit
...@@ -1026,6 +1039,8 @@ mainNgramsTableCacheOnCpt = here.component "mainNgramsTableCacheOn" cpt where ...@@ -1026,6 +1039,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 +1075,8 @@ mainNgramsTableCacheOffCpt = here.component "mainNgramsTableCacheOff" cpt where ...@@ -1060,6 +1075,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 +1085,8 @@ mainNgramsTableCacheOffCpt = here.component "mainNgramsTableCacheOff" cpt where ...@@ -1068,6 +1085,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 +1125,8 @@ mainNgramsTableCacheOffCpt = here.component "mainNgramsTableCacheOff" cpt where ...@@ -1106,6 +1125,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 +1142,8 @@ mainNgramsTablePaintCpt = here.component "mainNgramsTablePaint" cpt ...@@ -1121,6 +1142,8 @@ mainNgramsTablePaintCpt = here.component "mainNgramsTablePaint" cpt
, boxes , boxes
, cacheState , cacheState
, path , path
, session
, sidePanel
, state , state
, tabNgramType , tabNgramType
, treeEdit , treeEdit
...@@ -1137,6 +1160,8 @@ mainNgramsTablePaintCpt = here.component "mainNgramsTablePaint" cpt ...@@ -1137,6 +1160,8 @@ mainNgramsTablePaintCpt = here.component "mainNgramsTablePaint" cpt
, cacheState , cacheState
, mTotalRows: Nothing , mTotalRows: Nothing
, path , path
, session
, sidePanel
, state , state
, tabNgramType , tabNgramType
, treeEdit , treeEdit
...@@ -1147,6 +1172,8 @@ mainNgramsTablePaintCpt = here.component "mainNgramsTablePaint" cpt ...@@ -1147,6 +1172,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 +1189,8 @@ mainNgramsTablePaintNoCacheCpt = here.component "mainNgramsTablePaintNoCache" cp ...@@ -1162,6 +1189,8 @@ mainNgramsTablePaintNoCacheCpt = here.component "mainNgramsTablePaintNoCache" cp
, boxes , boxes
, cacheState , cacheState
, path , path
, session
, sidePanel
, state , state
, tabNgramType , tabNgramType
, treeEdit , treeEdit
...@@ -1181,6 +1210,8 @@ mainNgramsTablePaintNoCacheCpt = here.component "mainNgramsTablePaintNoCache" cp ...@@ -1181,6 +1210,8 @@ mainNgramsTablePaintNoCacheCpt = here.component "mainNgramsTablePaintNoCache" cp
, cacheState , cacheState
, mTotalRows: Just count , mTotalRows: Just count
, path , path
, session
, sidePanel
, state , state
, tabNgramType , tabNgramType
, treeEdit , treeEdit
......
...@@ -16,12 +16,15 @@ import Data.Tuple.Nested ((/\)) ...@@ -16,12 +16,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(..), CoreAction, NgramsClick, NgramsDepth, NgramsElement, NgramsTable, NgramsTablePatch, NgramsTerm, _NgramsElement, _NgramsRepoElement, _children, _list, _ngrams, _occurrences, ngramsTermText, replace) import Gargantext.Core.NgramsTable.Types (Action(..), CoreAction, 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
...@@ -225,15 +228,20 @@ treeLoadedCpt = here.component "treeLoaded" cpt where ...@@ -225,15 +228,20 @@ 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
, corpusId :: GT.CorpusId
, 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
, mListId :: Maybe GT.ListId
, ngrams :: NgramsTerm , ngrams :: NgramsTerm
, ngramsElement :: NgramsElement , ngramsElement :: NgramsElement
, 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
...@@ -241,19 +249,40 @@ renderNgramsItem = R.createElement renderNgramsItemCpt ...@@ -241,19 +249,40 @@ 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
, corpusId
, dispatch
--, getNgramsChildren --, getNgramsChildren
, isEditing , isEditing
, mListId
, ngrams , ngrams
, ngramsElement , ngramsElement
, 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
, corpusId
, mListId
, ngrams
, session
, sidePanel } []
,
selected selected
, ,
B.wad' B.wad'
...@@ -392,3 +421,55 @@ nextTermList :: GT.TermList -> GT.TermList ...@@ -392,3 +421,55 @@ 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
, corpusId :: GT.CorpusId
, mListId :: Maybe GT.ListId
, 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 }
, corpusId
, mListId
, 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 { mCorpusId: Just corpusId
, mListId
, 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,17 +2,25 @@ module Gargantext.Components.Nodes.Lists where ...@@ -2,17 +2,25 @@ module Gargantext.Components.Nodes.Lists where
import Gargantext.Prelude import Gargantext.Prelude
import Data.Maybe (Maybe(..), fromMaybe, 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.Components.Corpus.CodeSection (loadCorpusWithChild) import Gargantext.Components.Corpus.CodeSection (loadCorpusWithChild)
import Gargantext.Components.GraphQL.Context as GQLCTX
import Gargantext.Components.GraphQL.Endpoints (getContextsForNgrams)
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
import Gargantext.Config.REST (logRESTError) import Gargantext.Config (defaultFrontends)
import Gargantext.Config.REST (logRESTError, AffRESTError)
import Gargantext.Core.NgramsTable.Types (NgramsTerm(..))
import Gargantext.Ends (url)
import Gargantext.Hooks.Loader (useLoader) import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Routes as Routes
import Gargantext.Sessions (WithSession, WithSessionContext, Session, sessionId, getCacheState, setCacheState) import Gargantext.Sessions (WithSession, WithSessionContext, Session, sessionId, getCacheState, setCacheState)
import Gargantext.Types as GT import Gargantext.Types as GT
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
...@@ -29,6 +37,7 @@ type CommonPropsNoSession = ...@@ -29,6 +37,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 +61,8 @@ listsLayoutWithKeyCpt = here.component "listsLayoutWithKey" cpt where ...@@ -52,7 +61,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 +97,7 @@ listsLayoutWithKeyCpt = here.component "listsLayoutWithKey" cpt where ...@@ -87,6 +97,7 @@ listsLayoutWithKeyCpt = here.component "listsLayoutWithKey" cpt where
, corpusId , corpusId
, key: "listsLayoutWithKey-tabs-" <> (show cacheState') , key: "listsLayoutWithKey-tabs-" <> (show cacheState')
, session , session
, sidePanel
} }
] } ] }
where where
...@@ -97,6 +108,7 @@ listsLayoutWithKeyCpt = here.component "listsLayoutWithKey" cpt where ...@@ -97,6 +108,7 @@ listsLayoutWithKeyCpt = here.component "listsLayoutWithKey" cpt where
type SidePanelProps = type SidePanelProps =
( session :: Session ( session :: Session
, sidePanel :: T.Box (Maybe (Record SidePanel))
, sidePanelState :: T.Box GT.SidePanelState , sidePanelState :: T.Box GT.SidePanelState
) )
...@@ -106,6 +118,7 @@ sidePanelCpt :: R.Component SidePanelProps ...@@ -106,6 +118,7 @@ sidePanelCpt :: R.Component SidePanelProps
sidePanelCpt = here.component "sidePanel" cpt sidePanelCpt = here.component "sidePanel" cpt
where where
cpt { session cpt { session
, sidePanel
, sidePanelState } _ = do , sidePanelState } _ = do
sidePanelState' <- T.useLive T.unequal sidePanelState sidePanelState' <- T.useLive T.unequal sidePanelState
...@@ -123,15 +136,123 @@ sidePanelCpt = here.component "sidePanel" cpt ...@@ -123,15 +136,123 @@ sidePanelCpt = here.component "sidePanel" cpt
H.span { className: "fa fa-times" } [] H.span { className: "fa fa-times" } []
] ]
] ]
, sidePanelDocView { session } [] , sidePanelNgramsContextView { session
, sidePanel } []
] ]
type SidePanelDocView = ( session :: Session ) type SidePanelNgramsContextView =
( session :: Session
, sidePanel :: T.Box (Maybe (Record SidePanel)) )
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 { session
-- pure $ H.h4 {} [ H.text txt ] , sidePanel } _ = do
pure $ H.div {} [ H.text "Hello ngrams" ] mSidePanel' <- T.useLive T.unequal sidePanel
case mSidePanel' of
Nothing -> pure $ H.div {} []
Just sidePanel' -> do
let ngrams = maybe "" (\(NormNgramsTerm n) -> n) sidePanel'.mCurrentNgrams
pure $ H.div {} [ H.h3 {} [ H.text ngrams ]
, ngramsDocList { mCorpusId: sidePanel'.mCorpusId
, mListId: sidePanel'.mListId
, mNgrams: sidePanel'.mCurrentNgrams
, session } [] ]
type NgramsDocListProps =
( mCorpusId :: Maybe GT.CorpusId
, mListId :: Maybe GT.ListId
, mNgrams :: Maybe NgramsTerm
, session :: Session )
ngramsDocList :: R2.Component NgramsDocListProps
ngramsDocList = R.createElement ngramsDocListCpt
ngramsDocListCpt :: R.Component NgramsDocListProps
ngramsDocListCpt = here.component "ngramsDocList" cpt where
cpt { mCorpusId: Nothing } _ = do
pure $ H.div {} []
cpt { mListId: Nothing } _ = do
pure $ H.div {} []
cpt { mNgrams: Nothing } _ = do
pure $ H.div {} []
cpt { mCorpusId: Just corpusId
, mListId: Just listId
, mNgrams: Just ngrams
, session } _ = do
useLoader { errorHandler
, path: { corpusId, ngrams, session }
, loader: loaderNgramsDocList
, render: \ctx -> ngramsDocListLoaded { contexts: ctx
, corpusId
, listId
, ngrams
, session } []
}
where
errorHandler = logRESTError here "[ngramsDocList]"
type NgramsDocLoadProps =
( corpusId :: GT.CorpusId
, ngrams :: NgramsTerm
, session :: Session )
loaderNgramsDocList :: Record NgramsDocLoadProps -> AffRESTError (Array GQLCTX.Context)
loaderNgramsDocList { corpusId, ngrams: NormNgramsTerm ngrams, session } =
getContextsForNgrams session corpusId [ngrams]
type NgramsDocListLoadedProps =
( contexts :: Array GQLCTX.Context
, corpusId :: GT.CorpusId
, listId :: GT.ListId
, ngrams :: NgramsTerm
, session :: Session )
ngramsDocListLoaded :: R2.Component NgramsDocListLoadedProps
ngramsDocListLoaded = R.createElement ngramsDocListLoadedCpt
ngramsDocListLoadedCpt :: R.Component NgramsDocListLoadedProps
ngramsDocListLoadedCpt = here.component "ngramsDocListLoaded" cpt where
cpt { contexts
, corpusId
, listId
, ngrams
, session } _ = do
pure $ H.div { className: "ngrams-doc-list" }
[ H.ul { className: "list-group" } ((\item -> contextItem { corpusId
, item
, listId
, session } [] ) <$> contexts)
]
type ContextItemProps =
( corpusId :: GT.CorpusId
, item :: GQLCTX.Context
, listId :: GT.ListId
, session :: Session )
contextItem :: R2.Component ContextItemProps
contextItem = R.createElement contextItemCpt
contextItemCpt :: R.Component ContextItemProps
contextItemCpt = here.component "contextItem" cpt where
cpt { corpusId
, item
, listId
, session } _ = do
let route = Routes.CorpusDocument (sessionId session) corpusId listId item.c_id
href = url defaultFrontends route
pure $ H.a { className: "list-group-item text-decoration-none"
, href
, target: "_blank" }
[ H.div { className: "context-item-title" }
[ H.text $ maybe "" (_.hrd_title) item.c_hyperdata ]
, H.div { className: "context-item-source"}
[ H.text $ maybe "" (_.hrd_source) item.c_hyperdata ]
, H.div { className: "context-item-date"}
[ H.text $ (maybe "" (\h -> show h.hrd_publication_year) item.c_hyperdata) <>
"-" <>
(maybe "" (\h -> show h.hrd_publication_month) item.c_hyperdata) ] ]
module Gargantext.Components.Nodes.Lists.SidePanel where
import Data.Maybe (Maybe(..))
import Gargantext.Core.NgramsTable.Types (NgramsTerm)
import Gargantext.Types (CorpusId, ListId)
-- type SidePanel :: forall k. Row k
type SidePanel = (
mCorpusId :: Maybe CorpusId
, mCurrentNgrams :: Maybe NgramsTerm
, mListId :: Maybe ListId
)
initialSidePanel :: Maybe (Record SidePanel)
initialSidePanel = Nothing
...@@ -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
...@@ -218,7 +218,6 @@ mainPageCpt = here.component "mainPage" cpt where ...@@ -218,7 +218,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
...@@ -366,11 +365,11 @@ authedCpt = here.component "authed" cpt where ...@@ -366,11 +365,11 @@ 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:
{ route { route
, sidePanelLists
, sidePanelState , sidePanelState
} }
} _ = do } _ = do
...@@ -380,10 +379,13 @@ openedSidePanelCpt = here.component "openedSidePanel" cpt where ...@@ -380,10 +379,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
, sidePanel: sidePanelLists
, sidePanelState } [] ] , sidePanelState } [] ]
GR.NodeTexts _s _n -> GR.NodeTexts _s _n ->
pure $ wrapper [ Texts.textsSidePanel {} ] pure $ wrapper [ Texts.textsSidePanel {} ]
...@@ -548,7 +550,6 @@ graphExplorerCpt = here.component "graphExplorer" cpt where ...@@ -548,7 +550,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
...@@ -588,7 +589,8 @@ listsCpt = here.component "lists" cpt where ...@@ -588,7 +589,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) []
-------------------------------------------------------------- --------------------------------------------------------------
...@@ -675,7 +677,6 @@ teamCpt = here.component "team" cpt where ...@@ -675,7 +677,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,21 +20,21 @@ data AppRoute ...@@ -20,21 +20,21 @@ 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
| TreeFlat SessionId Int String | TreeFlat SessionId Int String
| 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
......
...@@ -49,14 +49,14 @@ ...@@ -49,14 +49,14 @@
display: flex display: flex
padding-top: $offset-top padding-top: $offset-top
&__action &__action
// @XXX Glyphicon icons lack of homogeneous width // @XXX Glyphicon icons lack of homogeneous width
width: 14px width: 14px
margin-right: space-x(1) margin-right: space-x(1)
///////////////////////////////////////////////////: ///////////////////////////////////////////////////:
.loaded-ngrams-table-header .loaded-ngrams-table-header
display: flex display: flex
margin-top: space-x(4) margin-top: space-x(4)
...@@ -317,3 +317,19 @@ ...@@ -317,3 +317,19 @@
width: $icon-width width: $icon-width
font-size: 14px font-size: 14px
text-align: center text-align: center
.side-panel
z-index: 10
.ngrams-doc-list
.list-group
max-height: 40em
overflow-y: scroll
.context-item-title
line-height: 1.3
margin-bottom: 4px
.context-item-source
color: $gray-600
font-variant-caps: small-caps
.context-item-date
color: $gray-600
font-size: .85rem
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