Lists.purs 1.26 KB
Newer Older
1
module Gargantext.Components.Nodes.Lists where
2 3 4 5

import Reactix as R
--------------------------------------------------------
import Gargantext.Prelude
6 7
import Gargantext.Components.Nodes.Corpus (CorpusInfo(..), loadCorpus)
import Gargantext.Components.Node (NodePoly(..))
8
import Gargantext.Components.Table as Table
9
import Gargantext.Hooks.Loader (useLoader)
10
import Gargantext.Components.Nodes.Lists.Tabs as Tabs
11
import Gargantext.Sessions (Session)
12 13

------------------------------------------------------------------------
14

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

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

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