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

[FIX] Forest icon and session shown to NodeUser/root of Tree.

parent 8e0b5f8d
module Gargantext.Components.Forest where module Gargantext.Components.Forest where
import Prelude (const, show) import Prelude (const)
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as H import Reactix.DOM.HTML as H
...@@ -14,7 +14,8 @@ type Props = ...@@ -14,7 +14,8 @@ type Props =
( sessions :: Sessions ( sessions :: Sessions
, route :: AppRoute , route :: AppRoute
, frontends :: Frontends , frontends :: Frontends
, showLogin :: R2.Setter Boolean ) , showLogin :: R2.Setter Boolean
)
forest :: Record Props -> R.Element forest :: Record Props -> R.Element
forest props = R.createElement forestCpt props [] forest props = R.createElement forestCpt props []
...@@ -29,15 +30,17 @@ forestCpt = R.staticComponent "G.C.Forest.forest" cpt where ...@@ -29,15 +30,17 @@ forestCpt = R.staticComponent "G.C.Forest.forest" cpt where
Nothing -> R.fragment [] Nothing -> R.fragment []
Just s@(Session {treeId}) -> Just s@(Session {treeId}) ->
R.fragment R.fragment
[ H.text (show s) [ treeView { root: treeId
, treeView { root: treeId
, frontends , frontends
, mCurrentRoute: Just route , mCurrentRoute: Just route
, session: s } , session: s }
] ]
plus :: R2.Setter Boolean -> R.Element plus :: R2.Setter Boolean -> R.Element
plus showLogin = H.button {on: {click}} [ H.text "+" ] plus showLogin = H.button {on: {click}}
[ H.i { className: "glyphicon glyphicon-log-in"}
[]
]
where where
click _ = do click _ = do
showLogin (const true) showLogin (const true)
...@@ -70,7 +70,8 @@ filterNTree p (NTree x ary) = ...@@ -70,7 +70,8 @@ filterNTree p (NTree x ary) =
newtype LNode = LNode { id :: ID newtype LNode = LNode { id :: ID
, name :: Name , name :: Name
, nodeType :: NodeType} , nodeType :: NodeType
}
derive instance newtypeLNode :: Newtype LNode _ derive instance newtypeLNode :: Newtype LNode _
...@@ -230,12 +231,14 @@ nodeMainSpan d p folderOpen session frontends = R.createElement el p [] ...@@ -230,12 +231,14 @@ nodeMainSpan d p folderOpen session frontends = R.createElement el p []
, H.a { href: (url frontends (NodePath nodeType (Just id))) , H.a { href: (url frontends (NodePath nodeType (Just id)))
, style: {marginLeft: "22px"} , style: {marginLeft: "22px"}
} }
[ nodeText {isSelected: (mCorpusId mCurrentRoute) == (Just id), name} ] [ nodeText {isSelected: (mCorpusId mCurrentRoute) == (Just id), name:name'} ]
, popOverIcon popupOpen , popOverIcon popupOpen
, nodePopupView d {id, name} popupOpen , nodePopupView d {id, name} popupOpen
, createNodeView d {id, name} popupOpen , createNodeView d {id, name} popupOpen
, fileTypeView d {id} droppedFile isDragOver , fileTypeView d {id} droppedFile isDragOver
] ]
where
name' = if nodeType == NodeUser then show session else name
folderIcon folderOpen'@(open /\ _) = folderIcon folderOpen'@(open /\ _) =
H.a {onClick: R2.effToggler folderOpen'} H.a {onClick: R2.effToggler folderOpen'}
[ H.i {className: fldr open} [] ] [ H.i {className: fldr open} [] ]
......
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