Commit 38e66a93 authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge remote-tracking branch 'origin/dev-552-home-instances-blocks-adding-logout-btn' into dev

parents baaea6e3 a9db7534
module Gargantext.Components.Nodes.Home module Gargantext.Components.Nodes.Home
( Action(..) ( HomeAction(..)
, HomeProps , HomeProps
, State(..) , State(..)
, Tuto(..) , Tuto(..)
...@@ -18,7 +18,7 @@ module Gargantext.Components.Nodes.Home ...@@ -18,7 +18,7 @@ module Gargantext.Components.Nodes.Home
, jumboTitle , jumboTitle
, langLandingData , langLandingData
, license , license
, performAction , performHomeAction
, playTutos , playTutos
, startTutos , startTutos
, summary , summary
...@@ -36,13 +36,14 @@ import Data.Newtype (class Newtype) ...@@ -36,13 +36,14 @@ import Data.Newtype (class Newtype)
import Effect (Effect) import Effect (Effect)
import Gargantext.Components.App.Store (Boxes) import Gargantext.Components.App.Store (Boxes)
import Gargantext.Components.Bootstrap as B import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (ComponentStatus(..), Elevation(..), ModalSizing(..), Position(..), TooltipPosition(..), Variant(..))
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.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.Config as Config import Gargantext.Config as Config
import Gargantext.Sessions (Sessions) import Gargantext.Sessions (Session(..), Sessions, Action(Logout), unSessions)
import Gargantext.Sessions as Sessions import Gargantext.Sessions as Sessions
import Gargantext.Sessions.Types (Session(..), cleanBackendUrl) import Gargantext.Sessions.Types (Session(..), cleanBackendUrl)
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
...@@ -51,6 +52,9 @@ import Reactix.DOM.HTML as H ...@@ -51,6 +52,9 @@ import Reactix.DOM.HTML as H
import Routing.Hash (setHash) import Routing.Hash (setHash)
import Toestand as T import Toestand as T
import Effect.Console (log)
here :: R2.Here here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Home" here = R2.here "Gargantext.Components.Nodes.Home"
...@@ -61,17 +65,17 @@ derive instance Newtype State _ ...@@ -61,17 +65,17 @@ derive instance Newtype State _
initialState :: State initialState :: State
initialState = State { userName: "", password: "" } initialState = State { userName: "", password: "" }
data Action data HomeAction
= Documentation = Documentation
| Enter | Enter
| Login | Login
| SignUp | SignUp
performAction :: Action -> Effect Unit performHomeAction :: HomeAction -> Effect Unit
performAction Documentation = pure unit performHomeAction Documentation = pure unit
performAction Enter = void $ setHash "/search" performHomeAction Enter = void $ setHash "/search"
performAction Login = void $ setHash "/login" performHomeAction Login = void $ setHash "/login"
performAction SignUp = pure unit performHomeAction SignUp = pure unit
langLandingData :: LandingLang -> LandingData langLandingData :: LandingLang -> LandingData
langLandingData LL_FR = Fr.landingData langLandingData LL_FR = Fr.landingData
...@@ -226,7 +230,7 @@ tutorial :: R2.Leaf TutorialProps ...@@ -226,7 +230,7 @@ tutorial :: R2.Leaf TutorialProps
tutorial = R2.leaf tutorialCpt tutorial = R2.leaf tutorialCpt
tutorialCpt :: R.Component TutorialProps tutorialCpt :: R.Component TutorialProps
tutorialCpt = here.component "tutorial" cpt where tutorialCpt = here.component "tutorial" cpt where
cpt { sessions } _ = do cpt { boxes, sessions } _ = do
pure $ pure $
...@@ -249,6 +253,9 @@ tutorialCpt = here.component "tutorial" cpt where ...@@ -249,6 +253,9 @@ tutorialCpt = here.component "tutorial" cpt where
[ 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 ] ]
-} -}
onSignOutClick session = void $ Sessions.change (Logout session) boxes.sessions
makeFolders :: Array Session -> Array R.Element makeFolders :: Array Session -> Array R.Element
makeFolders s = sessionToFolder <$> s makeFolders s = sessionToFolder <$> s
where where
...@@ -266,14 +273,33 @@ tutorialCpt = here.component "tutorial" cpt where ...@@ -266,14 +273,33 @@ tutorialCpt = here.component "tutorial" cpt where
B.wad B.wad
[ "d-flex", "align-items-center" ] [ "d-flex", "align-items-center" ]
[ [
B.icon B.wad
{ name: "user" } [ "text-left", "w-10/12" ]
, [
B.wad_ B.icon
[ "virtual-space", "w-1" ] { name: "user", className: "pr-1" }
,
B.span_ $
username <> "@" <> cleanBackendUrl backend
]
, ,
B.span_ $ B.wad
username <> "@" <> cleanBackendUrl backend [ "text-right", "w-2/12" ]
[
B.tooltipContainer
{ position: TooltipPosition Top
, delayShow: 600
, tooltipSlot:
B.span_ "Log out"
, defaultSlot:
B.iconButton
{ name: "sign-out"
, callback: \_ -> onSignOutClick session
, elevation: Level2
, className: "text-light"
}
}
]
] ]
] ]
, ,
...@@ -286,6 +312,7 @@ tutorialCpt = here.component "tutorial" cpt where ...@@ -286,6 +312,7 @@ tutorialCpt = here.component "tutorial" cpt where
} }
] ]
] ]
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