Commit c20201d6 authored by Karen Konou's avatar Karen Konou

[Node terms] Show related docs for children terms as well

parent 5491ae2b
Pipeline #7688 passed with stages
in 21 minutes and 28 seconds
...@@ -282,7 +282,7 @@ renderNgramsItemCpt = here.component "renderNgramsItem" cpt ...@@ -282,7 +282,7 @@ renderNgramsItemCpt = here.component "renderNgramsItem" cpt
mCurrentNgrams' <- T.useLive T.unequal mCurrentNgrams mCurrentNgrams' <- T.useLive T.unequal mCurrentNgrams
let let
currentRowSelected = mCurrentNgrams' == Just ngrams currentRowSelected = mCurrentNgrams' == Just [ ngrams ]
className = currentRowSelected ? "page-paint-raw page-paint-raw--selected" $ "" className = currentRowSelected ? "page-paint-raw page-paint-raw--selected" $ ""
pure $ Tbl.makeRow' { className } pure $ Tbl.makeRow' { className }
...@@ -290,7 +290,7 @@ renderNgramsItemCpt = here.component "renderNgramsItem" cpt ...@@ -290,7 +290,7 @@ renderNgramsItemCpt = here.component "renderNgramsItem" cpt
, ngramsContext , ngramsContext
{ corpusId { corpusId
, mListId , mListId
, ngrams , ngrams: ([ ngrams ] <> getNgramsChildren' ngrams)
} }
[] []
, B.wad' , B.wad'
...@@ -464,7 +464,7 @@ nextTermList GT.CandidateTerm = GT.MapTerm ...@@ -464,7 +464,7 @@ nextTermList GT.CandidateTerm = GT.MapTerm
type NgramsContextProps = type NgramsContextProps =
( corpusId :: GT.CorpusId ( corpusId :: GT.CorpusId
, mListId :: Maybe GT.ListId , mListId :: Maybe GT.ListId
, ngrams :: NgramsTerm , ngrams :: Array NgramsTerm
) )
ngramsContext :: R2.Component NgramsContextProps ngramsContext :: R2.Component NgramsContextProps
......
...@@ -181,15 +181,11 @@ sidePanelNgramsContextViewCpt = here.component "sidePanelNgramsContextView" cpt ...@@ -181,15 +181,11 @@ sidePanelNgramsContextViewCpt = here.component "sidePanelNgramsContextView" cpt
case mSidePanel' of case mSidePanel' of
Nothing -> pure $ H.div {} [] Nothing -> pure $ H.div {} []
Just sidePanel' -> do Just sidePanel' -> do
let ngrams = maybe "" (\(NormNgramsTerm n) -> n) sidePanel'.mCurrentNgrams let ngrams = maybe [ "" ] (map \(NormNgramsTerm n) -> n) sidePanel'.mCurrentNgrams
pure $ H.div {} pure $ H.div {}
[ H.div { className: "list-group-item border-0" } [ H.div { className: "list-group-item border-0" }
[ H.div (map renderNgramsBadges ngrams)
{ className: "graph-selected-nodes__badge badge badge-info" }
[ H.text ngrams
]
]
, ngramsDocList , ngramsDocList
{ mCorpusId: sidePanel'.mCorpusId { mCorpusId: sidePanel'.mCorpusId
, mListId: sidePanel'.mListId , mListId: sidePanel'.mListId
...@@ -198,11 +194,16 @@ sidePanelNgramsContextViewCpt = here.component "sidePanelNgramsContextView" cpt ...@@ -198,11 +194,16 @@ sidePanelNgramsContextViewCpt = here.component "sidePanelNgramsContextView" cpt
} }
[] []
] ]
where
renderNgramsBadges ngram = H.div
{ className: "graph-selected-nodes__badge badge badge-info" }
[ H.text ngram
]
type NgramsDocListProps = type NgramsDocListProps =
( mCorpusId :: Maybe GT.CorpusId ( mCorpusId :: Maybe GT.CorpusId
, mListId :: Maybe GT.ListId , mListId :: Maybe GT.ListId
, mNgrams :: Maybe NgramsTerm , mNgrams :: Maybe (Array NgramsTerm)
, session :: Session , session :: Session
) )
...@@ -242,13 +243,13 @@ ngramsDocListCpt = R2.hereComponent here "ngramsDocList" hCpt ...@@ -242,13 +243,13 @@ ngramsDocListCpt = R2.hereComponent here "ngramsDocList" hCpt
type NgramsDocLoadProps = type NgramsDocLoadProps =
( corpusId :: GT.CorpusId ( corpusId :: GT.CorpusId
, ngrams :: NgramsTerm , ngrams :: Array NgramsTerm
, session :: Session , session :: Session
) )
loaderNgramsDocList :: Record NgramsDocLoadProps -> AffRESTError (Array GQLCTX.Context) loaderNgramsDocList :: Record NgramsDocLoadProps -> AffRESTError (Array GQLCTX.Context)
loaderNgramsDocList { corpusId, ngrams: NormNgramsTerm ngrams, session } = loaderNgramsDocList { corpusId, ngrams, session } =
getContextsForNgrams session corpusId [ ngrams ] false getContextsForNgrams session corpusId ((\(NormNgramsTerm n) -> n) <$> ngrams) false
type NgramsDocListLoadedProps = type NgramsDocListLoadedProps =
( contexts :: Array GQLCTX.Context ( contexts :: Array GQLCTX.Context
......
...@@ -7,7 +7,7 @@ import Gargantext.Types (CorpusId, ListId) ...@@ -7,7 +7,7 @@ import Gargantext.Types (CorpusId, ListId)
-- type SidePanel :: forall k. Row k -- type SidePanel :: forall k. Row k
type SidePanel = type SidePanel =
( mCorpusId :: Maybe CorpusId ( mCorpusId :: Maybe CorpusId
, mCurrentNgrams :: Maybe NgramsTerm , mCurrentNgrams :: Maybe (Array NgramsTerm)
, mListId :: Maybe ListId , mListId :: Maybe ListId
) )
......
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