Commit d711e6ce authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge branch '288-dev-folders-for-all-sessions' of...

Merge branch '288-dev-folders-for-all-sessions' of ssh://gitlab.iscpif.fr:20022/gargantext/purescript-gargantext into dev-merge
parents fec34bf1 33365574
......@@ -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(..))
......@@ -12,12 +11,12 @@ import Gargantext.Components.Lang (LandingLang(..))
import Gargantext.Components.Lang.Landing.EnUS as En
import Gargantext.Components.Lang.Landing.FrFR as Fr
import Gargantext.Components.Nodes.Home.Public (renderPublic)
import Gargantext.Ends (Backend(..))
import Gargantext.License (license)
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 +90,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 +134,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"} [ H.table {} folders ]
, H.h1 {} [H.text "Welcome!"]
, H.h2 {} [H.text "For easy start, just watch the tutorials"]
, summary
......@@ -162,6 +159,13 @@ 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, username, backend: (Backend {name})}) =
H.tr {} [
H.div { className: "d-flex justify-content-center" } [ H.text (username <> "@" <> name) ]
, H.div {} [ 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