Commit 72f16c5a authored by Karen Konou's avatar Karen Konou

Home: show folders for all sessions

parent 614a6e1b
......@@ -3,7 +3,6 @@ module Gargantext.Components.Nodes.Home where
import Gargantext.Prelude
import Data.Array as Array
import Data.Maybe (fromJust)
import Data.Newtype (class Newtype)
import Effect (Effect)
import Gargantext.Components.Data.Landing (BlockText(..), BlockTexts(..), Button(..), LandingData(..))
......@@ -17,7 +16,6 @@ import Gargantext.Sessions (Sessions)
import Gargantext.Sessions as Sessions
import Gargantext.Sessions.Types (Session(..))
import Gargantext.Utils.Reactix as R2
import Partial.Unsafe (unsafePartial)
import Reactix as R
import Reactix.DOM.HTML as H
import Routing.Hash (setHash)
......@@ -91,8 +89,7 @@ joinButtonOrTutorial :: forall e. Sessions -> (e -> Effect Unit) -> R.Element
joinButtonOrTutorial sessions click =
if Sessions.null sessions
then joinButton click
-- sessions is not empty
else tutorial {session: unsafePartial $ fromJust $ Array.head $ Sessions.unSessions sessions}
else tutorial {sessions: Sessions.unSessions sessions}
joinButton :: forall e. (e -> Effect Unit) -> R.Element
joinButton click =
......@@ -136,17 +133,16 @@ summary =
, H.ol {} (map toSummary tutos) ] ]
toSummary (Tuto x) = H.li {} [ H.a {href: "#" <> x.id} [ H.text x.title ]]
tutorial :: R2.Leaf (session :: Session)
tutorial :: R2.Leaf (sessions :: Array Session)
tutorial props = R.createElement tutorialCpt props []
tutorialCpt :: R.Component (session :: Session)
tutorialCpt :: R.Component (sessions :: Array Session)
tutorialCpt = here.component "tutorial" cpt where
cpt {session: session@(Session {treeId})} _ = do
let nodeId = treeId
cpt {sessions} _ = do
let folders = makeFolders sessions
pure $ H.div { className: "mx-auto container" }
[ H.div {className: "d-flex justify-content-center"}
[FV.folderView {session, nodeId, backFolder: false}]
[ H.div {className: "d-flex justify-content-center"} folders
, H.h1 {} [H.text "Welcome!"]
, H.h2 {} [H.text "For easy start, just watch the tutorials"]
, summary
......@@ -162,6 +158,10 @@ tutorialCpt = here.component "tutorial" cpt where
H.div { className : "alert " <> class', id: x.id}
[ video x.id, H.h4 {} [ H.text x.title ], H.p {} [ H.text x.text ] ]
makeFolders :: Array Session -> Array R.Element
makeFolders s = sessionToFolder <$> s where
sessionToFolder session@(Session {treeId}) = FV.folderView {session, nodeId: treeId, backFolder: false}
startTutos :: Array Tuto
startTutos =
[ Tuto { title: "The tree is your friend"
......
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