Documentation.purs 1.36 KB
Newer Older
1
module Gargantext.Components.Forest.Tree.Node.Action.Documentation where
2 3 4 5 6 7

import Gargantext.Prelude (map, pure, show, ($), (<>))
import Gargantext.Types (NodeType)
import Gargantext.Types as GT
import Reactix as R
import Reactix.DOM.HTML as H
8
import Gargantext.Components.Forest.Tree.Node.Tools (panel)
9 10 11 12

-- | Action: Show Documentation
actionDoc :: NodeType -> R.Hooks R.Element
actionDoc nodeType =
13 14 15 16
  pure $ panel ( [ infoTitle nodeType ]
                 <> (map (\info -> H.p {} [H.text info]) $ docOf nodeType)
               )
               ( H.div {} [])
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
  where
    infoTitle :: NodeType -> R.Element
    infoTitle nt = H.div { style: {margin: "10px"}}
                         [ H.h3 {} [H.text "Documentation about " ]
                         , H.h3 {className: GT.fldr nt true} [ H.text $ show nt ]
                         ]

-- | 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]