Commit 3b3ca047 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FOREST] Add with options (WIP).

parent 1d12348e
...@@ -34,7 +34,8 @@ plus :: R2.Setter Boolean -> R.Element ...@@ -34,7 +34,8 @@ plus :: R2.Setter Boolean -> R.Element
plus showLogin = plus showLogin =
H.button {on: {click}} H.button {on: {click}}
[ H.i { className: "glyphicon glyphicon-plus"} [] ] [ H.i { className: "glyphicon glyphicon-plus"} [] ]
-- TODO [ H.i { className: "material-icons md-36"} [] ] -- TODO same as the one in the Login Modal (same CSS)
-- [ H.i { className: "material-icons md-36"} [] ]
where where
click _ = do click _ = do
showLogin (const true) showLogin (const true)
...@@ -58,7 +58,7 @@ createNodeView d p@{nodeType} (Just CreatePopup /\ setPopupOpen) = R.createEleme ...@@ -58,7 +58,7 @@ createNodeView d p@{nodeType} (Just CreatePopup /\ setPopupOpen) = R.createEleme
pure $ H.div tooltipProps $ pure $ H.div tooltipProps $
[ H.div {className: "panel panel-default"} [ H.div {className: "panel panel-default"}
[ panelHeading [ panelHeading
, panelBody nodeName nodeType , panelBody readNodeType nodeName nodeType
, panelFooter nodeName nodeType , panelFooter nodeName nodeType
] ]
] ]
...@@ -84,11 +84,14 @@ createNodeView d p@{nodeType} (Just CreatePopup /\ setPopupOpen) = R.createEleme ...@@ -84,11 +84,14 @@ createNodeView d p@{nodeType} (Just CreatePopup /\ setPopupOpen) = R.createEleme
] ]
] ]
panelBody :: R.State String -> R.State NodeType -> R.Element panelBody :: (String -> NodeType)
panelBody (_ /\ setNodeName) (nt /\ setNodeType) = -> R.State String
-> R.State NodeType
-> R.Element
panelBody readIt (_ /\ setNodeName) (nt /\ setNodeType) =
H.div {className: "panel-body"} H.div {className: "panel-body"}
[ H.div {className: "row"} [ H.div {className: "row"}
[ H.div {className: "col-md-12"} [ H.div {className: "col-md-10"}
[ H.form {className: "form-horizontal"} [ H.form {className: "form-horizontal"}
[ {- H.div {className: "form-group"} [ {- H.div {className: "form-group"}
[ H.input { type: "text" [ H.input { type: "text"
...@@ -100,16 +103,20 @@ createNodeView d p@{nodeType} (Just CreatePopup /\ setPopupOpen) = R.createEleme ...@@ -100,16 +103,20 @@ createNodeView d p@{nodeType} (Just CreatePopup /\ setPopupOpen) = R.createEleme
] ]
, -} H.div {className: "form-group"} , -} H.div {className: "form-group"}
[ R2.select { className: "form-control" [ R2.select { className: "form-control"
, onChange: mkEffectFn1 $ \e -> setNodeType $ const $ readNodeType $ e .. "target" .. "value" , onChange: mkEffectFn1 $ \e -> setNodeType
$ const
$ readIt
$ e .. "target" .. "value"
} }
(map renderOption nodeTypes) (map (\opt -> H.option {} [ H.text $ show opt ]) nodeTypes)
] ]
-- , H.text "config"
, showConfig nt
] ]
] ]
] ]
] ]
renderOption (opt :: NodeType) = H.option {} [ H.text $ show opt ]
panelFooter :: R.State String -> R.State NodeType -> R.Element panelFooter :: R.State String -> R.State NodeType -> R.Element
panelFooter (name' /\ _) (nt /\ _) = panelFooter (name' /\ _) (nt /\ _) =
...@@ -128,3 +135,12 @@ createNodeView _ _ _ = R.createElement el {} [] ...@@ -128,3 +135,12 @@ createNodeView _ _ _ = R.createElement el {} []
cpt props _ = pure $ H.div {} [] cpt props _ = pure $ H.div {} []
-- END Create Node -- END Create Node
showConfig :: NodeType -> R.Element
showConfig Graph = H.text $ show Graph
showConfig _ = H.text $ show ""
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