Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Grégoire Locqueville
purescript-gargantext
Commits
fa4d3a5b
Commit
fa4d3a5b
authored
May 25, 2022
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/401-dev-css-frame-rc0.x' into dev
parents
345b2bf6
34f33b74
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
83 additions
and
156 deletions
+83
-156
Layout.purs
src/Gargantext/Components/Frame/Layout.purs
+4
-4
Frame.purs
src/Gargantext/Components/Nodes/Frame.purs
+77
-150
Router.purs
src/Gargantext/Components/Router.purs
+2
-2
No files found.
src/Gargantext/Components/Frame/Layout.purs
View file @
fa4d3a5b
...
@@ -145,7 +145,7 @@ nodeFrameVisioCpt = here.component "nodeFrameVisio" cpt where
...
@@ -145,7 +145,7 @@ nodeFrameVisioCpt = here.component "nodeFrameVisio" cpt where
--------------------------------------------------------------
--------------------------------------------------------------
hframeUrl :: NodeType -> Base -> FrameId -> String
hframeUrl :: NodeType -> Base -> FrameId -> String
hframeUrl NodeFrameNotebook
_ frame_id =
frame_id -- Temp fix : frame_id is currently the whole url created
hframeUrl NodeFrameNotebook
base frame_id = base <> "/" <>
frame_id -- Temp fix : frame_id is currently the whole url created
hframeUrl NodeFrameCalc base frame_id = base <> "/" <> frame_id
hframeUrl NodeFrameCalc base frame_id = base <> "/" <> frame_id
hframeUrl NodeFrameVisio base frame_id = base <> "/" <> frame_id
hframeUrl NodeFrameVisio base frame_id = base <> "/" <> frame_id
hframeUrl _ base frame_id = base <> "/" <> frame_id <> "?view" -- "?both"
hframeUrl _ base frame_id = base <> "/" <> frame_id <> "?view" -- "?both"
src/Gargantext/Components/Nodes/Frame.purs
View file @
fa4d3a5b
module Gargantext.Components.Nodes.Frame where
module Gargantext.Components.Nodes.Frame
( node
) where
import Gargantext.Prelude
import Gargantext.Prelude
import DOM.Simple as DOM
import Data.Maybe (Maybe(..), isJust)
import Data.Eq.Generic (genericEq)
import Data.Tuple.Nested ((/\))
import Data.Generic.Rep (class Generic)
import Gargantext.Components.Bootstrap as B
import Data.Maybe (Maybe(..))
import Gargantext.Components.Frame.Layout (layout)
import Data.Newtype (class Newtype)
import Gargantext.Components.Frame.Types (Hyperdata)
import Data.Nullable (Nullable, null, toMaybe)
import Gargantext.Components.Node (NodePoly)
import Data.Show.Generic (genericShow)
import Gargantext.Components.FolderView as FV
import Gargantext.Components.Node (NodePoly(..))
import Gargantext.Config.REST (AffRESTError, logRESTError)
import Gargantext.Config.REST (AffRESTError, logRESTError)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoaderEffect)
import Gargantext.Hooks.Session (useSession)
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Sessions (Session, get
, sessionId
)
import Gargantext.Sessions (Session, get)
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
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Simple.JSON as JSON
import Toestand as T
import Web.URL as WURL
here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Frame"
newtype Hyperdata = Hyperdata { base :: String, frame_id :: String }
derive instance Generic Hyperdata _
derive instance Newtype Hyperdata _
instance Eq Hyperdata where eq = genericEq
instance Show Hyperdata where show = genericShow
derive newtype instance JSON.ReadForeign Hyperdata
derive newtype instance JSON.WriteForeign Hyperdata
type Props =
type Props =
( nodeId :: Int
( nodeId :: Int
, nodeType :: NodeType
, nodeType :: NodeType
, session :: Session
)
type KeyProps =
( key :: String
| Props
)
)
frameLayout :: R2.Leaf Props
here :: R2.Here
frameLayout = R2.leafComponent frameLayoutCpt
here = R2.here "Gargantext.Components.Nodes.Frame"
frameLayoutCpt :: R.Component Props
frameLayoutCpt = here.component "frameLayout" cpt where
cpt { nodeId, nodeType, session } _ = do
pure $ frameLayoutWithKey { key, nodeId, nodeType, session }
where
key = show (sessionId session) <> "-" <> show nodeId
frameLayoutWithKey :: R2.Leaf KeyProps
frameLayoutWithKey = R2.leafComponent frameLayoutWithKeyCpt
frameLayoutWithKeyCpt :: R.Component KeyProps
frameLayoutWithKeyCpt = here.component "frameLayoutWithKey" cpt where
cpt { nodeId, session, nodeType} _ = do
reload <- T.useBox T2.newReload
reload' <- T.useLive T.unequal reload
useLoader { errorHandler
, loader: loadframeWithReload
, path: {nodeId, reload: reload', session}
, render: \frame -> frameLayoutView {frame, nodeId, reload, session, nodeType} }
where
errorHandler = logRESTError here "[frameLayoutWithKey]"
type ViewProps =
( frame :: NodePoly Hyperdata
, reload :: T2.ReloadS
, nodeId :: Int
, nodeType :: NodeType
, session :: Session
)
type Base = String
type FrameId = String
node :: R2.Leaf ( key :: String | Props )
node = R2.leaf nodeCpt
hframeUrl :: NodeType -> Base -> FrameId -> String
nodeCpt :: R.Component ( key :: String | Props )
hframeUrl NodeFrameNotebook base frame_id = base <> "/" <> frame_id -- Temp fix : frame_id is currently the whole url created
nodeCpt = here.component "node" cpt where
hframeUrl NodeFrameCalc base frame_id = base <> "/" <> frame_id
cpt { nodeId
hframeUrl NodeFrameVisio base frame_id = base <> "/" <> frame_id
, nodeType
hframeUrl _ base frame_id = base <> "/" <> frame_id <> "?view" -- "?both"
} _ = do
-- | States
-- |
session <- useSession
state' /\ state <- R2.useBox' Nothing
reload' /\ reload <- R2.useBox' T2.newReload
-- | Hooks
-- |
useLoaderEffect
{ errorHandler: logRESTError here "[frameLayout]"
, loader: loadframeWithReload
, path:
{ nodeId
, reload: reload'
, session
}
, state
}
frameLayoutView :: R2.Leaf ViewProps
-- | Render
frameLayoutView = R2.leafComponent frameLayoutViewCpt
-- |
frameLayoutViewCpt :: R.Component ViewProps
pure $
frameLayoutViewCpt = here.component "frameLayoutView" cpt
where
B.cloak
cpt { frame: NodePoly { hyperdata: h@(Hyperdata { base, frame_id }) }
{ isDisplayed: isJust state'
, idlingPhaseDuration: Just 150
, cloakSlot:
B.preloader
{}
, defaultSlot:
R2.fromMaybe state' \frame ->
layout
{ frame
, nodeId
, nodeId
, nodeType
, reload
, reload
, session } _ = do
, nodeType
case nodeType of
}
NodeFrameVisio ->
case WURL.fromAbsolute base of
Nothing -> pure $ H.div {} [ H.text $ "Wrong base url: " <> base ]
Just url -> pure $ H.div {} [ H.h1 {} [ H.text "Visio Room"]
, H.a { className : "fa fa-video-camera fa-5x"
, href : hframeUrl nodeType base frame_id
, target: "_blank"
}
}
[]
, H.p {} [H.text "Click on the Camera logo to access to your room"]
, H.p {} [H.text "This a unique room dedicated to your team"]
, H.p {} [H.text "Works with Chromium/Chrome only for now."]
]
-- pure $ nodeFrameVisio' { frame_id, reload, url }
_ ->
pure $ H.div{}
[ FV.backButton {} []
, H.div { className : "frame"
, rows: "100%,*" }
[ -- H.script { src: "https://visio.gargantext.org/external_api.js"} [],
H.iframe { src: hframeUrl nodeType base frame_id
, width: "100%"
, height: "100%"
} []
]
]
type NodeFrameVisioProps =
( frame_id :: String
, reload :: T2.ReloadS
, url :: WURL.URL
)
nodeFrameVisio :: R2.Leaf NodeFrameVisioProps
nodeFrameVisio = R2.leafComponent nodeFrameVisioCpt
nodeFrameVisioCpt :: R.Component NodeFrameVisioProps
nodeFrameVisioCpt = here.component "nodeFrameVisio" cpt
where
cpt { frame_id
, url } _ = do
ref <- R.useRef (null :: Nullable DOM.Element)
R.useEffect' $ do
here.log2 "[nodeFrameVisio] ref" $ R.readRef ref
here.log2 "[nodeFrameVisio] JM.api" JM._api
case toMaybe (R.readRef ref) of
Nothing -> pure unit
Just r -> do
api <- JM.jitsiMeetAPI (WURL.host url) { parentNode: r
, roomName: frame_id
, width: "100%"
, height: "100%" }
here.log2 "[nodeFrameVisio] api" api
pure $ H.div { ref, className: "jitsi-iframe" } [ ]
type LoadProps = ( nodeId :: Int
-----------------------------------------------------------
, session :: Session )
type ReloadProps = ( nodeId :: Int
type LoadProps =
, reload :: T2.Reload
( nodeId :: Int
, session :: Session )
, session :: Session
)
loadframe' :: Record LoadProps -> AffRESTError (NodePoly Hyperdata)
type ReloadProps =
loadframe' { nodeId, session } = get session $ NodeAPI Node (Just nodeId) ""
( reload :: T2.Reload
| LoadProps
)
-- Just to make reloading effective
-- Just to make reloading effective
loadframeWithReload :: Record ReloadProps -> AffRESTError (NodePoly Hyperdata)
loadframeWithReload :: Record ReloadProps -> AffRESTError (NodePoly Hyperdata)
loadframeWithReload { nodeId, session } = loadframe' { nodeId, session }
loadframeWithReload { nodeId, session } = loadframe { nodeId, session }
loadframe :: Record LoadProps -> AffRESTError (NodePoly Hyperdata)
loadframe { nodeId, session } = get session $ NodeAPI Node (Just nodeId) ""
src/Gargantext/Components/Router.purs
View file @
fa4d3a5b
...
@@ -604,10 +604,10 @@ routeFrameCpt = here.component "routeFrame" cpt where
...
@@ -604,10 +604,10 @@ routeFrameCpt = here.component "routeFrame" cpt where
Record.merge
Record.merge
{ content:
{ content:
\session ->
\session ->
Frame.
frameLayout
Frame.
node
{ nodeId
{ nodeId
, nodeType
, nodeType
,
session
,
key: show (sessionId session) <> "-" <> show nodeId
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment