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,23 +136,30 @@ summary = ...@@ -131,23 +136,30 @@ 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)
, H.h2 {} [H.text "For easy start, just watch the tutorials"] tutorialCpt = here.component "tutorial" cpt where
, summary cpt {session: session@(Session {treeId})} _ = do
, H.h3 {} [H.text "Tutorial resources"] let nodeId = treeId
, section "How to start?" "alert-info" startTutos
-- , section "How to play?" "alert-warning" playTutos pure $ H.div { className: "mx-auto container" }
-- , section "How to master?" "alert-danger" expertTutos [ FV.folderViewLoad {session, nodeId}
] , H.h1 {} [H.text "Welcome!"]
where , H.h2 {} [H.text "For easy start, just watch the tutorials"]
section name class' tutos = , summary
H.div {} $ Array.cons (H.h4 {} [ H.text name ]) (map (makeTuto class') tutos) , H.h3 {} [H.text "Tutorial resources"]
makeTuto class' (Tuto x) = , section "How to start?" "alert-info" startTutos
H.div { className : "alert " <> class', id: x.id} -- , section "How to play?" "alert-warning" playTutos
[ video x.id, H.h4 {} [ H.text x.title ], H.p {} [ H.text x.text ] ] -- , section "How to master?" "alert-danger" expertTutos
]
where
section name class' tutos =
H.div {} $ Array.cons (H.h4 {} [ H.text name ]) (map (makeTuto class') tutos)
makeTuto class' (Tuto x) =
H.div { className : "alert " <> class', id: x.id}
[ video x.id, H.h4 {} [ H.text x.title ], H.p {} [ H.text x.text ] ]
startTutos :: Array Tuto startTutos :: Array Tuto
startTutos = startTutos =
......
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