Commit aff3539a authored by Sudhir Kumar's avatar Sudhir Kumar

trying the three buttons actions

parent 5fa7464f
......@@ -34,6 +34,7 @@ data Action
= LoadGraph Int
| SelectNode SelectedNode
| ShowSidePanel
| ShowControls
newtype SelectedNode = SelectedNode {id :: String, label :: String}
......@@ -47,6 +48,7 @@ newtype State = State
, legendData :: Array Legend
, selectedNode :: Maybe SelectedNode
, showSidePanel :: Boolean
, showControls :: Boolean
}
initialState :: State
......@@ -57,6 +59,7 @@ initialState = State
, legendData : []
, selectedNode : Nothing
, showSidePanel : false
, showControls : false
}
graphSpec :: Spec State {} Action
......@@ -81,6 +84,10 @@ performAction (SelectNode node) _ _ = void do
performAction (ShowSidePanel) _ (State state) = void do
modifyState $ \(State s) -> State s {showSidePanel = not (state.showSidePanel) }
performAction (ShowControls) _ (State state) = void do
modifyState $ \(State s) -> State s {showControls = not (state.showControls) }
convert :: GraphData -> SigmaGraphData
convert (GraphData r) = SigmaGraphData { nodes, edges}
where
......@@ -273,7 +280,15 @@ specOld = simpleSpec performAction render'
where
render' :: Render State {} Action
render' d _ (State st) _ =
[ div [className "row"] [
[ div [className "row"]
[
div [className "col-md-12"]
[ button [className "btn btn-primary"
, onClick \_ -> d ShowControls
,style {position:"relative",top:"-25px",left: "580px"}
] [text "Show Controls"]
]
, if (st.showControls) then
div [className "col-md-12", style {marginBottom : "21px"}]
[ menu [_id "toolbar"]
[ ul'
......@@ -341,6 +356,7 @@ specOld = simpleSpec performAction render'
]
]
]
else div [] []
]
, div [className "row"]
[ div [if (st.showSidePanel) then className "col-md-10" else className "col-md-11"]
......@@ -368,7 +384,7 @@ specOld = simpleSpec performAction render'
<>
if length st.legendData > 0 then [div [style {position : "absolute", bottom : "10px", border: "1px solid black", boxShadow : "rgb(0, 0, 0) 0px 2px 6px", marginLeft : "10px", padding: "16px"}] [dispLegend st.legendData]] else []
]
, button [onClick \_ -> d ShowSidePanel, className "btn btn-primary", style {right:"0px",position : "relative",zIndex:"1000"}] [text "show sidepanel"]
, button [onClick \_ -> d ShowSidePanel, className "btn btn-primary", style {right:"39px",position : "relative",zIndex:"1000", top: "-59px"}] [text "Show SidePanel"]
, if (st.showSidePanel) then
div [_id "sp-container",className "col-md-2", style {border : "1px black solid", backgroundColor : "beige", position:"absolute",right: "0px",top:"265px"}]
[ div [className "row"]
......
......@@ -130,7 +130,7 @@ layout1 layout =
]
ls = over _render \render d p s c -> [
button [onClick $ \e -> d ShowTree, className "btn btn-primary",style {position:"relative", top: "68px",left:"-264px",zIndex : "1000"}] [text "ShowTree"]
button [onClick $ \e -> d ShowTree, className "btn btn-primary",style {position:"relative", top: "99px",left:"-264px",zIndex : "1000"}] [text "ShowTree"]
, div [if (s.showTree) then className "col-md-2" else className "col-md-2"] if (s.showTree) then (render d p s c) else []
]
......
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