Commit fb7fbcbe authored by arturo's avatar arturo

[layout] Modal reactivity for "Close" action

* #427
parent 21fc4e22
module Gargantext.Components.Bootstrap.BaseModal (baseModal) where module Gargantext.Components.Bootstrap.BaseModal
(baseModal
, showModal, hideModal
) where
import Gargantext.Prelude import Gargantext.Prelude
...@@ -109,12 +112,14 @@ component = R.hooksComponent componentName cpt where ...@@ -109,12 +112,14 @@ component = R.hooksComponent componentName cpt where
id = componentName <> "-" <> uuid id = componentName <> "-" <> uuid
selector = "#" <> id
-- | Hooks -- | Hooks
-- | -- |
useUpdateEffect1' isVisible useUpdateEffect1' isVisible
if isVisible if isVisible
then showModal window $ "#" <> id then showModal window selector
else hideModal window $ "#" <> id else hideModal window selector
-- | Behaviors -- | Behaviors
-- | -- |
......
This diff is collapsed.
...@@ -42,7 +42,7 @@ nodePopupViewCpt = here.component "nodePopupView" cpt where ...@@ -42,7 +42,7 @@ nodePopupViewCpt = here.component "nodePopupView" cpt where
] ]
] ]
closePopover props = props.onPopoverClose <<< R.unsafeEventTarget closeBox props = props.onPopoverClose <<< R.unsafeEventTarget
panelHeading props@{ nodeType } = panelHeading props@{ nodeType } =
H.div { className: "popup-container__header card-header" } H.div { className: "popup-container__header card-header" }
...@@ -53,5 +53,5 @@ nodePopupViewCpt = here.component "nodePopupView" cpt where ...@@ -53,5 +53,5 @@ nodePopupViewCpt = here.component "nodePopupView" cpt where
, H.div { className: "col-6" } , H.div { className: "col-6" }
[ H.span { className: "text-primary center" } [ H.text props.name ] ] [ H.span { className: "text-primary center" } [ H.text props.name ] ]
, H.div { className: "col-1" } , H.div { className: "col-1" }
[ H.a { type: "button", on: { click: closePopover props }, title: "Close" [ H.a { type: "button", on: { click: closeBox props }, title: "Close"
, className: glyphicon "window-close" } [] ]]] , className: glyphicon "window-close" } [] ]]]
...@@ -7,7 +7,6 @@ import Data.Array as Array ...@@ -7,7 +7,6 @@ import Data.Array as Array
import Data.Maybe (Maybe(..), isJust) import Data.Maybe (Maybe(..), isJust)
import Data.Traversable (intercalate, traverse, traverse_) import Data.Traversable (intercalate, traverse, traverse_)
import Data.Tuple.Nested ((/\)) import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Effect.Aff (Aff) import Effect.Aff (Aff)
import Effect.Class (liftEffect) import Effect.Class (liftEffect)
import Gargantext.AsyncTasks as GAT import Gargantext.AsyncTasks as GAT
...@@ -31,13 +30,13 @@ import Gargantext.Components.Forest.Tree.Node.Tools.SubTree.Types (SubTreeOut(.. ...@@ -31,13 +30,13 @@ import Gargantext.Components.Forest.Tree.Node.Tools.SubTree.Types (SubTreeOut(..
import Gargantext.Config.REST (AffRESTError, logRESTError) import Gargantext.Config.REST (AffRESTError, logRESTError)
import Gargantext.Config.Utils (handleRESTError) import Gargantext.Config.Utils (handleRESTError)
import Gargantext.Ends (Frontends) import Gargantext.Ends (Frontends)
import Gargantext.Hooks.Loader (useLoader, useLoaderEffect) import Gargantext.Hooks.Loader (useLoaderEffect)
import Gargantext.Routes as GR import Gargantext.Routes as GR
import Gargantext.Sessions (Session, get, mkNodeId) import Gargantext.Sessions (Session, get, mkNodeId)
import Gargantext.Sessions.Types (useOpenNodesMemberBox, openNodesInsert, openNodesDelete) import Gargantext.Sessions.Types (useOpenNodesMemberBox, openNodesInsert, openNodesDelete)
import Gargantext.Types (Handed, ID, isPublic, publicize, switchHanded) import Gargantext.Types (Handed, ID, isPublic, publicize)
import Gargantext.Types as GT import Gargantext.Types as GT
import Gargantext.Utils (nbsp, (?)) import Gargantext.Utils ((?))
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2 import Gargantext.Utils.Toestand as T2
import Reactix as R import Reactix as R
...@@ -99,11 +98,13 @@ type ChildLoaderProps = ...@@ -99,11 +98,13 @@ type ChildLoaderProps =
( id :: ID ( id :: ID
, render :: R2.Leaf TreeProps , render :: R2.Leaf TreeProps
, root :: ID , root :: ID
| NodeProps ) | NodeProps
)
type PerformActionProps = type PerformActionProps =
( setPopoverRef :: R.Ref (Maybe (Boolean -> Effect Unit)) ( isBoxVisible :: T.Box Boolean
| PACommon ) | PACommon
)
-- | Loads and renders the tree starting at the given root node id. -- | Loads and renders the tree starting at the given root node id.
treeLoader :: R2.Leaf ( key :: String | LoaderProps ) treeLoader :: R2.Leaf ( key :: String | LoaderProps )
...@@ -163,9 +164,9 @@ treeCpt = here.component "tree" cpt where ...@@ -163,9 +164,9 @@ treeCpt = here.component "tree" cpt where
, session , session
, tree: NTree (LNode { id, name, nodeType }) children } _ = do , tree: NTree (LNode { id, name, nodeType }) children } _ = do
setPopoverRef <- R.useRef Nothing isBoxVisible <- T.useBox false
folderOpen <- useOpenNodesMemberBox nodeId forestOpen folderOpen <- useOpenNodesMemberBox nodeId forestOpen
folderOpen' <- T.useLive T.unequal folderOpen folderOpen' <- T.useLive T.unequal folderOpen
pure $ pure $
...@@ -183,7 +184,7 @@ treeCpt = here.component "tree" cpt where ...@@ -183,7 +184,7 @@ treeCpt = here.component "tree" cpt where
[ [
nodeSpan nodeSpan
{ boxes { boxes
, dispatch: dispatch setPopoverRef , dispatch: dispatch' isBoxVisible
, folderOpen , folderOpen
, frontends , frontends
, id , id
...@@ -193,7 +194,7 @@ treeCpt = here.component "tree" cpt where ...@@ -193,7 +194,7 @@ treeCpt = here.component "tree" cpt where
, reload , reload
, root , root
, session , session
, setPopoverRef , isBoxVisible
} }
<> <>
R2.when (folderOpen') R2.when (folderOpen')
...@@ -213,9 +214,9 @@ treeCpt = here.component "tree" cpt where ...@@ -213,9 +214,9 @@ treeCpt = here.component "tree" cpt where
nodeId = mkNodeId session id nodeId = mkNodeId session id
children' = A.sortWith fTreeID pubChildren children' = A.sortWith fTreeID pubChildren
pubChildren = if isPublic nodeType then map (map pub) children else children pubChildren = if isPublic nodeType then map (map pub) children else children
dispatch setPopoverRef a = performAction a (Record.merge common' spr) where dispatch' isBoxVisible a = performAction a (Record.merge common' extra) where
common' = RecordE.pick p :: Record PACommon common' = RecordE.pick p :: Record PACommon
spr = { setPopoverRef } extra = { isBoxVisible }
pub (LNode n@{ nodeType: t }) = LNode (n { nodeType = publicize t }) pub (LNode n@{ nodeType: t }) = LNode (n { nodeType = publicize t })
...@@ -295,10 +296,10 @@ childLoaderCpt = here.component "childLoader" cpt where ...@@ -295,10 +296,10 @@ childLoaderCpt = here.component "childLoader" cpt where
extra = { root, tree: tree' } extra = { root, tree: tree' }
nodeProps = RecordE.pick p :: Record NodeProps nodeProps = RecordE.pick p :: Record NodeProps
closePopover { setPopoverRef } = closeBox { isBoxVisible } =
liftEffect $ traverse_ (\set -> set false) (R.readRef setPopoverRef) liftEffect $ T.write_ false isBoxVisible
refreshTree p@{ reloadTree } = liftEffect $ T2.reload reloadTree *> closePopover p refreshTree p@{ reloadTree } = liftEffect $ T2.reload reloadTree *> closeBox p
deleteNode' nt p@{ boxes: { forestOpen }, session, tree: (NTree (LNode {id, parent_id}) _) } = do deleteNode' nt p@{ boxes: { forestOpen }, session, tree: (NTree (LNode {id, parent_id}) _) } = do
case nt of case nt of
...@@ -407,6 +408,6 @@ performAction (MoveNode {params}) p = moveNode params ...@@ -407,6 +408,6 @@ performAction (MoveNode {params}) p = moveNode params
performAction (MergeNode {params}) p = mergeNode params p performAction (MergeNode {params}) p = mergeNode params p
performAction (LinkNode { nodeType, params }) p = linkNode nodeType params p performAction (LinkNode { nodeType, params }) p = linkNode nodeType params p
performAction RefreshTree p = refreshTree p performAction RefreshTree p = refreshTree p
performAction ClosePopover p = closePopover p performAction CloseBox p = closeBox p
performAction (DocumentsFromWriteNodes { id }) p = documentsFromWriteNodes id p performAction (DocumentsFromWriteNodes { id }) p = documentsFromWriteNodes id p
performAction NoAction _ = liftEffect $ here.log "[performAction] NoAction" performAction NoAction _ = liftEffect $ here.log "[performAction] NoAction"
...@@ -8,7 +8,6 @@ import Gargantext.Prelude ...@@ -8,7 +8,6 @@ import Gargantext.Prelude
import Data.Array.NonEmpty as NArray import Data.Array.NonEmpty as NArray
import Data.Foldable (intercalate) import Data.Foldable (intercalate)
import Data.Maybe (Maybe(..), maybe) import Data.Maybe (Maybe(..), maybe)
import Data.Nullable (null)
import Data.String.Regex as Regex import Data.String.Regex as Regex
import Data.Symbol (SProxy(..)) import Data.Symbol (SProxy(..))
import Data.Tuple.Nested ((/\)) import Data.Tuple.Nested ((/\))
...@@ -18,7 +17,7 @@ import Effect.Class (liftEffect) ...@@ -18,7 +17,7 @@ import Effect.Class (liftEffect)
import Gargantext.AsyncTasks as GAT import Gargantext.AsyncTasks as GAT
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(..), TooltipEffect(..), Variant(..)) import Gargantext.Components.Bootstrap.Types (ComponentStatus(..), Elevation(..), TooltipEffect(..), Variant(..))
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..)) import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action.Upload (DroppedFile(..), fileTypeView) import Gargantext.Components.Forest.Tree.Node.Action.Upload (DroppedFile(..), fileTypeView)
import Gargantext.Components.Forest.Tree.Node.Action.Upload.Types (FileType(..), UploadFileBlob(..)) import Gargantext.Components.Forest.Tree.Node.Action.Upload.Types (FileType(..), UploadFileBlob(..))
...@@ -31,7 +30,6 @@ import Gargantext.Components.Nodes.Corpus (loadCorpusWithChild) ...@@ -31,7 +30,6 @@ import Gargantext.Components.Nodes.Corpus (loadCorpusWithChild)
import Gargantext.Config.REST (logRESTError) import Gargantext.Config.REST (logRESTError)
import Gargantext.Context.Progress (asyncContext, asyncProgress) import Gargantext.Context.Progress (asyncContext, asyncProgress)
import Gargantext.Ends (Frontends, url) import Gargantext.Ends (Frontends, url)
import Gargantext.Hooks.FirstEffect (useFirstEffect')
import Gargantext.Hooks.Loader (useLoaderEffect) import Gargantext.Hooks.Loader (useLoaderEffect)
import Gargantext.Hooks.Version (Version, useVersion) import Gargantext.Hooks.Version (Version, useVersion)
import Gargantext.Routes as Routes import Gargantext.Routes as Routes
...@@ -39,7 +37,6 @@ import Gargantext.Sessions (Session, sessionId) ...@@ -39,7 +37,6 @@ import Gargantext.Sessions (Session, sessionId)
import Gargantext.Types (ID, Name) import Gargantext.Types (ID, Name)
import Gargantext.Types as GT import Gargantext.Types as GT
import Gargantext.Utils (nbsp, textEllipsisBreak, (?)) import Gargantext.Utils (nbsp, textEllipsisBreak, (?))
import Gargantext.Utils.Popover as Popover
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2 import Gargantext.Utils.Toestand as T2
import React.SyntheticEvent as SE import React.SyntheticEvent as SE
...@@ -47,7 +44,6 @@ import Reactix as R ...@@ -47,7 +44,6 @@ import Reactix as R
import Reactix.DOM.HTML as H import Reactix.DOM.HTML as H
import Record as Record import Record as Record
import Toestand as T import Toestand as T
import Unsafe.Coerce (unsafeCoerce)
-- (?) never been able to properly declare PureScript Regex... -- (?) never been able to properly declare PureScript Regex...
foreign import nodeUserRegexp :: Regex.Regex foreign import nodeUserRegexp :: Regex.Regex
...@@ -68,7 +64,7 @@ type NodeSpanProps = ...@@ -68,7 +64,7 @@ type NodeSpanProps =
, reload :: T2.ReloadS , reload :: T2.ReloadS
, root :: ID , root :: ID
, session :: Session , session :: Session
, setPopoverRef :: R.Ref (Maybe (Boolean -> Effect Unit)) , isBoxVisible :: T.Box Boolean
) )
type IsLeaf = Boolean type IsLeaf = Boolean
...@@ -92,7 +88,7 @@ nodeSpanCpt = here.component "nodeSpan" cpt ...@@ -92,7 +88,7 @@ nodeSpanCpt = here.component "nodeSpan" cpt
, nodeType , nodeType
, reload , reload
, session , session
, setPopoverRef , isBoxVisible
} _ = do } _ = do
-- States -- States
...@@ -108,8 +104,6 @@ nodeSpanCpt = here.component "nodeSpan" cpt ...@@ -108,8 +104,6 @@ nodeSpanCpt = here.component "nodeSpan" cpt
folderOpen' <- R2.useLive' folderOpen folderOpen' <- R2.useLive' folderOpen
isSettingsModalVisible <- T.useBox false
-- tasks' <- T.read tasks -- tasks' <- T.read tasks
-- Computed -- Computed
...@@ -198,18 +192,10 @@ nodeSpanCpt = here.component "nodeSpan" cpt ...@@ -198,18 +192,10 @@ nodeSpanCpt = here.component "nodeSpan" cpt
-- Nothing -> pure unit -- Nothing -> pure unit
-- T2.reload reloadRoot -- T2.reload reloadRoot
onPopoverClose ::
Popover.PopoverRef
-> Effect Unit
onPopoverClose ref = Popover.setOpen ref false
-- NOTE Don't toggle tree if it is not selected -- NOTE Don't toggle tree if it is not selected
onNodeLinkClick :: Unit -> Effect Unit onNodeLinkClick :: Unit -> Effect Unit
onNodeLinkClick _ = when (not isSelected) (T.write_ true folderOpen) onNodeLinkClick _ = when (not isSelected) (T.write_ true folderOpen)
toggleSettingsModal :: Unit -> Effect Unit
toggleSettingsModal _ = T.modify_ (not) isSettingsModalVisible
-- Hooks -- Hooks
mVersion <- useVersion $ nodeType == GT.NodeUser ? mVersion <- useVersion $ nodeType == GT.NodeUser ?
...@@ -320,7 +306,7 @@ nodeSpanCpt = here.component "nodeSpan" cpt ...@@ -320,7 +306,7 @@ nodeSpanCpt = here.component "nodeSpan" cpt
B.iconButton B.iconButton
{ name: "cog" { name: "cog"
, className: "mainleaf__settings-icon" , className: "mainleaf__settings-icon"
, callback: toggleSettingsModal , callback: \_ -> T.write_ true isBoxVisible
, title: , title:
"Each node of the Tree can perform some actions.\n" "Each node of the Tree can perform some actions.\n"
<> "Click here to execute one of them." <> "Click here to execute one of them."
...@@ -346,7 +332,7 @@ nodeSpanCpt = here.component "nodeSpan" cpt ...@@ -346,7 +332,7 @@ nodeSpanCpt = here.component "nodeSpan" cpt
-- // Modals // -- // Modals //
B.baseModal B.baseModal
{ isVisibleBox: isSettingsModalVisible { isVisibleBox: isBoxVisible
, noBody: true , noBody: true
, noHeader: true , noHeader: true
, modalClassName: "forest-tree-node-modal" , modalClassName: "forest-tree-node-modal"
...@@ -358,7 +344,7 @@ nodeSpanCpt = here.component "nodeSpan" cpt ...@@ -358,7 +344,7 @@ nodeSpanCpt = here.component "nodeSpan" cpt
, id , id
, name , name
, nodeType , nodeType
, onPopoverClose: \_ -> toggleSettingsModal unit , closeCallback: \_ -> T.write_ false isBoxVisible
, session , session
} }
] ]
......
...@@ -46,7 +46,7 @@ icon (UploadFile _ _ _ _ _ _) = glyphiconNodeAction Upload ...@@ -46,7 +46,7 @@ icon (UploadFile _ _ _ _ _ _) = glyphiconNodeAction Upload
icon (UploadArbitraryFile _ _ _ _ ) = glyphiconNodeAction Upload icon (UploadArbitraryFile _ _ _ _ ) = glyphiconNodeAction Upload
icon UploadFrameCalc = glyphiconNodeAction Upload icon UploadFrameCalc = glyphiconNodeAction Upload
icon RefreshTree = glyphiconNodeAction Refresh icon RefreshTree = glyphiconNodeAction Refresh
icon ClosePopover = glyphiconNodeAction CloseNodePopover icon CloseBox = glyphiconNodeAction CloseNodePopover
icon DownloadNode = glyphiconNodeAction Download icon DownloadNode = glyphiconNodeAction Download
icon (MoveNode _ ) = glyphiconNodeAction (Move { subTreeParams : SubTreeParams {showtypes:[], valitypes:[] }}) icon (MoveNode _ ) = glyphiconNodeAction (Move { subTreeParams : SubTreeParams {showtypes:[], valitypes:[] }})
icon (MergeNode _ ) = glyphiconNodeAction (Merge { subTreeParams : SubTreeParams {showtypes:[], valitypes:[] }}) icon (MergeNode _ ) = glyphiconNodeAction (Merge { subTreeParams : SubTreeParams {showtypes:[], valitypes:[] }})
...@@ -70,7 +70,7 @@ text (UploadFile _ _ _ _ _ _) = "Upload File !" ...@@ -70,7 +70,7 @@ text (UploadFile _ _ _ _ _ _) = "Upload File !"
text (UploadArbitraryFile _ _ _ _) = "Upload arbitrary file !" text (UploadArbitraryFile _ _ _ _) = "Upload arbitrary file !"
text UploadFrameCalc = "Upload frame calc" text UploadFrameCalc = "Upload frame calc"
text RefreshTree = "Refresh Tree !" text RefreshTree = "Refresh Tree !"
text ClosePopover = "Close Popover !" text CloseBox = "Close Box !"
text DownloadNode = "Download !" text DownloadNode = "Download !"
text (MoveNode _ ) = "Move !" text (MoveNode _ ) = "Move !"
text (MergeNode _ ) = "Merge !" text (MergeNode _ ) = "Merge !"
...@@ -78,4 +78,3 @@ text (LinkNode _ ) = "Link !" ...@@ -78,4 +78,3 @@ text (LinkNode _ ) = "Link !"
text (DocumentsFromWriteNodes _ ) = "Documents from Write Nodes !" text (DocumentsFromWriteNodes _ ) = "Documents from Write Nodes !"
text NoAction = "No Action" text NoAction = "No Action"
----------------------------------------------------------------------- -----------------------------------------------------------------------
...@@ -54,7 +54,7 @@ actionSearchCpt = here.component "actionSearch" cpt ...@@ -54,7 +54,7 @@ actionSearchCpt = here.component "actionSearch" cpt
searchOn dispatch' task = do searchOn dispatch' task = do
_ <- launchAff $ dispatch' (DoSearch task) _ <- launchAff $ dispatch' (DoSearch task)
-- close popup -- close popup
_ <- launchAff $ dispatch' ClosePopover _ <- launchAff $ dispatch' CloseBox
-- TODO -- TODO
--snd p $ const Nothing --snd p $ const Nothing
pure unit pure unit
...@@ -21,7 +21,7 @@ data Action = AddNode String GT.NodeType ...@@ -21,7 +21,7 @@ data Action = AddNode String GT.NodeType
| UploadFrameCalc | UploadFrameCalc
| DownloadNode | DownloadNode
| RefreshTree | RefreshTree
| ClosePopover | CloseBox
| ShareTeam String | ShareTeam String
| AddContact AddContactParams | AddContact AddContactParams
...@@ -48,7 +48,7 @@ instance Eq Action where ...@@ -48,7 +48,7 @@ instance Eq Action where
eq UploadFrameCalc UploadFrameCalc = true eq UploadFrameCalc UploadFrameCalc = true
eq DownloadNode DownloadNode = true eq DownloadNode DownloadNode = true
eq RefreshTree RefreshTree = true eq RefreshTree RefreshTree = true
eq ClosePopover ClosePopover = true eq CloseBox CloseBox = true
eq (ShareTeam s1) (ShareTeam s2) = eq s1 s2 eq (ShareTeam s1) (ShareTeam s2) = eq s1 s2
eq (AddContact ac1) (AddContact ac2) = eq ac1 ac2 eq (AddContact ac1) (AddContact ac2) = eq ac1 ac2
eq (SharePublic p1) (SharePublic p2) = eq p1 p2 eq (SharePublic p1) (SharePublic p2) = eq p1 p2
...@@ -72,7 +72,7 @@ instance Show Action where ...@@ -72,7 +72,7 @@ instance Show Action where
show (UploadArbitraryFile _ _ _ _) = "UploadArbitraryFile" show (UploadArbitraryFile _ _ _ _) = "UploadArbitraryFile"
show UploadFrameCalc = "UploadFrameCalc" show UploadFrameCalc = "UploadFrameCalc"
show RefreshTree = "RefreshTree" show RefreshTree = "RefreshTree"
show ClosePopover = "ClosePopover" show CloseBox = "CloseBox"
show DownloadNode = "Download" show DownloadNode = "Download"
show (MoveNode _ ) = "MoveNode" show (MoveNode _ ) = "MoveNode"
show (MergeNode _ ) = "MergeNode" show (MergeNode _ ) = "MergeNode"
......
...@@ -86,7 +86,7 @@ updateGraphCpt = here.component "updateGraph" cpt where ...@@ -86,7 +86,7 @@ updateGraphCpt = here.component "updateGraph" cpt where
let let
callback :: Action -> Aff Unit callback :: Action -> Aff Unit
callback = dispatch >=> \_ -> dispatch ClosePopover callback = dispatch >=> \_ -> dispatch CloseBox
pure $ panel [ H.text "Show subjects with Order1 or concepts with Order2 ?" pure $ panel [ H.text "Show subjects with Order1 or concepts with Order2 ?"
, formChoiceSafe { items: [Order1, Order2] , formChoiceSafe { items: [Order1, Order2]
...@@ -153,7 +153,7 @@ updatePhyloCpt = here.component "updatePhylo" cpt where ...@@ -153,7 +153,7 @@ updatePhyloCpt = here.component "updatePhylo" cpt where
opts <- pure $ options r' opts <- pure $ options r'
launchAff_ do launchAff_ do
dispatch opts dispatch opts
dispatch ClosePopover dispatch CloseBox
where where
options :: Phylo.UpdateData -> Action options :: Phylo.UpdateData -> Action
......
...@@ -265,7 +265,7 @@ uploadButtonCpt = here.component "uploadButton" cpt ...@@ -265,7 +265,7 @@ uploadButtonCpt = here.component "uploadButton" cpt
T.write_ Plain fileFormat T.write_ Plain fileFormat
T.write_ EN lang T.write_ EN lang
T.write_ false onPendingBox T.write_ false onPendingBox
dispatch ClosePopover dispatch CloseBox
uploadListView :: R2.Leaf Props uploadListView :: R2.Leaf Props
uploadListView = R2.leafComponent uploadListViewCpt uploadListView = R2.leafComponent uploadListViewCpt
......
...@@ -39,8 +39,9 @@ here :: R2.Here ...@@ -39,8 +39,9 @@ here :: R2.Here
here = R2.here "Gargantext.Components.Forest.Tree.Node.Box" here = R2.here "Gargantext.Components.Forest.Tree.Node.Box"
type CommonProps = type CommonProps =
( dispatch :: Action -> Aff Unit ( dispatch :: Action -> Aff Unit
, session :: Session ) , session :: Session
)
nodePopupView :: R2.Leaf NodePopupProps nodePopupView :: R2.Leaf NodePopupProps
nodePopupView = R2.leafComponent nodePopupCpt nodePopupView = R2.leafComponent nodePopupCpt
...@@ -71,7 +72,6 @@ nodePopupCpt = here.component "nodePopupView" cpt where ...@@ -71,7 +72,6 @@ nodePopupCpt = here.component "nodePopupView" cpt where
] ]
] ]
closePopover p = p.onPopoverClose <<< R.unsafeEventTarget
panelHeading renameIsOpen open p@{ dispatch, id, name, nodeType } = panelHeading renameIsOpen open p@{ dispatch, id, name, nodeType } =
H.div { className: "popup-container__header card-header" } H.div { className: "popup-container__header card-header" }
[ R2.row [ R2.row
...@@ -86,7 +86,7 @@ nodePopupCpt = here.component "nodePopupView" cpt where ...@@ -86,7 +86,7 @@ nodePopupCpt = here.component "nodePopupView" cpt where
] ]
, H.div { className: "col-1" } [ editIcon renameIsOpen open ] , H.div { className: "col-1" } [ editIcon renameIsOpen open ]
, H.div { className: "col-1" } , H.div { className: "col-1" }
[ H.a { type: "button", on: { click: closePopover p }, title: "Close" [ H.a { type: "button", on: { click: \_ -> p.closeCallback unit }, title: "Close"
, className: glyphicon "window-close" } [] ]]] , className: glyphicon "window-close" } [] ]]]
editIcon _ true = H.div {} [] editIcon _ true = H.div {} []
editIcon isOpen false = editIcon isOpen false =
......
module Gargantext.Components.Forest.Tree.Node.Box.Types where module Gargantext.Components.Forest.Tree.Node.Box.Types where
import DOM.Simple as DOM
import Data.Maybe (Maybe) import Data.Maybe (Maybe)
import Effect (Effect) import Effect (Effect)
import Effect.Aff (Aff) import Effect.Aff (Aff)
...@@ -18,11 +17,11 @@ type CommonProps = ...@@ -18,11 +17,11 @@ type CommonProps =
) )
type NodePopupProps = type NodePopupProps =
( boxes :: Boxes ( boxes :: Boxes
, id :: ID , id :: ID
, name :: Name , name :: Name
, nodeType :: GT.NodeType , nodeType :: GT.NodeType
, onPopoverClose :: DOM.Element -> Effect Unit , closeCallback :: Unit -> Effect Unit
| CommonProps | CommonProps
) )
......
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