Commit 78875fb9 authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge branch 'feature/toestand-global-state' of...

Merge branch 'feature/toestand-global-state' of ssh://gitlab.iscpif.fr:20022/gargantext/purescript-gargantext into dev-merge
parents 6a0eb4d8 db7bcbe3
......@@ -91,7 +91,7 @@ forestCpt = here.component "forest" cpt where
common = RX.pick props :: Record Common
cp handed' sessions' _ =
pure $ H.div { className: "forest" }
(A.cons (plus handed' showLogin backend) (trees handed' sessions'))
(A.cons (plus handed' showLogin) (trees handed' sessions'))
trees handed' sessions' = (tree handed') <$> unSessions sessions'
tree handed' s@(Session {treeId}) =
treeLoader { forestOpen
......@@ -104,8 +104,8 @@ forestCpt = here.component "forest" cpt where
, session: s
, tasks } []
plus :: Handed -> T.Box Boolean -> T.Box (Maybe Backend) -> R.Element
plus handed showLogin backend = H.div { className: "row" }
plus :: Handed -> T.Box Boolean -> R.Element
plus handed showLogin = H.div { className: "row" }
[ H.button { className: buttonClass
, on: { click }
, title }
......
......@@ -102,20 +102,18 @@ treeCpt = here.component "tree" cpt where
cpt p@{ session, tree: NTree (LNode { id, name, nodeType }) children } _ = do
setPopoverRef <- R.useRef Nothing
folderOpen <- T2.useMemberBox nodeId p.forestOpen
open <- T.useLive T.unequal folderOpen
pure $ H.ul { className: ulClass }
[ H.div { className: divClass } -- TODO: naughty div should not be in a ul
folderOpen' <- T.useLive T.unequal folderOpen
pure $ H.ul { className: ulClass <> " " <> handedClass }
[ H.li { className: childrenClass children }
[ nodeSpan (nsprops { folderOpen, name, id, nodeType, setPopoverRef, isLeaf })
(renderChildren open)
]
(renderChildren folderOpen')
]
]
where
isLeaf = A.null children
nodeId = mkNodeId session id
ulClass = switchHanded "ml" "mr" p.handed <> "-auto tree"
divClass = switchHanded "left" "right" p.handed <> "handed"
handedClass = switchHanded "left" "right" p.handed <> "handed"
children' = A.sortWith fTreeID pubChildren
pubChildren = if isPublic nodeType then map (map pub) children else children
renderChildren false = []
......
......@@ -59,11 +59,10 @@ routerCpt = here.component "router" cpt where
let sessionProps sId = Record.merge { session, sessionId: sId } props
let sessionNodeProps sId nId = Record.merge { nodeId: nId } $ sessionProps sId
showLogin <- T.useLive T.unequal boxes.showLogin
route' <- T.useLive T.unequal boxes.route
pure $ R.fragment
[ if showLogin then login' boxes else H.div {} []
[ loginModal { boxes } []
, case route' of
GR.Annuaire s n -> annuaire (sessionNodeProps s n) []
GR.ContactPage s a n -> contact (Record.merge { annuaireId: a } $ sessionNodeProps s n) []
......@@ -88,6 +87,22 @@ routerCpt = here.component "router" cpt where
GR.UserPage s n -> user (sessionNodeProps s n) []
]
type LoginModalProps = (
boxes :: Boxes
)
loginModal :: R2.Component LoginModalProps
loginModal = R.createElement loginModalCpt
loginModalCpt :: R.Component LoginModalProps
loginModalCpt = here.component "loginModal" cpt
where
cpt { boxes: boxes@{ showLogin } } _ = do
showLogin' <- T.useLive T.unequal showLogin
pure $ if showLogin' then login' boxes else H.div {} []
forested :: R2.Component Props
forested = R.createElement forestedCpt
......
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