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
21533aa5
Commit
21533aa5
authored
Mar 08, 2021
by
James Laver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
do the context bypass
parent
0f030aae
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
22 deletions
+22
-22
Contact.purs
src/Gargantext/Components/Nodes/Annuaire/User/Contact.purs
+4
-3
Router.purs
src/Gargantext/Components/Router.purs
+15
-16
SessionLoader.purs
src/Gargantext/Components/SessionLoader.purs
+3
-3
No files found.
src/Gargantext/Components/Nodes/Annuaire/User/Contact.purs
View file @
21533aa5
...
...
@@ -147,7 +147,7 @@ type KeyLayoutProps = ( key :: String, session :: Session | ReloadProps )
saveContactHyperdata :: Session -> Int -> HyperdataContact -> Aff Int
saveContactHyperdata session id = put session (Routes.NodeAPI Node (Just id) "")
type AnnuaireLayoutProps = ( annuaireId :: Int, session :: Session | ReloadProps )
type AnnuaireLayoutProps = ( annuaireId :: Int, session ::
R.Context
Session | ReloadProps )
type AnnuaireKeyLayoutProps = ( annuaireId :: Int | KeyLayoutProps )
...
...
@@ -157,11 +157,12 @@ contactLayout = R.createElement contactLayoutCpt
contactLayoutCpt :: R.Component AnnuaireLayoutProps
contactLayoutCpt = here.component "contactLayout" cpt where
cpt { annuaireId, frontends, nodeId, reloadForest, reloadRoot, session, tasks } _ = do
s <- R.useContext session
let key = show (sessionId s) <> "-" <> show nodeId
pure $
contactLayoutWithKey
{ annuaireId, tasks, frontends, key, nodeId
, session, reloadForest, reloadRoot }
where key = show (sessionId session) <> "-" <> show nodeId
, session: s, reloadForest, reloadRoot }
contactLayoutWithKey :: R2.Leaf AnnuaireKeyLayoutProps
contactLayoutWithKey props = R.createElement contactLayoutWithKeyCpt props []
...
...
src/Gargantext/Components/Router.purs
View file @
21533aa5
...
...
@@ -49,7 +49,7 @@ type Props = (
)
type SessionProps = (
session :: Session
session ::
R.Context
Session
, sessionId :: SessionId
| Props
)
...
...
@@ -115,32 +115,31 @@ forestedCpt = here.component "forested" cpt
authed :: Record SessionProps -> R.Element -> R.Element
authed props@{ cursors: { sessions }, session, sessionId, tasks } content =
sessionWrapper { fallback: home homeProps [],
provider
: session, sessionId, sessions }
sessionWrapper { fallback: home homeProps [],
context
: session, sessionId, sessions }
[ content, footer { } [] ]
where
homeProps = RE.pick props :: Record Props
annuaire :: R2.Component SessionNodeProps
annuaire = R.createElement annuaireCpt
annuaireCpt :: R.Component SessionNodeProps
annuaireCpt = here.component "annuaire" cpt
where
cpt props@{ nodeId, session, sessionId, tasks } _ = do
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed sessionProps $
forested props [ annuaireLayout { frontends, nodeId, session } ]
where frontends = defaultFrontends
annuaireCpt = here.component "annuaire" cpt where
cpt props@{ nodeId, session, sessionId, tasks } _ = do
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed sessionProps $
forested props [ annuaireLayout { frontends, nodeId, session } ]
where frontends = defaultFrontends
corpus :: R2.Component SessionNodeProps
corpus = R.createElement corpusCpt
corpusCpt :: R.Component SessionNodeProps
corpusCpt = here.component "corpus" cpt
where
cpt props@{ cursors: session, nodeId, session, tasks } _ = do
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed sessionProps $
forested props
[ corpusLayout { nodeId, session } ]
corpusCpt = here.component "corpus" cpt where
cpt props@{ cursors, nodeId, session, tasks } _ = do
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed sessionProps $
forested props [ corpusLayout { nodeId, session } ]
type CorpusDocumentProps = (
corpusId :: CorpusId
...
...
src/Gargantext/Components/SessionLoader.purs
View file @
21533aa5
...
...
@@ -21,7 +21,7 @@ here = R2.here "Gargantext.Components.SessionWrapper"
type Props =
(
fallback :: R.Element
,
provider :: R.Provider
Session
,
context :: R.Context
Session
, sessionId :: SessionId
, sessions :: T.Cursor Sessions
)
...
...
@@ -31,10 +31,10 @@ sessionWrapper = R.createElement sessionWrapperCpt
sessionWrapperCpt :: R.Component Props
sessionWrapperCpt = here.component "sessionWrapper" cpt where
cpt { fallback,
provider
, sessionId, sessions } content = do
cpt { fallback,
context
, sessionId, sessions } content = do
sessions' <- T.useLive T.unequal sessions
pure $ cp sessions'
where
cp sessions' = c $ Sessions.lookup sessionId sessions' where
c (Just session) = (R.provide
provider
session content)
c (Just session) = (R.provide
Context context
session content)
c Nothing = fallback
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