Commit 2e7f246c authored by Karen Konou's avatar Karen Konou

Home: show folder view when logged in

parent e8a6be94
module Gargantext.Components.Nodes.Home where module Gargantext.Components.Nodes.Home where
import Gargantext.Prelude
import Data.Array as Array import Data.Array as Array
import Data.Maybe (fromJust)
import Data.Newtype (class Newtype) import Data.Newtype (class Newtype)
import Effect (Effect) import Effect (Effect)
import Reactix as R
import Reactix.DOM.HTML as H
import Routing.Hash (setHash)
import Toestand as T
import Gargantext.Components.Data.Landing (BlockText(..), BlockTexts(..), Button(..), LandingData(..)) import Gargantext.Components.Data.Landing (BlockText(..), BlockTexts(..), Button(..), LandingData(..))
import Gargantext.Components.FolderView as FV
import Gargantext.Components.Lang (LandingLang(..)) import Gargantext.Components.Lang (LandingLang(..))
import Gargantext.Components.Lang.Landing.EnUS as En import Gargantext.Components.Lang.Landing.EnUS as En
import Gargantext.Components.Lang.Landing.FrFR as Fr import Gargantext.Components.Lang.Landing.FrFR as Fr
import Gargantext.Components.Nodes.Home.Public (renderPublic) import Gargantext.Components.Nodes.Home.Public (renderPublic)
import Gargantext.License (license) import Gargantext.License (license)
import Gargantext.Prelude -- (Unit, map, pure, unit, void, ($), (<>), (*>))
import Gargantext.Sessions (Sessions) import Gargantext.Sessions (Sessions)
import Gargantext.Sessions as Sessions import Gargantext.Sessions as Sessions
import Gargantext.Sessions.Types (Session(..))
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Partial.Unsafe (unsafePartial)
import Reactix as R
import Reactix.DOM.HTML as H
import Routing.Hash (setHash)
import Toestand as T
here :: R2.Here here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Home" here = R2.here "Gargantext.Components.Nodes.Home"
...@@ -87,7 +91,8 @@ joinButtonOrTutorial :: forall e. Sessions -> (e -> Effect Unit) -> R.Element ...@@ -87,7 +91,8 @@ joinButtonOrTutorial :: forall e. Sessions -> (e -> Effect Unit) -> R.Element
joinButtonOrTutorial sessions click = joinButtonOrTutorial sessions click =
if Sessions.null sessions if Sessions.null sessions
then joinButton click then joinButton click
else tutorial -- sessions is not empty
else tutorial {session: unsafePartial $ fromJust $ Array.head $ Sessions.unSessions sessions}
joinButton :: forall e. (e -> Effect Unit) -> R.Element joinButton :: forall e. (e -> Effect Unit) -> R.Element
joinButton click = joinButton click =
...@@ -131,10 +136,17 @@ summary = ...@@ -131,10 +136,17 @@ summary =
, H.ol {} (map toSummary tutos) ] ] , H.ol {} (map toSummary tutos) ] ]
toSummary (Tuto x) = H.li {} [ H.a {href: "#" <> x.id} [ H.text x.title ]] toSummary (Tuto x) = H.li {} [ H.a {href: "#" <> x.id} [ H.text x.title ]]
tutorial :: R.Element tutorial :: R2.Leaf (session :: Session)
tutorial = tutorial props = R.createElement tutorialCpt props []
H.div { className: "mx-auto container" }
[ H.h1 {} [H.text "Welcome!"] tutorialCpt :: R.Component (session :: Session)
tutorialCpt = here.component "tutorial" cpt where
cpt {session: session@(Session {treeId})} _ = do
let nodeId = treeId
pure $ H.div { className: "mx-auto container" }
[ FV.folderViewLoad {session, nodeId}
, H.h1 {} [H.text "Welcome!"]
, H.h2 {} [H.text "For easy start, just watch the tutorials"] , H.h2 {} [H.text "For easy start, just watch the tutorials"]
, summary , summary
, H.h3 {} [H.text "Tutorial resources"] , H.h3 {} [H.text "Tutorial resources"]
......
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