Lists.purs 1.48 KB
Newer Older
1
module Gargantext.Components.Nodes.Lists where
2 3

import Reactix as R
4
------------------------------------------------------------------------
5
import Gargantext.Components.Node (NodePoly(..))
6 7 8
import Gargantext.Components.Nodes.Corpus (loadCorpusWithChild)
import Gargantext.Components.Nodes.Corpus.Types (getCorpusInfo, CorpusInfo(..), Hyperdata(..))
import Gargantext.Components.Nodes.Lists.Tabs as Tabs
9
import Gargantext.Components.Table as Table
10
import Gargantext.Hooks.Loader (useLoader)
11
import Gargantext.Prelude
12
import Gargantext.Sessions (Session)
13
------------------------------------------------------------------------
14
------------------------------------------------------------------------
15

16
type Props = ( session :: Session, nodeId :: Int )
17 18 19 20 21 22 23

listsLayout :: Record Props -> R.Element
listsLayout props = R.createElement listsLayoutCpt props []

listsLayoutCpt :: R.Component Props
listsLayoutCpt = R.hooksComponent "G.P.Lists.listsLayout" cpt
  where
24
    cpt path@{session} _ =
25
      useLoader path loadCorpusWithChild $
26
        \corpusData@{corpusId, defaultListId, corpusNode: NodePoly poly} ->
27 28 29
              let { name, date, hyperdata : Hyperdata h} = poly
                  CorpusInfo {desc,query,authors} = getCorpusInfo h.fields
           in
30 31
          R.fragment
          [ Table.tableHeaderLayout
32
            { title: "Corpus " <> name, desc, query, user:authors, date }
33
         , Tabs.tabs {session, corpusId, corpusData}]
34
------------------------------------------------------------------------