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 ...@@ -3,7 +3,6 @@ module Gargantext.Components.Nodes.Home where
import Gargantext.Prelude 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 Gargantext.Components.Data.Landing (BlockText(..), BlockTexts(..), Button(..), LandingData(..)) import Gargantext.Components.Data.Landing (BlockText(..), BlockTexts(..), Button(..), LandingData(..))
...@@ -17,7 +16,6 @@ import Gargantext.Sessions (Sessions) ...@@ -17,7 +16,6 @@ import Gargantext.Sessions (Sessions)
import Gargantext.Sessions as Sessions import Gargantext.Sessions as Sessions
import Gargantext.Sessions.Types (Session(..)) 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 as R
import Reactix.DOM.HTML as H import Reactix.DOM.HTML as H
import Routing.Hash (setHash) import Routing.Hash (setHash)
...@@ -91,8 +89,7 @@ joinButtonOrTutorial :: forall e. Sessions -> (e -> Effect Unit) -> R.Element ...@@ -91,8 +89,7 @@ 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
-- sessions is not empty else tutorial {sessions: Sessions.unSessions sessions}
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 =
...@@ -136,17 +133,16 @@ summary = ...@@ -136,17 +133,16 @@ 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 :: R2.Leaf (session :: Session) tutorial :: R2.Leaf (sessions :: Array Session)
tutorial props = R.createElement tutorialCpt props [] tutorial props = R.createElement tutorialCpt props []
tutorialCpt :: R.Component (session :: Session) tutorialCpt :: R.Component (sessions :: Array Session)
tutorialCpt = here.component "tutorial" cpt where tutorialCpt = here.component "tutorial" cpt where
cpt {session: session@(Session {treeId})} _ = do cpt {sessions} _ = do
let nodeId = treeId let folders = makeFolders sessions
pure $ H.div { className: "mx-auto container" } pure $ H.div { className: "mx-auto container" }
[ H.div {className: "d-flex justify-content-center"} [ H.div {className: "d-flex justify-content-center"} folders
[FV.folderView {session, nodeId, backFolder: false}]
, H.h1 {} [H.text "Welcome!"] , 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
...@@ -162,6 +158,10 @@ tutorialCpt = here.component "tutorial" cpt where ...@@ -162,6 +158,10 @@ tutorialCpt = here.component "tutorial" cpt where
H.div { className : "alert " <> class', id: x.id} H.div { className : "alert " <> class', id: x.id}
[ video x.id, H.h4 {} [ H.text x.title ], H.p {} [ H.text x.text ] ] [ 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 :: Array Tuto
startTutos = startTutos =
[ Tuto { title: "The tree is your friend" [ 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