Unverified Commit b889ed13 authored by Mael NICOLAS's avatar Mael NICOLAS Committed by Nicolas Pouillard

[HELP] working on a basic alert ffi

Problem with type for myGoto
parent 0538f5ee
......@@ -39,3 +39,9 @@ exports.sigmaEnableWebGLClass = SJS.SigmaEnableWebGL;
exports.forceLinkClass = FL.default;
}
const myGoto = function(sigma){
alert("My goto ffi");
};
exports.myGoto = myGoto;
......@@ -2,8 +2,11 @@ module Gargantext.Components.GraphExplorer.Sigmajs where
import Prelude
import Data.Nullable (Nullable)
import Data.Unit (Unit)
import Effect (Effect)
import React (Children, ReactClass, ReactElement, createElement, unsafeCreateElement)
import React (Children, ReactClass, ReactElement, ReactRef, createElement, unsafeCreateElement)
import React.DOM.Props (Props)
import Unsafe.Coerce (unsafeCoerce)
import Gargantext.Types (class Optional)
......@@ -242,12 +245,14 @@ sigmaSettings :: forall o. Optional o SigmaSettingProps => { | o } -> SigmaSetti
sigmaSettings = unsafeCoerce
foreign import data SigmaStyle :: Type
foreign import myGoto :: Nullable ReactRef -> Effect Unit
type SigmaProps =
( renderer :: Renderer
, settings :: SigmaSettings
, style :: SigmaStyle
, graph :: SigmaGraphData
, ref :: (Nullable ReactRef -> Effect Unit) -> Props
, onClickNode :: SigmaNodeEvent -> Unit
, onOverNode :: SigmaNodeEvent -> Unit
, onOutNode :: SigmaNodeEvent -> Effect Unit
......@@ -311,13 +316,12 @@ newtype ScalingMode = ScalingMode String
scalingMode :: { inside :: ScalingMode
, outside :: ScalingMode
}
scalingMode =
{ inside : ScalingMode "inside"
, outside : ScalingMode "outside"
}
type SigmaSettingProps =
( clone :: Boolean
, immutable :: Boolean
......
......@@ -25,7 +25,7 @@ import Effect.Aff (Aff, attempt)
import Effect.Aff.Class (liftAff)
import Effect.Class (liftEffect)
import Effect.Console (log)
import Gargantext.Components.GraphExplorer.Sigmajs (Color(Color), SigmaEasing, SigmaGraphData(SigmaGraphData), SigmaNode, SigmaSettings, canvas, edgeShape, edgeShapes, forceAtlas2, sStyle, sigma, sigmaEasing, sigmaEdge, sigmaEnableWebGL, sigmaNode, sigmaSettings)
import Gargantext.Components.GraphExplorer.Sigmajs (Color(Color), SigmaEasing, SigmaGraphData(SigmaGraphData), SigmaNode, SigmaSettings, canvas, edgeShape, edgeShapes, forceAtlas2, myGoto, sStyle, sigma, sigmaEasing, sigmaEdge, sigmaEnableWebGL, sigmaNode, sigmaSettings)
import Gargantext.Components.GraphExplorer.Types (Cluster(..), MetaData(..), Edge(..), GraphData(..), Legend(..), Node(..), getLegendData)
import Gargantext.Components.Login.Types (AuthData(..), TreeId)
import Gargantext.Components.RandomText (words)
......@@ -192,6 +192,7 @@ render d p (State {sigmaGraphData, settings, legendData}) c =
[ sigma { graph, settings
, renderer : canvas
, style : sStyle { height : "95%"}
, ref: myGoto
, onClickNode : \e -> unsafePerformEffect $ do
_ <- log "hello"
-- _ <- logs $ unsafeCoerce e
......
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