Documentation.purs 1.8 KB
Newer Older
1
module Gargantext.Components.Forest.Tree.Node.Action.Documentation where
2 3 4

import Reactix as R
import Reactix.DOM.HTML as H
5 6 7

import Gargantext.Prelude (map, pure, show, ($), (<>))

8
import Gargantext.Components.Forest.Tree.Node.Tools (panel)
9 10 11 12 13 14
import Gargantext.Types (NodeType)
import Gargantext.Types as GT
import Gargantext.Utils.Reactix as R2

here :: R2.Here
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Documentation"
15 16

-- | Action: Show Documentation
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
type ActionDoc =
  ( nodeType :: NodeType )

actionDoc :: R2.Component ActionDoc
actionDoc = R.createElement actionDocCpt
actionDocCpt :: R.Component ActionDoc
actionDocCpt = here.component "actionDoc" cpt where
  cpt { nodeType } _ = do
    pure $ panel ([ infoTitle nodeType ]
                   <> (map (\info -> H.p {} [H.text info]) $ docOf nodeType)
                 )
                 (H.div {} [])
    where
      infoTitle :: NodeType -> R.Element
      infoTitle nt = H.div { style: {margin: "10px"}}
                        [ H.h3 {} [H.text "Documentation about " ]
33 34 35 36
                        , H.h3 {className: GT.fldr nt true} 
                          [ H.span {className: "font-family-theme mx-1"} 
                            [ H.text $ show nt ] 
                          ]
37
                        ]
38 39 40 41 42 43 44 45 46 47 48 49 50

-- | TODO add documentation of all NodeType
docOf :: NodeType -> Array String
docOf GT.NodeUser = [ "This account is personal"
                    , "See the instances terms of uses."
                    ]
docOf GT.FolderPrivate = ["This folder and its children are private only."]
docOf GT.FolderPublic  = ["Soon, you will be able to build public folders to share your work with the world!"]
docOf GT.FolderShared  = ["Soon, you will be able to build teams folders to share your work"]
docOf nodeType         = ["More information on " <> show nodeType]