Commit e984d3dc authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[router] refactoring of sessions (no more context)

parent b27a7f6e
...@@ -11,7 +11,7 @@ import Gargantext.Components.Nodes.Texts.Types as TextsT ...@@ -11,7 +11,7 @@ import Gargantext.Components.Nodes.Texts.Types as TextsT
import Gargantext.Ends (Backend) import Gargantext.Ends (Backend)
import Gargantext.Routes (AppRoute(Home)) import Gargantext.Routes (AppRoute(Home))
import Gargantext.Sessions as Sessions import Gargantext.Sessions as Sessions
import Gargantext.Sessions (OpenNodes, Sessions) import Gargantext.Sessions (OpenNodes, Session, Sessions)
import Gargantext.Types (Handed(RightHanded), SidePanelState(..)) import Gargantext.Types (Handed(RightHanded), SidePanelState(..))
import Gargantext.Utils.Toestand as T2 import Gargantext.Utils.Toestand as T2
...@@ -24,6 +24,7 @@ type App = ...@@ -24,6 +24,7 @@ type App =
, reloadMainPage :: T2.Reload , reloadMainPage :: T2.Reload
, reloadRoot :: T2.Reload , reloadRoot :: T2.Reload
, route :: AppRoute , route :: AppRoute
, session :: Maybe Session
, sessions :: Sessions , sessions :: Sessions
, showCorpus :: Boolean , showCorpus :: Boolean
, showLogin :: Boolean , showLogin :: Boolean
...@@ -45,6 +46,7 @@ emptyApp = ...@@ -45,6 +46,7 @@ emptyApp =
, reloadMainPage : T2.newReload , reloadMainPage : T2.newReload
, reloadRoot : T2.newReload , reloadRoot : T2.newReload
, route : Home , route : Home
, session : Nothing
, sessions : Sessions.empty , sessions : Sessions.empty
, showCorpus : false , showCorpus : false
, showLogin : false , showLogin : false
...@@ -65,6 +67,7 @@ type Boxes = ...@@ -65,6 +67,7 @@ type Boxes =
, reloadMainPage :: T2.ReloadS , reloadMainPage :: T2.ReloadS
, reloadRoot :: T2.ReloadS , reloadRoot :: T2.ReloadS
, route :: T.Box AppRoute , route :: T.Box AppRoute
, session :: T.Box (Maybe Session)
, sessions :: T.Box Sessions , sessions :: T.Box Sessions
, showCorpus :: T.Box Boolean , showCorpus :: T.Box Boolean
, showLogin :: T.Box Boolean , showLogin :: T.Box Boolean
......
...@@ -379,18 +379,19 @@ pagePaintRawCpt = here.component "pagePaintRawCpt" cpt where ...@@ -379,18 +379,19 @@ pagePaintRawCpt = here.component "pagePaintRawCpt" cpt where
, totalRecords } , totalRecords }
, localCategories , localCategories
, params } _ = do , params } _ = do
reload <- T.useBox T2.newReload reload <- T.useBox T2.newReload
localCategories' <- T.useLive T.unequal localCategories localCategories' <- T.useLive T.unequal localCategories
sidePanel' <- T.useLive T.unequal sidePanel mCurrentDocId <- T.useFocused
let mCurrentDocId = maybe Nothing (_.mCurrentDocId) sidePanel' (maybe Nothing _.mCurrentDocId)
(\val -> maybe Nothing (\sp -> Just $ sp { mCurrentDocId = val })) sidePanel
mCurrentDocId' <- T.useLive T.unequal mCurrentDocId
pure $ TT.table pure $ TT.table
{ colNames { colNames
, container: TT.defaultContainer { title: "Documents" } , container: TT.defaultContainer { title: "Documents" }
, params , params
, rows: rows reload localCategories' mCurrentDocId , rows: rows reload localCategories' mCurrentDocId'
, syncResetButton : [ H.div {} [] ] , syncResetButton : [ H.div {} [] ]
, totalRecords , totalRecords
, wrapColElts , wrapColElts
...@@ -407,7 +408,7 @@ pagePaintRawCpt = here.component "pagePaintRawCpt" cpt where ...@@ -407,7 +408,7 @@ pagePaintRawCpt = here.component "pagePaintRawCpt" cpt where
| otherwise = Routes.Document sid listId | otherwise = Routes.Document sid listId
colNames = TT.ColumnName <$> [ "Show", "Tag", "Date", "Title", "Source", "Score" ] colNames = TT.ColumnName <$> [ "Show", "Tag", "Date", "Title", "Source", "Score" ]
wrapColElts = const identity wrapColElts = const identity
rows reload localCategories' mCurrentDocId = row <$> A.toUnfoldable documents rows reload localCategories' mCurrentDocId' = row <$> A.toUnfoldable documents
where where
row dv@(DocumentsView r@{ _id, category }) = row dv@(DocumentsView r@{ _id, category }) =
{ row: { row:
...@@ -444,7 +445,7 @@ pagePaintRawCpt = here.component "pagePaintRawCpt" cpt where ...@@ -444,7 +445,7 @@ pagePaintRawCpt = here.component "pagePaintRawCpt" cpt where
-- checked = Star_1 == cat -- checked = Star_1 == cat
tClassName = trashClassName cat selected tClassName = trashClassName cat selected
className = gi cat className = gi cat
selected = mCurrentDocId == Just r._id selected = mCurrentDocId' == Just r._id
type DocChooser = ( type DocChooser = (
listId :: ListId listId :: ListId
......
...@@ -52,7 +52,6 @@ type Props = ...@@ -52,7 +52,6 @@ type Props =
type TreeExtra = ( type TreeExtra = (
forestOpen :: T.Box OpenNodes forestOpen :: T.Box OpenNodes
, session :: Session
) )
forest :: R2.Component Props forest :: R2.Component Props
......
...@@ -55,8 +55,6 @@ type BaseProps = ...@@ -55,8 +55,6 @@ type BaseProps =
, tasks :: T.Box GAT.Storage , tasks :: T.Box GAT.Storage
) )
type LayoutLoaderProps = ( session :: R.Context Session | BaseProps )
type LayoutProps = type LayoutProps =
( session :: Session ( session :: Session
| BaseProps ) | BaseProps )
...@@ -75,17 +73,6 @@ type Props = ...@@ -75,17 +73,6 @@ type Props =
) )
-------------------------------------------------------------- --------------------------------------------------------------
explorerLayoutLoader :: R2.Component LayoutLoaderProps
explorerLayoutLoader = R.createElement explorerLayoutLoaderCpt
explorerLayoutLoaderCpt :: R.Component LayoutLoaderProps
explorerLayoutLoaderCpt = here.component "explorerLayoutLoader" cpt where
cpt props _ = do
session <- R.useContext props.session -- TODO: ugh, props fiddling
let base = RX.pick props :: Record BaseProps
let props' = Record.merge base { session }
pure $ explorerLayout props' []
explorerLayout :: R2.Component LayoutProps explorerLayout :: R2.Component LayoutProps
explorerLayout = R.createElement explorerLayoutCpt explorerLayout = R.createElement explorerLayoutCpt
......
...@@ -49,7 +49,7 @@ newtype IndividuView = ...@@ -49,7 +49,7 @@ newtype IndividuView =
type LayoutProps = type LayoutProps =
( frontends :: Frontends ( frontends :: Frontends
, nodeId :: Int , nodeId :: Int
, session :: R.Context Session , session :: Session
) )
annuaireLayout :: R2.Leaf LayoutProps annuaireLayout :: R2.Leaf LayoutProps
...@@ -57,15 +57,14 @@ annuaireLayout props = R.createElement annuaireLayoutCpt props [] ...@@ -57,15 +57,14 @@ annuaireLayout props = R.createElement annuaireLayoutCpt props []
annuaireLayoutCpt :: R.Component LayoutProps annuaireLayoutCpt :: R.Component LayoutProps
annuaireLayoutCpt = here.component "annuaireLayout" cpt where annuaireLayoutCpt = here.component "annuaireLayout" cpt where
cpt { frontends, nodeId, session } _ = cp <$> R.useContext session where cpt { frontends, nodeId, session } _ = do
cp s = annuaireLayoutWithKey { frontends, key, nodeId, session: s } where pure $ annuaireLayoutWithKey { frontends, key, nodeId, session }
key = show (sessionId s) <> "-" <> show nodeId where
key = show (sessionId session) <> "-" <> show nodeId
type KeyLayoutProps = type KeyLayoutProps =
( frontends :: Frontends ( key :: String
, nodeId :: Int | LayoutProps
, session :: Session
, key :: String
) )
annuaireLayoutWithKey :: R2.Leaf KeyLayoutProps annuaireLayoutWithKey :: R2.Leaf KeyLayoutProps
......
module Gargantext.Components.Nodes.Annuaire.User module Gargantext.Components.Nodes.Annuaire.User
( module Gargantext.Components.Nodes.Annuaire.User.Contacts.Types ( module Gargantext.Components.Nodes.Annuaire.User.Contacts.Types
, userLayout , userLayout
, userLayoutSessionContext
) )
where where
...@@ -170,17 +169,6 @@ type KeyLayoutProps = ( ...@@ -170,17 +169,6 @@ type KeyLayoutProps = (
| LayoutProps | LayoutProps
) )
userLayoutSessionContext :: R2.Component LayoutSessionContextProps
userLayoutSessionContext = R.createElement userLayoutSessionContextCpt
userLayoutSessionContextCpt :: R.Component LayoutSessionContextProps
userLayoutSessionContextCpt = here.component "userLayoutSessionContext" cpt
where
cpt props@{ session } _ = do
session' <- R.useContext session
pure $ userLayout (Record.merge { session: session' } $ (REX.pick props :: Record LayoutNoSessionProps)) []
userLayout :: R2.Component LayoutProps userLayout :: R2.Component LayoutProps
userLayout = R.createElement userLayoutCpt userLayout = R.createElement userLayoutCpt
......
...@@ -160,7 +160,7 @@ type KeyLayoutProps = ( key :: String, session :: Session | ReloadProps ) ...@@ -160,7 +160,7 @@ type KeyLayoutProps = ( key :: String, session :: Session | ReloadProps )
saveContactHyperdata :: Session -> Int -> HyperdataContact -> Aff Int saveContactHyperdata :: Session -> Int -> HyperdataContact -> Aff Int
saveContactHyperdata session id = put session (Routes.NodeAPI Node (Just id) "") saveContactHyperdata session id = put session (Routes.NodeAPI Node (Just id) "")
type AnnuaireLayoutProps = ( annuaireId :: Int, session :: R.Context Session | ReloadProps ) type AnnuaireLayoutProps = ( annuaireId :: Int, session :: Session | ReloadProps )
type AnnuaireKeyLayoutProps = ( annuaireId :: Int | KeyLayoutProps ) type AnnuaireKeyLayoutProps = ( annuaireId :: Int | KeyLayoutProps )
...@@ -178,8 +178,7 @@ contactLayoutCpt = here.component "contactLayout" cpt where ...@@ -178,8 +178,7 @@ contactLayoutCpt = here.component "contactLayout" cpt where
, sidePanel , sidePanel
, sidePanelState , sidePanelState
, tasks } _ = do , tasks } _ = do
s <- R.useContext session let key = show (sessionId session) <> "-" <> show nodeId
let key = show (sessionId s) <> "-" <> show nodeId
pure $ pure $
contactLayoutWithKey contactLayoutWithKey
{ annuaireId { annuaireId
...@@ -188,7 +187,7 @@ contactLayoutCpt = here.component "contactLayout" cpt where ...@@ -188,7 +187,7 @@ contactLayoutCpt = here.component "contactLayout" cpt where
, nodeId , nodeId
, reloadForest , reloadForest
, reloadRoot , reloadRoot
, session: s , session
, sidePanel , sidePanel
, sidePanelState , sidePanelState
, tasks , tasks
......
module Gargantext.Components.Nodes.Corpus where module Gargantext.Components.Nodes.Corpus where
import Gargantext.Prelude (class Eq, class Show, Unit, bind, discard, pure, show, unit, ($), (+), (-), (<), (<$>), (<<<), (<>), (==), (>)) import DOM.Simple.Console (log2)
import Data.Argonaut (class DecodeJson, decodeJson, encodeJson) import Data.Argonaut (class DecodeJson, decodeJson, encodeJson)
import Data.Argonaut.Parser (jsonParser) import Data.Argonaut.Parser (jsonParser)
import Data.Array as A import Data.Array as A
...@@ -11,46 +11,44 @@ import Data.Generic.Rep.Show (genericShow) ...@@ -11,46 +11,44 @@ import Data.Generic.Rep.Show (genericShow)
import Data.List as List import Data.List as List
import Data.Maybe (Maybe(..), fromMaybe) import Data.Maybe (Maybe(..), fromMaybe)
import Data.Tuple (Tuple(..)) import Data.Tuple (Tuple(..))
import DOM.Simple.Console (log2)
import Effect (Effect) import Effect (Effect)
import Effect.Aff (Aff, launchAff_, throwError) import Effect.Aff (Aff, launchAff_, throwError)
import Effect.Class (liftEffect) import Effect.Class (liftEffect)
import Effect.Exception (error) import Effect.Exception (error)
import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
import Gargantext.Components.FolderView as FV
import Gargantext.Components.CodeEditor as CE import Gargantext.Components.CodeEditor as CE
import Gargantext.Components.FolderView as FV
import Gargantext.Components.Forest.Tree.Node.Action.Search.Types (doc)
import Gargantext.Components.InputWithEnter (inputWithEnter) import Gargantext.Components.InputWithEnter (inputWithEnter)
import Gargantext.Components.Node (NodePoly(..), HyperdataList) import Gargantext.Components.Node (NodePoly(..), HyperdataList)
import Gargantext.Components.Nodes.Types
( FTField, FTFieldWithIndex, FTFieldsWithIndex, Field(..), FieldType(..), Hash, Index
, defaultField, defaultHaskell', defaultJSON', defaultMarkdown', defaultPython' )
import Gargantext.Components.Nodes.Corpus.Types (CorpusData, Hyperdata(..)) import Gargantext.Components.Nodes.Corpus.Types (CorpusData, Hyperdata(..))
import Gargantext.Components.Nodes.Types (FTField, FTFieldWithIndex, FTFieldsWithIndex, Field(..), FieldType(..), Hash, Index, defaultField, defaultHaskell', defaultJSON', defaultMarkdown', defaultPython')
import Gargantext.Data.Array as GDA import Gargantext.Data.Array as GDA
import Gargantext.Hooks.Loader (useLoader) import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude (class Eq, class Show, Unit, bind, discard, pure, show, unit, ($), (+), (-), (<), (<$>), (<<<), (<>), (==), (>))
import Gargantext.Routes (SessionRoute(Children, NodeAPI)) import Gargantext.Routes (SessionRoute(Children, NodeAPI))
import Gargantext.Sessions (Session, get, put, sessionId) import Gargantext.Sessions (Session, get, put, sessionId)
import Gargantext.Types (AffTableResult, NodeType(..)) import Gargantext.Types (AffTableResult, NodeType(..))
import Gargantext.Utils.Crypto as Crypto import Gargantext.Utils.Crypto as Crypto
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.DOM.HTML as H
import Toestand as T
here :: R2.Here here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Corpus" here = R2.here "Gargantext.Components.Nodes.Corpus"
type Props = ( nodeId :: Int, session :: R.Context Session ) type Props = ( nodeId :: Int, session :: Session )
corpusLayout :: R2.Leaf Props corpusLayout :: R2.Leaf Props
corpusLayout props = R.createElement corpusLayoutCpt props [] corpusLayout props = R.createElement corpusLayoutCpt props []
corpusLayoutCpt :: R.Component Props corpusLayoutCpt :: R.Component Props
corpusLayoutCpt = here.component "corpusLayout" cpt where corpusLayoutCpt = here.component "corpusLayout" cpt where
cpt { nodeId, session } _ = cp <$> R.useContext session where cpt { nodeId, session } _ = do
cp s = corpusLayoutMain { key, nodeId, session: s } where pure $ corpusLayoutMain { key, nodeId, session }
key = show (sessionId s) <> "-" <> show nodeId where
key = show (sessionId session) <> "-" <> show nodeId
type KeyProps = type KeyProps =
( nodeId :: Int ( nodeId :: Int
......
...@@ -28,21 +28,21 @@ import Gargantext.Utils.Toestand as T2 ...@@ -28,21 +28,21 @@ import Gargantext.Utils.Toestand as T2
here :: R2.Here here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Corpus.Dashboard" here = R2.here "Gargantext.Components.Nodes.Corpus.Dashboard"
type Props = ( nodeId :: NodeID, session :: R.Context Session ) type Props = ( nodeId :: NodeID, session :: Session )
dashboardLayout :: R2.Component Props dashboardLayout :: R2.Component Props
dashboardLayout = R.createElement dashboardLayoutCpt dashboardLayout = R.createElement dashboardLayoutCpt
dashboardLayoutCpt :: R.Component Props dashboardLayoutCpt :: R.Component Props
dashboardLayoutCpt = here.component "dashboardLayout" cpt where dashboardLayoutCpt = here.component "dashboardLayout" cpt where
cpt { nodeId, session } content = cp <$> R.useContext session where cpt { nodeId, session } content = do
cp s = dashboardLayoutWithKey { key, nodeId, session: s } content where pure $ dashboardLayoutWithKey { key, nodeId, session } content
key = show (sessionId s) <> "-" <> show nodeId where
key = show (sessionId session) <> "-" <> show nodeId
type KeyProps = type KeyProps =
( key :: String ( key :: String
, nodeId :: NodeID | Props
, session :: Session
) )
dashboardLayoutWithKey :: R2.Component KeyProps dashboardLayoutWithKey :: R2.Component KeyProps
......
...@@ -118,7 +118,7 @@ type LayoutProps = ...@@ -118,7 +118,7 @@ type LayoutProps =
( listId :: ListId ( listId :: ListId
, mCorpusId :: Maybe NodeID , mCorpusId :: Maybe NodeID
, nodeId :: NodeID , nodeId :: NodeID
, session :: R.Context Session , session :: Session
) )
documentMainLayout :: R2.Component LayoutProps documentMainLayout :: R2.Component LayoutProps
...@@ -133,9 +133,10 @@ documentLayout = R.createElement documentLayoutCpt ...@@ -133,9 +133,10 @@ documentLayout = R.createElement documentLayoutCpt
documentLayoutCpt :: R.Component LayoutProps documentLayoutCpt :: R.Component LayoutProps
documentLayoutCpt = here.component "documentLayout" cpt where documentLayoutCpt = here.component "documentLayout" cpt where
cpt { listId, mCorpusId, nodeId, session } children = cp <$> R.useContext session where cpt { listId, mCorpusId, nodeId, session } children = do
cp s = documentLayoutWithKey { key, listId, mCorpusId, nodeId, session: s } children where pure $ documentLayoutWithKey { key, listId, mCorpusId, nodeId, session } children
key = show (sessionId s) <> "-" <> show nodeId where
key = show (sessionId session) <> "-" <> show nodeId
type KeyLayoutProps = type KeyLayoutProps =
( key :: String ( key :: String
......
...@@ -55,25 +55,25 @@ instance decodeFile :: DecodeJson File where ...@@ -55,25 +55,25 @@ instance decodeFile :: DecodeJson File where
hyperdata <- (obj .: "hyperdata") >>= decodeJson hyperdata <- (obj .: "hyperdata") >>= decodeJson
pure $ File { id, date, hyperdata, name } pure $ File { id, date, hyperdata, name }
type FileLayoutProps = ( nodeId :: NodeID, session :: R.Context Session ) type FileLayoutProps = ( nodeId :: NodeID, session :: Session )
fileLayout :: R2.Leaf FileLayoutProps fileLayout :: R2.Leaf FileLayoutProps
fileLayout props = R.createElement fileLayoutCpt props [] fileLayout props = R.createElement fileLayoutCpt props []
fileLayoutCpt :: R.Component FileLayoutProps fileLayoutCpt :: R.Component FileLayoutProps
fileLayoutCpt = here.component "fileLayout" cpt where fileLayoutCpt = here.component "fileLayout" cpt where
cpt { nodeId, session } _ = R.useContext session >>= cp where cpt { nodeId, session } _ = do
cp s = useLoader nodeId (loadFile s) onLoad where useLoader nodeId (loadFile session) onLoad
onLoad loaded = fileLayoutLoaded { loaded, nodeId, session: s } where where
key = show (sessionId s) <> "-" <> show nodeId onLoad loaded = fileLayoutLoaded { loaded, nodeId, session }
key = show (sessionId session) <> "-" <> show nodeId
loadFile :: Session -> NodeID -> Aff File loadFile :: Session -> NodeID -> Aff File
loadFile session nodeId = get session $ NodeAPI Node (Just nodeId) "" loadFile session nodeId = get session $ NodeAPI Node (Just nodeId) ""
type FileLayoutLoadedProps = type FileLayoutLoadedProps =
( loaded :: File ( loaded :: File
, nodeId :: Int | FileLayoutProps
, session :: Session
) )
fileLayoutLoaded :: Record FileLayoutLoadedProps -> R.Element fileLayoutLoaded :: Record FileLayoutLoadedProps -> R.Element
......
...@@ -46,15 +46,13 @@ instance encodeJsonHyperdata :: Argonaut.EncodeJson Hyperdata where ...@@ -46,15 +46,13 @@ instance encodeJsonHyperdata :: Argonaut.EncodeJson Hyperdata where
type Props = type Props =
( nodeId :: Int ( nodeId :: Int
, session :: R.Context Session
, nodeType :: NodeType , nodeType :: NodeType
, session :: Session
) )
type KeyProps = type KeyProps =
( key :: String ( key :: String
, nodeId :: Int | Props
, session :: Session
, nodeType :: NodeType
) )
frameLayout :: R2.Leaf Props frameLayout :: R2.Leaf Props
...@@ -62,9 +60,10 @@ frameLayout props = R.createElement frameLayoutCpt props [] ...@@ -62,9 +60,10 @@ frameLayout props = R.createElement frameLayoutCpt props []
frameLayoutCpt :: R.Component Props frameLayoutCpt :: R.Component Props
frameLayoutCpt = here.component "frameLayout" cpt where frameLayoutCpt = here.component "frameLayout" cpt where
cpt { nodeId, nodeType, session } _ = cp <$> R.useContext session where cpt { nodeId, nodeType, session } _ = do
cp s = frameLayoutWithKey { key, nodeId, nodeType, session: s } where pure $ frameLayoutWithKey { key, nodeId, nodeType, session }
key = show (sessionId s) <> "-" <> show nodeId where
key = show (sessionId session) <> "-" <> show nodeId
frameLayoutWithKey :: R2.Leaf KeyProps frameLayoutWithKey :: R2.Leaf KeyProps
frameLayoutWithKey props = R.createElement frameLayoutWithKeyCpt props [] frameLayoutWithKey props = R.createElement frameLayoutWithKeyCpt props []
......
...@@ -24,16 +24,6 @@ import Toestand as T ...@@ -24,16 +24,6 @@ import Toestand as T
here :: R2.Here here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Lists" here = R2.here "Gargantext.Components.Nodes.Lists"
listsWithSessionContext :: R2.Component CommonPropsSessionContext
listsWithSessionContext = R.createElement listsWithSessionContextCpt
listsWithSessionContextCpt :: R.Component CommonPropsSessionContext
listsWithSessionContextCpt = here.component "listsWithSessionContext" cpt where
cpt props@{ session, sidePanel, sidePanelState } _ = do
session' <- R.useContext session
pure $ listsLayout (Record.merge { session: session', sidePanel, sidePanelState } props) []
-------------------------------------------------------- --------------------------------------------------------
type CommonPropsNoSession = type CommonPropsNoSession =
......
...@@ -33,20 +33,6 @@ here :: R2.Here ...@@ -33,20 +33,6 @@ here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Texts" here = R2.here "Gargantext.Components.Nodes.Texts"
-------------------------------------------------------- --------------------------------------------------------
textsWithSessionContext :: R2.Component CommonPropsSessionContext
textsWithSessionContext = R.createElement textsWithSessionContextCpt
textsWithSessionContextCpt :: R.Component CommonPropsSessionContext
textsWithSessionContextCpt = here.component "textsWithSessionContext" cpt
where
cpt props@{ session, sidePanel, sidePanelState } _ = do
session' <- R.useContext session
pure $ R.fragment
[
textsLayout (Record.merge { session: session', sidePanel, sidePanelState } props) []
-- , H.div { className: "side-panel" } [ sidePanelC { session: session', sidePanel } [] ]
]
type CommonPropsNoSession = ( type CommonPropsNoSession = (
...@@ -57,7 +43,6 @@ type CommonPropsNoSession = ( ...@@ -57,7 +43,6 @@ type CommonPropsNoSession = (
) )
type Props = WithSession CommonPropsNoSession type Props = WithSession CommonPropsNoSession
type CommonPropsSessionContext = WithSessionContext CommonPropsNoSession
textsLayout :: R2.Component Props textsLayout :: R2.Component Props
...@@ -427,9 +412,7 @@ sidePanelDocViewCpt = here.component "sidePanelDocView" cpt ...@@ -427,9 +412,7 @@ sidePanelDocViewCpt = here.component "sidePanelDocView" cpt
pure $ H.div {} [] pure $ H.div {} []
cpt { mSidePanel: Just { corpusId, listId, nodeId } cpt { mSidePanel: Just { corpusId, listId, nodeId }
, session } _ = do , session } _ = do
let session' = R.createContext session
pure $ D.documentLayout { listId pure $ D.documentLayout { listId
, mCorpusId: Just corpusId , mCorpusId: Just corpusId
, nodeId , nodeId
, session: session' } [] , session } []
This diff is collapsed.
...@@ -20,8 +20,8 @@ here = R2.here "Gargantext.Components.SessionWrapper" ...@@ -20,8 +20,8 @@ here = R2.here "Gargantext.Components.SessionWrapper"
type Props = type Props =
( (
fallback :: R.Element context :: R.Context Session
, context :: R.Context Session , fallback :: R.Element
, sessionId :: SessionId , sessionId :: SessionId
, sessions :: T.Box Sessions , sessions :: T.Box Sessions
) )
......
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