Commit 9aec3303 authored by Mael NICOLAS's avatar Mael NICOLAS

[HELP] working on a basic alert ffi

Problem with type for myGoto
parent 4807e9ee
Pipeline #134 canceled with stages
......@@ -18,3 +18,9 @@ exports.sigmaClass = SJS.Sigma;
exports.sigmaEnableSVGClass = SJS.SigmaEnableSVG;
exports.sigmaEnableWebGLClass = SJS.SigmaEnableWebGL;
exports.forceLinkClass = FL.default;
const myGoto = function(sigma){
alert("My goto ffi");
};
exports.myGoto = myGoto;
......@@ -2,9 +2,12 @@ module Gargantext.Components.GraphExplorer.Sigmajs where
import Prelude
import Data.Nullable (Nullable)
import Data.Unit (Unit)
import Effect (Effect)
import Prim.Row (class Union)
import React (Children, ReactClass, ReactElement, createElement, unsafeCreateElement)
import React (Children, ReactClass, ReactElement, ReactRef, createElement, unsafeCreateElement)
import React.DOM.Props (Props)
import Unsafe.Coerce (unsafeCoerce)
foreign import edgeShapesClass :: forall props. ReactClass props
......@@ -248,12 +251,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
  • I do not understand the -> Props. Why isn't it ref :: Nullable ReactRef -> Effect Unit?

Please register or sign in to reply
, onClickNode :: SigmaNodeEvent -> Unit
, onOverNode :: SigmaNodeEvent -> Unit
, onOutNode :: SigmaNodeEvent -> Effect Unit
......@@ -317,13 +322,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