Commit a60f6f9e authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[jitsi meet] external api in our sources, this works initially

parent 21a3b34a
...@@ -14,6 +14,5 @@ ...@@ -14,6 +14,5 @@
<div id="app" class ="container-fluid"></div> <div id="app" class ="container-fluid"></div>
<div id="portal"></div> <div id="portal"></div>
<script src="bundle.js"></script> <script src="bundle.js"></script>
<script src='https://visio.gargantext.org/external_api.js'></script> <!-- FIXME to be removed -->
</body> </body>
</html> </html>
...@@ -8,7 +8,7 @@ import Data.Eq.Generic (genericEq) ...@@ -8,7 +8,7 @@ import Data.Eq.Generic (genericEq)
import Data.Generic.Rep (class Generic) import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
import Data.Newtype (class Newtype) import Data.Newtype (class Newtype)
import Data.Nullable (Nullable, null) import Data.Nullable (Nullable, null, toMaybe)
import Data.Show.Generic (genericShow) import Data.Show.Generic (genericShow)
import DOM.Simple as DOM import DOM.Simple as DOM
import Effect.Aff (Aff) import Effect.Aff (Aff)
...@@ -24,6 +24,7 @@ import Gargantext.Hooks.Loader (useLoader) ...@@ -24,6 +24,7 @@ import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Routes (SessionRoute(NodeAPI)) import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Sessions (Session, get, sessionId) import Gargantext.Sessions (Session, get, sessionId)
import Gargantext.Types (NodeType(..)) import Gargantext.Types (NodeType(..))
import Gargantext.Utils.JitsiMeet as JM
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2 import Gargantext.Utils.Toestand as T2
...@@ -130,30 +131,19 @@ nodeFrameVisioCpt = here.component "nodeFrameVisio" cpt ...@@ -130,30 +131,19 @@ nodeFrameVisioCpt = here.component "nodeFrameVisio" cpt
, reload , reload
, url } _ = do , url } _ = do
-- api = new JitsiMeetExternalAPI("visio.gargantext.org", {roomName: frame_id}) -- api = new JitsiMeetExternalAPI("visio.gargantext.org", {roomName: frame_id})
api <- T.useBox (Nothing :: Maybe JM.JitsiMeet)
ref <- R.useRef (null :: Nullable DOM.Element) ref <- R.useRef (null :: Nullable DOM.Element)
R.useEffect' $ do R.useEffect' $ do
here.log2 "[nodeFrameVisio] ref" $ R.readRef ref here.log2 "[nodeFrameVisio] ref" $ R.readRef ref
here.log2 "[nodeFrameVisio] JM.api" JM._api
pure $ H.div { ref } [ nodeFrameVisioPlaceholder { frame_id, ref, reload, url } ] case toMaybe (R.readRef ref) of
Nothing -> pure unit
type NodeFrameVisioPlaceholderProps = Just r -> do
( ref :: R.Ref (Nullable DOM.Element) api <- JM.jitsiMeetAPI (WURL.host url) { parentNode: r, roomName: frame_id }
| NodeFrameVisioProps here.log2 "[nodeFrameVisio] api" api
)
pure $ H.div { ref } [ H.text $ WURL.host url ]
nodeFrameVisioPlaceholder :: R2.Leaf NodeFrameVisioPlaceholderProps
nodeFrameVisioPlaceholder props = R.createElement nodeFrameVisioPlaceholderCpt props []
nodeFrameVisioPlaceholder :: R.Component NodeFrameVisioPlaceholderProps
nodeFrameVisioPlaceholder = here.component "nodeFrameVisioPlaceholder" cpt
where
cpt { frame_id
, ref
, url } _ = do
R.useEffect' $ do
here.log2 "[nodeFrameVisioPlaceholder] ref" $ R.readRef ref
pure $ H.text $ WURL.host url
type LoadProps = ( nodeId :: Int type LoadProps = ( nodeId :: Int
, session :: Session ) , session :: Session )
......
'use strict';
var API = require('../../src/external-deps/JitsiMeetAPI.js');
console.log('API', API);
exports._api = API;
exports._jitsiMeetAPI = function(host, options) {
return new API(host, options);
};
module Gargantext.Utils.JitsiMeet where
import Data.Function.Uncurried (Fn2, runFn2)
import DOM.Simple as DOM
import Effect (Effect)
import Effect.Uncurried (EffectFn2, runEffectFn2)
foreign import data JitsiMeet :: Type
type Jitsi =
{ parentNode :: DOM.Element
, roomName :: String }
foreign import _api :: JitsiMeet
foreign import _jitsiMeetAPI :: EffectFn2 String Jitsi JitsiMeet
jitsiMeetAPI :: String -> Jitsi -> Effect JitsiMeet
jitsiMeetAPI = runEffectFn2 _jitsiMeetAPI
--jitsiMeetAPIFn :: String -> Jitsi -> JitsiMeet
--jitsiMeetAPIFn = runFn2 _jitsiMeetAPI
This diff is collapsed.
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