Commit 80479a93 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[GraphExplorer] more reactix refactorings in Layout

parent e6c7df25
...@@ -38,7 +38,7 @@ import Gargantext.Config.REST (get) ...@@ -38,7 +38,7 @@ import Gargantext.Config.REST (get)
import Gargantext.Pages.Corpus.Graph.Tabs as GT import Gargantext.Pages.Corpus.Graph.Tabs as GT
import Gargantext.Types (class Optional) import Gargantext.Types (class Optional)
import Gargantext.Utils (toggleSet) import Gargantext.Utils (toggleSet)
import Gargantext.Utils.Reactix (scuff) import Gargantext.Utils.Reactix as R2
import Partial.Unsafe (unsafePartial) import Partial.Unsafe (unsafePartial)
import Unsafe.Coerce (unsafeCoerce) import Unsafe.Coerce (unsafeCoerce)
import Web.HTML (window) import Web.HTML (window)
...@@ -49,6 +49,8 @@ import Reactix.DOM.HTML as RH ...@@ -49,6 +49,8 @@ import Reactix.DOM.HTML as RH
type Props s fa2 = () type Props s fa2 = ()
spec = R2.scuff $ explorer {}
explorer :: forall s fa2. Record (Props s fa2) -> R.Element explorer :: forall s fa2. Record (Props s fa2) -> R.Element
explorer props = R.createElement explorerCpt props [] explorer props = R.createElement explorerCpt props []
......
...@@ -32,7 +32,6 @@ import Gargantext.Components.Graph as Graph ...@@ -32,7 +32,6 @@ import Gargantext.Components.Graph as Graph
import Gargantext.Components.Tree as Tree import Gargantext.Components.Tree as Tree
import Gargantext.Config as Config import Gargantext.Config as Config
import Gargantext.Config.REST (get) import Gargantext.Config.REST (get)
import Gargantext.Pages.Layout.Actions (Action(..))
import Gargantext.Pages.Corpus.Graph.Tabs as GT import Gargantext.Pages.Corpus.Graph.Tabs as GT
import Gargantext.Types (class Optional) import Gargantext.Types (class Optional)
import Gargantext.Utils (toggleSet) import Gargantext.Utils (toggleSet)
...@@ -131,48 +130,48 @@ graphSpec :: Spec State {} Action ...@@ -131,48 +130,48 @@ graphSpec :: Spec State {} Action
graphSpec = simpleSpec performAction render graphSpec = simpleSpec performAction render
-} -}
performAction :: PerformAction State {} Action -- performAction :: PerformAction State {} Action
performAction (LoadGraph fp) _ _ = void do -- performAction (LoadGraph fp) _ _ = void do
_ <- logs fp -- _ <- logs fp
_ <- modifyState \(State s) -> State s {corpusId = fp, sigmaGraphData = Nothing} -- _ <- modifyState \(State s) -> State s {corpusId = fp, sigmaGraphData = Nothing}
resp <- lift $ getNodes fp -- resp <- lift $ getNodes fp
treeResp <- liftEffect $ getAuthData -- treeResp <- liftEffect $ getAuthData
case treeResp of -- case treeResp of
Just (AuthData {token,tree_id }) -> -- Just (AuthData {token,tree_id }) ->
modifyState \(State s) -> State s {graphData = resp, sigmaGraphData = Just $ convert resp, legendData = getLegendData resp, treeId = Just tree_id} -- modifyState \(State s) -> State s {graphData = resp, sigmaGraphData = Just $ convert resp, legendData = getLegendData resp, treeId = Just tree_id}
Nothing -> -- Nothing ->
modifyState \(State s) -> State s { graphData = resp, sigmaGraphData = Just $ convert resp, legendData = getLegendData resp, treeId = Nothing} -- modifyState \(State s) -> State s { graphData = resp, sigmaGraphData = Just $ convert resp, legendData = getLegendData resp, treeId = Nothing}
-- TODO: here one might `catchError getNodes` to visually empty the -- -- TODO: here one might `catchError getNodes` to visually empty the
-- graph. -- -- graph.
--modifyState \(State s) -> State s {graphData = resp, sigmaGraphData = Just $ convert resp, legendData = getLegendData resp} -- --modifyState \(State s) -> State s {graphData = resp, sigmaGraphData = Just $ convert resp, legendData = getLegendData resp}
performAction (SelectNode selectedNode@(SelectedNode node)) _ (State state) = -- performAction (SelectNode selectedNode@(SelectedNode node)) _ (State state) =
modifyState_ $ \(State s) -> -- modifyState_ $ \(State s) ->
State s {selectedNodes = toggleSet selectedNode -- State s {selectedNodes = toggleSet selectedNode
(if s.multiNodeSelection then s.selectedNodes -- (if s.multiNodeSelection then s.selectedNodes
else Set.empty) } -- else Set.empty) }
performAction (ChangeLabelSize size) _ _ = -- performAction (ChangeLabelSize size) _ _ =
modifyState_ $ \(State s) -> -- modifyState_ $ \(State s) ->
State $ ((_sigmaSettings <<< _labelSizeRatio) .~ size) s -- State $ ((_sigmaSettings <<< _labelSizeRatio) .~ size) s
performAction (ChangeNodeSize size) _ _ = -- performAction (ChangeNodeSize size) _ _ =
modifyState_ $ \(State s) -> -- modifyState_ $ \(State s) ->
s # _sigmaSettings <<< _maxNodeSize .~ (size * 10.0) -- s # _sigmaSettings <<< _maxNodeSize .~ (size * 10.0)
# _sigmaSettings <<< _minNodeSize .~ size -- # _sigmaSettings <<< _minNodeSize .~ size
# State -- # State
performAction DisplayEdges _ _ = -- performAction DisplayEdges _ _ =
modifyState_ $ \(State s) -> do -- modifyState_ $ \(State s) -> do
State $ ((_sigmaSettings <<< _drawEdges) %~ not) s -- State $ ((_sigmaSettings <<< _drawEdges) %~ not) s
performAction ToggleMultiNodeSelection _ _ = -- performAction ToggleMultiNodeSelection _ _ =
modifyState_ $ \(State s) -> do -- modifyState_ $ \(State s) -> do
State $ s # _multiNodeSelection %~ not -- State $ s # _multiNodeSelection %~ not
performAction (ChangeCursorSize size) _ _ = -- performAction (ChangeCursorSize size) _ _ =
modifyState_ $ \(State s) -> -- modifyState_ $ \(State s) ->
State $ s # _cursorSize .~ size -- State $ s # _cursorSize .~ size
--performAction (Zoom True) _ _ = --performAction (Zoom True) _ _ =
...@@ -240,294 +239,294 @@ render d p (State {sigmaGraphData, settings, legendData}) c = ...@@ -240,294 +239,294 @@ render d p (State {sigmaGraphData, settings, legendData}) c =
-- ] -- ]
specOld :: Spec State {} Action -- specOld :: Spec State {} Action
specOld = fold [treespec treeSpec, graphspec $ simpleSpec performAction render'] -- specOld = fold [treespec treeSpec, graphspec $ simpleSpec performAction render']
where -- where
treespec = over _render \frender d p (State s) c -> -- treespec = over _render \frender d p (State s) c ->
[ div [ className "col-md-2", _id "graph-tree", style {marginTop: "65px"}] $ -- [ div [ className "col-md-2", _id "graph-tree", style {marginTop: "65px"}] $
[ -- [
button [className "btn btn-primary" , onClick \_ -> d ToggleTree] -- button [className "btn btn-primary" , onClick \_ -> d ToggleTree]
[text $ if s.showTree then "Hide Tree" else "Show Tree"] -- [text $ if s.showTree then "Hide Tree" else "Show Tree"]
] -- ]
<> -- <>
if s.showTree then (frender d p (State s) c) else [] -- if s.showTree then (frender d p (State s) c) else []
] -- ]
graphspec = over _render \frender d p s c -> [ -- graphspec = over _render \frender d p s c -> [
div [ className "col-md-9"] (frender d p s c) -- div [ className "col-md-9"] (frender d p s c)
] -- ]
treeSpec :: Spec State {} Action -- treeSpec :: Spec State {} Action
treeSpec = withState \(State st) -> -- treeSpec = withState \(State st) ->
case st.treeId of -- case st.treeId of
Nothing -> -- Nothing ->
simpleSpec defaultPerformAction defaultRender -- simpleSpec defaultPerformAction defaultRender
Just treeId -> -- Just treeId ->
(cmapProps (const {root: treeId}) (noState Tree.treeview)) -- (cmapProps (const {root: treeId}) (noState Tree.treeview))
render' :: Render State {} Action -- render' :: Render State {} Action
render' d _ (State st@{sigmaSettings, graphData: GraphData {sides,metaData }}) _ = -- render' d _ (State st@{sigmaSettings, graphData: GraphData {sides,metaData }}) _ =
[ div [className "container-fluid", style {paddingTop : "90px" }] -- [ div [className "container-fluid", style {paddingTop : "90px" }]
[ {-div [ className "row"] -- [ {-div [ className "row"]
[-- : MetaData {title} -- [-- : MetaData {title}
case metaData of -- case metaData of
Just( MetaData {title }) -> -- Just( MetaData {title }) ->
text $ "Graph " <> title -- text $ "Graph " <> title
Nothing -> -- Nothing ->
text "Title" -- text "Title"
] -- ]
] -- ]
, -} -- , -}
div [className "row"] -- div [className "row"]
[ -- [
if (st.showControls) then -- if (st.showControls) then
div [className "col-md-12", style {"padding-bottom" : "10px"}] -- div [className "col-md-12", style {"padding-bottom" : "10px"}]
[ menu [_id "toolbar"] -- [ menu [_id "toolbar"]
[ ul' -- [ ul'
[
-- li' [ button [className "btn btn-success btn-sm"] [text "Change Type"] ]
-- ,
-- , li' [ button [className "btn btn-primary btn-sm"] [text "Change Level"] ]
{- ,li [style {display : "inline-block"}]
[ form'
[ input [_type "file"
, name "file"
-- , onChange (\e -> d $ SetFile (getFile e) (unsafeCoerce $ d <<< SetProgress))
, className "btn btn-primary"]
-- , text $ show st.readyState
]
]
-}
{-, li' [ input [_type "button"
, className "btn btn-warning btn-sm"
,value "Run Demo"
-- , onClick \_ -> d SetGraph, disabled (st.readyState /= DONE)
]
]
-}
{-, li'
[ form'
[ div [className "col-lg-2"]
[
div [className "input-group"]
[
span [className "input-group-btn"]
[
button [className "btn btn-primary", _type "button"]
[ span [className "glyphicon glyphicon-search"] []
]
]
, input [_type "text", className "form-control", placeholder "select topics"]
]
]
]
]
-}
li [className "col-md-1"]
[ span [] [text "Selector"]
, input [ _type "range"
, _id "cursorSizeRange"
, min "0"
, max "100"
, defaultValue (show st.cursorSize)
, onChange \e -> d $ ChangeCursorSize (numberTargetValue e)
]
]
, li [className "col-md-1"]
[ span [] [text "Labels"],input [_type "range"
, _id "labelSizeRange"
, max "4"
, defaultValue <<< show $ sigmaSettings ^. _labelSizeRatio
, min "1"
, onChange \e -> d $ ChangeLabelSize (numberTargetValue e)
]
]
, li [className "col-md-1"]
[ span [] [text "Nodes"],input [_type "range"
, _id "nodeSizeRange"
, max "15"
, defaultValue <<< show $ sigmaSettings ^. _minNodeSize
, min "5"
, onChange \e -> d $ ChangeNodeSize (numberTargetValue e)
]
]
{-, li [className "col-md-2"]
[ span [] [text "Edges"],input [_type "range", _id "myRange", value "90"]
]
-}
-- , li'
-- [ button [ className "btn btn-primary"
-- , onClick \_ -> modCamera0 (const {x: 0.0, y: 0.0, ratio: 1.0})
-- ] [text "Center"]
-- ]
-- , li [className "col-md-1"]
-- [ span [] [text "Zoom"],input [ _type "range"
-- , _id "cameraRatio"
-- , max "100"
-- , defaultValue "0"
-- , min "0"
-- , onChange \e -> do
-- let ratio = (100.0 - numberTargetValue e) / 100.0pa
-- modCamera0 (const {ratio})
-- ]
-- ]
, li [className "col-md-1"]
[ span [] [text "MultiNode"]
, input
[ _type "checkbox"
, className "checkbox"
-- , checked
, onChange $ const $ d ToggleMultiNodeSelection
]
]
, li'
[ button [ className "btn btn-primary"
, onClick \_ -> pauseForceAtlas2
] [text "Spatialization"]
]
{-, li'
[ button [className "btn btn-primary"
, onClick \_ -> do
_ <- log "Hey there" -- $ show st.camera
pure unit
] [text "Save"] -- TODO: Implement Save!
]
-}
]
]
]
else div [] []
]
, div [className "row"]
[div [if (st.showSidePanel && st.showTree) then className "col-md-10" else if (st.showSidePanel || st.showTree) then className "col-md-10" else className "col-md-12"]
[ div [style {height: "95%"}
,onMouseMove (sigmaOnMouseMove {cursorSize: st.cursorSize})] $
[
]
<>
case st.sigmaGraphData of
Nothing -> []
Just graph ->
let forceAtlas2Settings = Graph.forceAtlas2Settings in
let opts = { graph, sigmaSettings, forceAtlas2Settings } in
[ scuff $ Graph.graph opts ]
-- [ sigma { graph, settings
-- , style : sStyle { height : "95%"}
-- , onClickNode : \e ->
-- unsafePerformEffect $ do
-- _ <- d $ ShowSidePanel true
-- let {id, label} = (unsafeCoerce e).data.node
-- _ <- d $ SelectNode $ SelectedNode {id, label}
-- pure unit
-- ]
<>
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:"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 white solid", backgroundColor : "white"}]
[ div [className "row"] $
-- , div [className "col-md-12"]
-- [a
-- ul [className "nav nav-tabs"
-- , _id "myTab"
-- , role "tablist"
-- , style {marginBottom : "18px", marginTop : "18px"}
-- ]
-- [ -- [
-- li [className "nav-item"] -- -- li' [ button [className "btn btn-success btn-sm"] [text "Change Type"] ]
-- [ -- -- ,
-- a [className "nav-link active" -- -- , li' [ button [className "btn btn-primary btn-sm"] [text "Change Level"] ]
-- , _id "home-tab" -- {- ,li [style {display : "inline-block"}]
-- , _data {toggle : "tab"} -- [ form'
-- , href "#home" -- [ input [_type "file"
-- , role "tab" -- , name "file"
-- , aria {controls :"home" , selected : "true"} -- -- , onChange (\e -> d $ SetFile (getFile e) (unsafeCoerce $ d <<< SetProgress))
-- ] [text "Neighbours"] -- , className "btn btn-primary"]
-- -- , text $ show st.readyState
-- ]
-- ] -- ]
-- ] -- -}
-- , div [className "tab-content", _id "myTabContent", style {borderBottom : "1px solid black", paddingBottom : "19px"}] -- {-, li' [ input [_type "button"
-- [ div [ className "", _id "home", role "tabpanel" ] -- , className "btn btn-warning btn-sm"
-- [ a [ className "badge badge-light"][text "objects"] -- ,value "Run Demo"
-- , a [ className "badge badge-light"][text "evaluation"] -- -- , onClick \_ -> d SetGraph, disabled (st.readyState /= DONE)
-- , a [ className "badge badge-light"][text "dynamics"] -- ]
-- , a [ className "badge badge-light"][text "virtual environments"] -- ]
-- , a [ className "badge badge-light"][text "virtual reality"] -- -}
-- , a [ className "badge badge-light"][text "performance analysis"] -- {-, li'
-- , a [ className "badge badge-light"][text "software engineering"] -- [ form'
-- , a [ className "badge badge-light"][text "complex systems"] -- [ div [className "col-lg-2"]
-- , a [ className "badge badge-light"][text "wireless communications"] -- [
-- -- div [className "input-group"]
-- [
-- span [className "input-group-btn"]
-- [
-- button [className "btn btn-primary", _type "button"]
-- [ span [className "glyphicon glyphicon-search"] []
-- ]
-- ]
-- , input [_type "text", className "form-control", placeholder "select topics"]
-- ]
-- ]
-- ] -- ]
-- ] -- ]
-- -}
-- li [className "col-md-1"]
-- [ span [] [text "Selector"]
-- , input [ _type "range"
-- , _id "cursorSizeRange"
-- , min "0"
-- , max "100"
-- , defaultValue (show st.cursorSize)
-- , onChange \e -> d $ ChangeCursorSize (numberTargetValue e)
-- ]
-- ]
-- , li [className "col-md-1"]
-- [ span [] [text "Labels"],input [_type "range"
-- , _id "labelSizeRange"
-- , max "4"
-- , defaultValue <<< show $ sigmaSettings ^. _labelSizeRatio
-- , min "1"
-- , onChange \e -> d $ ChangeLabelSize (numberTargetValue e)
-- ]
-- ]
-- , li [className "col-md-1"]
-- [ span [] [text "Nodes"],input [_type "range"
-- , _id "nodeSizeRange"
-- , max "15"
-- , defaultValue <<< show $ sigmaSettings ^. _minNodeSize
-- , min "5"
-- , onChange \e -> d $ ChangeNodeSize (numberTargetValue e)
-- ]
-- ]
-- {-, li [className "col-md-2"]
-- [ span [] [text "Edges"],input [_type "range", _id "myRange", value "90"]
-- ]
-- -}
-- -- , li'
-- -- [ button [ className "btn btn-primary"
-- -- , onClick \_ -> modCamera0 (const {x: 0.0, y: 0.0, ratio: 1.0})
-- -- ] [text "Center"]
-- -- ]
-- -- , li [className "col-md-1"]
-- -- [ span [] [text "Zoom"],input [ _type "range"
-- -- , _id "cameraRatio"
-- -- , max "100"
-- -- , defaultValue "0"
-- -- , min "0"
-- -- , onChange \e -> do
-- -- let ratio = (100.0 - numberTargetValue e) / 100.0pa
-- -- modCamera0 (const {ratio})
-- -- ]
-- -- ]
-- , li [className "col-md-1"]
-- [ span [] [text "MultiNode"]
-- , input
-- [ _type "checkbox"
-- , className "checkbox"
-- -- , checked
-- , onChange $ const $ d ToggleMultiNodeSelection
-- ]
-- ]
-- , li'
-- [ button [ className "btn btn-primary"
-- , onClick \_ -> pauseForceAtlas2
-- ] [text "Spatialization"]
-- ]
-- {-, li'
-- [ button [className "btn btn-primary"
-- , onClick \_ -> do
-- _ <- log "Hey there" -- $ show st.camera
-- pure unit
-- ] [text "Save"] -- TODO: Implement Save!
-- ]
-- -}
-- ] -- ]
{-, div [className "col-md-12", _id "horizontal-checkbox"] -- ]
[ ul [ style {display: "inline",float : "left" }] -- ]
[ li [] -- else div [] []
[ span [] [text "Pubs"] -- ]
,input [ _type "checkbox" -- , div [className "row"]
, className "checkbox" -- [div [if (st.showSidePanel && st.showTree) then className "col-md-10" else if (st.showSidePanel || st.showTree) then className "col-md-10" else className "col-md-12"]
, checked $ true -- [ div [style {height: "95%"}
, title "Mark as completed" -- ,onMouseMove (sigmaOnMouseMove {cursorSize: st.cursorSize})] $
-- , onChange $ dispatch <<< ( const $ SetMap $ not (getter _._type state.term == MapTerm)) -- [
] -- ]
-- <>
] -- case st.sigmaGraphData of
, li [] -- Nothing -> []
[ span [] [text "Projects"] -- Just graph ->
,input [ _type "checkbox" -- let forceAtlas2Settings = Graph.forceAtlas2Settings in
, className "checkbox" -- let opts = { graph, sigmaSettings, forceAtlas2Settings } in
, checked $ false -- [ scuff $ Graph.graph opts ]
, title "Mark as completed"
-- , onChange $ dispatch <<< ( const $ SetMap $ not (getter _._type state.term == MapTerm)) -- -- [ sigma { graph, settings
] -- -- , style : sStyle { height : "95%"}
] -- -- , onClickNode : \e ->
, li [] -- -- unsafePerformEffect $ do
[ span [] [text "Patents"] -- -- _ <- d $ ShowSidePanel true
,input [ _type "checkbox" -- -- let {id, label} = (unsafeCoerce e).data.node
, className "checkbox" -- -- _ <- d $ SelectNode $ SelectedNode {id, label}
, checked $ false -- -- pure unit
, title "Mark as completed" -- -- ]
-- , onChange $ dispatch <<< ( const $ SetMap $ not (getter _._type state.term == MapTerm)) -- <>
] -- 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 []
] -- ]
, li [] -- --, button [onClick \_ -> d ShowSidePanel, className "btn btn-primary", style {right:"39px",position : "relative",zIndex:"1000", top: "-59px"}] [text "Show SidePanel"]
[ span [] [text "Others"] -- , if (st.showSidePanel) then
,input [ _type "checkbox" -- div [_id "sp-container", className "col-md-2", style {border : "1px white solid", backgroundColor : "white"}]
, className "checkbox" -- [ div [className "row"] $
, checked $ false -- -- , div [className "col-md-12"]
, title "Mark as completed" -- -- [a
-- , onChange $ dispatch <<< ( const $ SetMap $ not (getter _._type state.term == MapTerm)) -- -- ul [className "nav nav-tabs"
] -- -- , _id "myTab"
] -- -- , role "tablist"
] -- -- , style {marginBottom : "18px", marginTop : "18px"}
-- -- ]
] --} -- -- [
-- -- li [className "nav-item"]
[ div [] -- -- [
[ p [] [] -- -- a [className "nav-link active"
, div [className "col-md-12"] -- -- , _id "home-tab"
[ let query = (\(SelectedNode {label}) -> words label) <$> Set.toUnfoldable st.selectedNodes in -- -- , _data {toggle : "tab"}
if null query then -- -- , href "#home"
p [] [] -- -- , role "tab"
else -- -- , aria {controls :"home" , selected : "true"}
GT.tabsElt {query, sides} -- -- ] [text "Neighbours"]
, p [] [] -- -- ]
] -- -- ]
] -- -- , div [className "tab-content", _id "myTabContent", style {borderBottom : "1px solid black", paddingBottom : "19px"}]
] -- -- [ div [ className "", _id "home", role "tabpanel" ]
] -- -- [ a [ className "badge badge-light"][text "objects"]
else -- -- , a [ className "badge badge-light"][text "evaluation"]
div [] [] -- ends sidepanel column here -- -- , a [ className "badge badge-light"][text "dynamics"]
] -- -- , a [ className "badge badge-light"][text "virtual environments"]
] -- -- , a [ className "badge badge-light"][text "virtual reality"]
] -- -- , a [ className "badge badge-light"][text "performance analysis"]
-- -- , a [ className "badge badge-light"][text "software engineering"]
-- -- , a [ className "badge badge-light"][text "complex systems"]
-- -- , a [ className "badge badge-light"][text "wireless communications"]
-- --
-- -- ]
-- -- ]
-- -- ]
-- {-, div [className "col-md-12", _id "horizontal-checkbox"]
-- [ ul [ style {display: "inline",float : "left" }]
-- [ li []
-- [ span [] [text "Pubs"]
-- ,input [ _type "checkbox"
-- , className "checkbox"
-- , checked $ true
-- , title "Mark as completed"
-- -- , onChange $ dispatch <<< ( const $ SetMap $ not (getter _._type state.term == MapTerm))
-- ]
-- ]
-- , li []
-- [ span [] [text "Projects"]
-- ,input [ _type "checkbox"
-- , className "checkbox"
-- , checked $ false
-- , title "Mark as completed"
-- -- , onChange $ dispatch <<< ( const $ SetMap $ not (getter _._type state.term == MapTerm))
-- ]
-- ]
-- , li []
-- [ span [] [text "Patents"]
-- ,input [ _type "checkbox"
-- , className "checkbox"
-- , checked $ false
-- , title "Mark as completed"
-- -- , onChange $ dispatch <<< ( const $ SetMap $ not (getter _._type state.term == MapTerm))
-- ]
-- ]
-- , li []
-- [ span [] [text "Others"]
-- ,input [ _type "checkbox"
-- , className "checkbox"
-- , checked $ false
-- , title "Mark as completed"
-- -- , onChange $ dispatch <<< ( const $ SetMap $ not (getter _._type state.term == MapTerm))
-- ]
-- ]
-- ]
-- ] --}
-- [ div []
-- [ p [] []
-- , div [className "col-md-12"]
-- [ let query = (\(SelectedNode {label}) -> words label) <$> Set.toUnfoldable st.selectedNodes in
-- if null query then
-- p [] []
-- else
-- GT.tabsElt {query, sides}
-- , p [] []
-- ]
-- ]
-- ]
-- ]
-- else
-- div [] [] -- ends sidepanel column here
-- ]
-- ]
-- ]
...@@ -53,7 +53,7 @@ dispatchAction dispatcher _ (Document i n) = do ...@@ -53,7 +53,7 @@ dispatchAction dispatcher _ (Document i n) = do
dispatchAction dispatcher _ (PGraphExplorer nid) = do dispatchAction dispatcher _ (PGraphExplorer nid) = do
dispatcher $ SetRoute $ PGraphExplorer nid dispatcher $ SetRoute $ PGraphExplorer nid
dispatcher $ GraphExplorerA $ GE.LoadGraph nid -- dispatcher $ GraphExplorerA $ GE.LoadGraph nid
--dispatcher $ GraphExplorerA $ GE.LoadGraph "imtNew.json" --dispatcher $ GraphExplorerA $ GE.LoadGraph "imtNew.json"
dispatchAction dispatcher _ Dashboard = do dispatchAction dispatcher _ Dashboard = do
......
...@@ -12,7 +12,7 @@ import Routing.Hash (setHash) ...@@ -12,7 +12,7 @@ import Routing.Hash (setHash)
import Gargantext.Components.Login as LN import Gargantext.Components.Login as LN
import Gargantext.Components.Modals.Modal (modalShow) import Gargantext.Components.Modals.Modal (modalShow)
import Gargantext.Pages.Annuaire as Annuaire import Gargantext.Pages.Annuaire as Annuaire
import Gargantext.Pages.Corpus.Graph as GE --import Gargantext.Pages.Corpus.Graph as GE
import Gargantext.Pages.Layout.Specs.AddCorpus as AC import Gargantext.Pages.Layout.Specs.AddCorpus as AC
import Gargantext.Pages.Layout.Specs.Search as S import Gargantext.Pages.Layout.Specs.Search as S
import Gargantext.Pages.Layout.States (AppState) import Gargantext.Pages.Layout.States (AppState)
...@@ -26,7 +26,7 @@ data Action ...@@ -26,7 +26,7 @@ data Action
| SetRoute Routes | SetRoute Routes
| SearchA S.Action | SearchA S.Action
| AddCorpusA AC.Action | AddCorpusA AC.Action
| GraphExplorerA GE.Action -- | GraphExplorerA GE.Action
| AnnuaireAction Annuaire.Action | AnnuaireAction Annuaire.Action
| ShowLogin | ShowLogin
| Logout | Logout
...@@ -63,7 +63,7 @@ performAction ShowAddCorpus _ _ = void do ...@@ -63,7 +63,7 @@ performAction ShowAddCorpus _ _ = void do
performAction (LoginA _) _ _ = pure unit performAction (LoginA _) _ _ = pure unit
performAction (AddCorpusA _) _ _ = pure unit performAction (AddCorpusA _) _ _ = pure unit
performAction (SearchA _) _ _ = pure unit performAction (SearchA _) _ _ = pure unit
performAction (GraphExplorerA _) _ _ = pure unit -- performAction (GraphExplorerA _) _ _ = pure unit
performAction (AnnuaireAction _) _ _ = pure unit performAction (AnnuaireAction _) _ _ = pure unit
-- liftEffect $ modalShow "addCorpus" -- liftEffect $ modalShow "addCorpus"
-- modifyState $ _ {showCorpus = true} -- modifyState $ _ {showCorpus = true}
...@@ -94,8 +94,8 @@ _annuaireAction = prism AnnuaireAction \action -> ...@@ -94,8 +94,8 @@ _annuaireAction = prism AnnuaireAction \action ->
AnnuaireAction a -> Right a AnnuaireAction a -> Right a
_ -> Left action _ -> Left action
_graphExplorerAction :: Prism' Action GE.Action -- _graphExplorerAction :: Prism' Action GE.Action
_graphExplorerAction = prism GraphExplorerA \action -> -- _graphExplorerAction = prism GraphExplorerA \action ->
case action of -- case action of
GraphExplorerA caction -> Right caction -- GraphExplorerA caction -> Right caction
_-> Left action -- _-> Left action
...@@ -12,6 +12,7 @@ import Thermite (Render, Spec, _render, defaultPerformAction, defaultRender, foc ...@@ -12,6 +12,7 @@ import Thermite (Render, Spec, _render, defaultPerformAction, defaultRender, foc
import Gargantext.Prelude import Gargantext.Prelude
import Gargantext.Components.Data.Lang (Lang(..)) import Gargantext.Components.Data.Lang (Lang(..))
import Gargantext.Components.GraphExplorer as GE
import Gargantext.Components.Login.Types (AuthData(..)) import Gargantext.Components.Login.Types (AuthData(..))
import Gargantext.Components.Login as LN import Gargantext.Components.Login as LN
import Gargantext.Components.Tree as Tree import Gargantext.Components.Tree as Tree
...@@ -21,13 +22,13 @@ import Gargantext.Pages.Annuaire.User.Contacts as C ...@@ -21,13 +22,13 @@ import Gargantext.Pages.Annuaire.User.Contacts as C
import Gargantext.Pages.Corpus as Corpus import Gargantext.Pages.Corpus as Corpus
import Gargantext.Pages.Corpus.Document as Annotation import Gargantext.Pages.Corpus.Document as Annotation
import Gargantext.Pages.Corpus.Dashboard as Dsh import Gargantext.Pages.Corpus.Dashboard as Dsh
import Gargantext.Pages.Corpus.Graph as GE --import Gargantext.Pages.Corpus.Graph as GE
import Gargantext.Pages.Home as L import Gargantext.Pages.Home as L
import Gargantext.Pages.Layout.Actions (Action(..), _addCorpusAction, _graphExplorerAction, _loginAction, _searchAction, performAction) import Gargantext.Pages.Layout.Actions (Action(..), _addCorpusAction, _loginAction, _searchAction, performAction)
import Gargantext.Pages.Layout.Specs.AddCorpus as AC import Gargantext.Pages.Layout.Specs.AddCorpus as AC
import Gargantext.Pages.Layout.Specs.Search as S import Gargantext.Pages.Layout.Specs.Search as S
import Gargantext.Pages.Layout.Specs.SearchBar as SB import Gargantext.Pages.Layout.Specs.SearchBar as SB
import Gargantext.Pages.Layout.States (AppState, _addCorpusState, _graphExplorerState, _loginState, _searchState) import Gargantext.Pages.Layout.States (AppState, _addCorpusState, _loginState, _searchState)
import Gargantext.Router (Routes(..)) import Gargantext.Router (Routes(..))
import Gargantext.Utils.Reactix (scuff) import Gargantext.Utils.Reactix (scuff)
...@@ -61,7 +62,8 @@ pagesComponent s = case s.currentRoute of ...@@ -61,7 +62,8 @@ pagesComponent s = case s.currentRoute of
selectSpec AddCorpus = layout0 $ focus _addCorpusState _addCorpusAction AC.layoutAddcorpus selectSpec AddCorpus = layout0 $ focus _addCorpusState _addCorpusAction AC.layoutAddcorpus
selectSpec SearchView = layout0 $ focus _searchState _searchAction S.searchSpec selectSpec SearchView = layout0 $ focus _searchState _searchAction S.searchSpec
selectSpec (Document l i) = layout0 $ cmapProps (const {nodeId: i, listId: l}) $ noState Annotation.layout selectSpec (Document l i) = layout0 $ cmapProps (const {nodeId: i, listId: l}) $ noState Annotation.layout
selectSpec (PGraphExplorer i)= layout1 $ focus _graphExplorerState _graphExplorerAction GE.specOld --selectSpec (PGraphExplorer i)= layout1 $ focus _graphExplorerState _graphExplorerAction GE.specOld
selectSpec (PGraphExplorer i) = layout1 $ noState $ GE.spec
selectSpec Dashboard = layout0 $ noState Dsh.layoutDashboard selectSpec Dashboard = layout0 $ noState Dsh.layoutDashboard
selectSpec (Annuaire i) = layout0 $ cmapProps (const {annuaireId: i}) $ noState A.layout selectSpec (Annuaire i) = layout0 $ cmapProps (const {annuaireId: i}) $ noState A.layout
selectSpec (UserPage i) = layout0 $ cmapProps (const {nodeId: i}) $ noState C.layoutUser selectSpec (UserPage i) = layout0 $ cmapProps (const {nodeId: i}) $ noState C.layoutUser
......
...@@ -7,7 +7,7 @@ import Data.Maybe (Maybe(Just)) ...@@ -7,7 +7,7 @@ import Data.Maybe (Maybe(Just))
import Effect (Effect) import Effect (Effect)
import Gargantext.Components.Login as LN import Gargantext.Components.Login as LN
import Gargantext.Pages.Corpus.Graph as GE --import Gargantext.Pages.Corpus.Graph as GE
import Gargantext.Pages.Layout.Specs.AddCorpus as AC import Gargantext.Pages.Layout.Specs.AddCorpus as AC
import Gargantext.Pages.Layout.Specs.Search as S import Gargantext.Pages.Layout.Specs.Search as S
import Gargantext.Router (Routes(..)) import Gargantext.Router (Routes(..))
...@@ -19,7 +19,7 @@ type AppState = ...@@ -19,7 +19,7 @@ type AppState =
, searchState :: S.State , searchState :: S.State
, showLogin :: Boolean , showLogin :: Boolean
, showCorpus :: Boolean , showCorpus :: Boolean
, graphExplorerState :: GE.State --, graphExplorerState :: GE.State
, showTree :: Boolean , showTree :: Boolean
} }
...@@ -33,7 +33,7 @@ initAppState = do ...@@ -33,7 +33,7 @@ initAppState = do
, searchState : S.initialState , searchState : S.initialState
, showLogin : false , showLogin : false
, showCorpus : false , showCorpus : false
, graphExplorerState : GE.initialState --, graphExplorerState : GE.initialState
, showTree : false , showTree : false
} }
...@@ -49,6 +49,6 @@ _addCorpusState = lens (\s -> s.addCorpusState) (\s ss -> s{addCorpusState = ss} ...@@ -49,6 +49,6 @@ _addCorpusState = lens (\s -> s.addCorpusState) (\s ss -> s{addCorpusState = ss}
_searchState :: Lens' AppState S.State _searchState :: Lens' AppState S.State
_searchState = lens (\s -> s.searchState) (\s ss -> s{searchState = ss}) _searchState = lens (\s -> s.searchState) (\s ss -> s{searchState = ss})
_graphExplorerState :: Lens' AppState GE.State -- _graphExplorerState :: Lens' AppState GE.State
_graphExplorerState = lens (\s -> s.graphExplorerState) (\s ss -> s{graphExplorerState = ss}) -- _graphExplorerState = lens (\s -> s.graphExplorerState) (\s ss -> s{graphExplorerState = ss})
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