Commit a07f4b19 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[texts] side panel floating style

parent 314170b4
#page-wrapper .cache-toggle { #page-wrapper .cache-toggle {
cursor: pointer; cursor: pointer;
} }
#page-wrapper .side-panel {
background-color: white;
left: 70%;
padding: 5px;
position: fixed;
top: 60px;
width: 28%;
}
.simple-layout { .simple-layout {
height: 100%; height: 100%;
......
#page-wrapper #page-wrapper
.cache-toggle .cache-toggle
cursor: pointer cursor: pointer
.side-panel
background-color: white
left: 70%
padding: 5px
position: fixed
top: 60px
width: 28%
.simple-layout .simple-layout
height: 100% height: 100%
......
...@@ -16,7 +16,7 @@ import Gargantext.Components.Nodes.Annuaire (annuaireLayout) ...@@ -16,7 +16,7 @@ import Gargantext.Components.Nodes.Annuaire (annuaireLayout)
import Gargantext.Components.Nodes.Annuaire.User.Contacts (annuaireUserLayout, userLayout) import Gargantext.Components.Nodes.Annuaire.User.Contacts (annuaireUserLayout, userLayout)
import Gargantext.Components.Nodes.Corpus (corpusLayout) import Gargantext.Components.Nodes.Corpus (corpusLayout)
import Gargantext.Components.Nodes.Corpus.Dashboard (dashboardLayout) import Gargantext.Components.Nodes.Corpus.Dashboard (dashboardLayout)
import Gargantext.Components.Nodes.Corpus.Document (documentLayout) import Gargantext.Components.Nodes.Corpus.Document (documentMainLayout)
import Gargantext.Components.Nodes.File (fileLayout) import Gargantext.Components.Nodes.File (fileLayout)
import Gargantext.Components.Nodes.Frame (frameLayout) import Gargantext.Components.Nodes.Frame (frameLayout)
import Gargantext.Components.Nodes.Home (homeLayout) import Gargantext.Components.Nodes.Home (homeLayout)
...@@ -116,7 +116,7 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where ...@@ -116,7 +116,7 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where
corpusLayout { nodeId, session } corpusLayout { nodeId, session }
] ]
CorpusDocument sid corpusId listId nodeId -> withSession sid $ \session -> forested [ CorpusDocument sid corpusId listId nodeId -> withSession sid $ \session -> forested [
documentLayout { listId, mCorpusId: Just corpusId, nodeId, session } [] documentMainLayout { listId, mCorpusId: Just corpusId, nodeId, session } []
] ]
Dashboard sid nodeId -> withSession sid $ \session -> forested [ Dashboard sid nodeId -> withSession sid $ \session -> forested [
dashboardLayout { nodeId, session } dashboardLayout { nodeId, session }
...@@ -124,7 +124,7 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where ...@@ -124,7 +124,7 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where
Document sid listId nodeId -> Document sid listId nodeId ->
withSession sid $ withSession sid $
\session -> forested [ \session -> forested [
documentLayout { listId, mCorpusId: Nothing, nodeId, session } [] documentMainLayout { listId, mCorpusId: Nothing, nodeId, session } []
] ]
Folder sid nodeId -> withSession sid $ \session -> forested [ corpusLayout { nodeId, session } ] Folder sid nodeId -> withSession sid $ \session -> forested [ corpusLayout { nodeId, session } ]
FolderPrivate sid nodeId -> withSession sid $ \session -> forested [ corpusLayout { nodeId, session } ] FolderPrivate sid nodeId -> withSession sid $ \session -> forested [ corpusLayout { nodeId, session } ]
......
...@@ -42,10 +42,10 @@ docViewWrapper = R.createElement docViewWrapperCpt ...@@ -42,10 +42,10 @@ docViewWrapper = R.createElement docViewWrapperCpt
docViewWrapperCpt :: R.Component Props docViewWrapperCpt :: R.Component Props
docViewWrapperCpt = R.hooksComponentWithModule thisModule "docViewWrapper" cpt docViewWrapperCpt = R.hooksComponentWithModule thisModule "docViewWrapper" cpt
where where
cpt { loaded, path } _ = do cpt props@{ loaded } _ = do
state <- R.useState' $ initialState { loaded } state <- R.useState' $ initialState { loaded }
pure $ docView { loaded, path, state } [] pure $ docView (Record.merge props { state }) []
type DocViewProps = ( type DocViewProps = (
state :: R.State State state :: R.State State
...@@ -88,7 +88,7 @@ docViewCpt = R.hooksComponentWithModule thisModule "docView" cpt ...@@ -88,7 +88,7 @@ docViewCpt = R.hooksComponentWithModule thisModule "docView" cpt
[ [
R2.row R2.row
[ [
R2.col 8 R2.col 12
[ H.h4 {} [ annotate doc.title ] [ H.h4 {} [ annotate doc.title ]
, H.ul { className: "list-group" } , H.ul { className: "list-group" }
[ li' [ H.span {} [ text' doc.source ] [ li' [ H.span {} [ text' doc.source ]
...@@ -127,12 +127,25 @@ docViewCpt = R.hooksComponentWithModule thisModule "docView" cpt ...@@ -127,12 +127,25 @@ docViewCpt = R.hooksComponentWithModule thisModule "docView" cpt
NodePoly {hyperdata: Document doc} = document NodePoly {hyperdata: Document doc} = document
type LayoutProps = ( type LayoutProps = (
listId :: ListId listId :: ListId
, mCorpusId :: Maybe NodeID , mCorpusId :: Maybe NodeID
, nodeId :: NodeID , nodeId :: NodeID
, session :: Session , session :: Session
) )
documentMainLayout :: R2.Component LayoutProps
documentMainLayout = R.createElement documentMainLayoutCpt
documentMainLayoutCpt :: R.Component LayoutProps
documentMainLayoutCpt = R.hooksComponentWithModule thisModule "documentMainLayout" cpt
where
cpt props _ = do
pure $ R2.row [
R2.col 10 [
documentLayout props []
]
]
documentLayout :: R2.Component LayoutProps documentLayout :: R2.Component LayoutProps
documentLayout = R.createElement documentLayoutCpt documentLayout = R.createElement documentLayoutCpt
......
...@@ -28,8 +28,8 @@ type LoadedData = ...@@ -28,8 +28,8 @@ type LoadedData =
} }
type Props = ( type Props = (
loaded :: LoadedData loaded :: LoadedData
, path :: DocPath , path :: DocPath
) )
-- This is a subpart of NgramsTable.State. -- This is a subpart of NgramsTable.State.
......
...@@ -4,7 +4,7 @@ import Prelude ...@@ -4,7 +4,7 @@ import Prelude
import Data.Generic.Rep (class Generic) import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Show (genericShow) import Data.Generic.Rep.Show (genericShow)
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
import Data.Tuple (fst) import Data.Tuple (fst, snd)
import Data.Tuple.Nested ((/\)) import Data.Tuple.Nested ((/\))
import DOM.Simple.Console (log, log2) import DOM.Simple.Console (log, log2)
import Effect (Effect) import Effect (Effect)
...@@ -52,6 +52,11 @@ textsWithForestCpt = R.hooksComponentWithModule thisModule "textsWithForest" cpt ...@@ -52,6 +52,11 @@ textsWithForestCpt = R.hooksComponentWithModule thisModule "textsWithForest" cpt
, textsProps: textProps@{ session } } _ = do , textsProps: textProps@{ session } } _ = do
controls <- initialControls controls <- initialControls
R.useEffect' $ do
let trigger _ = do
snd controls.showSidePanel $ const InitialClosed
R2.setTrigger controls.triggers.triggerSidePanel trigger
pure $ Forest.forestLayoutWithTopBar forestProps [ pure $ Forest.forestLayoutWithTopBar forestProps [
topBar { controls } [] topBar { controls } []
, H.div { className: "col-md-10" } [ , H.div { className: "col-md-10" } [
...@@ -61,7 +66,7 @@ textsWithForestCpt = R.hooksComponentWithModule thisModule "textsWithForest" cpt ...@@ -61,7 +66,7 @@ textsWithForestCpt = R.hooksComponentWithModule thisModule "textsWithForest" cpt
] ]
] ]
] ]
, H.div { className: "col-md-2" } [ , H.div { className: "side-panel" } [
sidePanel { controls, session } [] sidePanel { controls, session } []
] ]
] ]
...@@ -218,14 +223,14 @@ tabsCpt = R.hooksComponentWithModule thisModule "tabs" cpt ...@@ -218,14 +223,14 @@ tabsCpt = R.hooksComponentWithModule thisModule "tabs" cpt
, sidePanelTriggers } [] , sidePanelTriggers } []
type DocViewProps a = ( type DocViewProps a = (
cacheState :: R.State NT.CacheState cacheState :: R.State NT.CacheState
, corpusData :: CorpusData , corpusData :: CorpusData
, corpusId :: NodeID , corpusId :: NodeID
, frontends :: Frontends , frontends :: Frontends
, listId :: ListId , listId :: ListId
-- , path :: Record DT.Path -- , path :: Record DT.Path
, session :: Session , session :: Session
, tabType :: TabSubType a , tabType :: TabSubType a
, sidePanelTriggers :: Record SidePanelTriggers , sidePanelTriggers :: Record SidePanelTriggers
) )
...@@ -355,12 +360,9 @@ sidePanel = R.createElement sidePanelCpt ...@@ -355,12 +360,9 @@ sidePanel = R.createElement sidePanelCpt
sidePanelCpt :: R.Component SidePanelProps sidePanelCpt :: R.Component SidePanelProps
sidePanelCpt = R.hooksComponentWithModule thisModule "sidePanel" cpt sidePanelCpt = R.hooksComponentWithModule thisModule "sidePanel" cpt
where where
cpt { controls: { showSidePanel: (InitialClosed /\ _) } } _ = do cpt { controls: { showSidePanel: (showSidePanel /\ _)
pure $ H.div {} [] , triggers: { triggerAnnotatedDocIdChange
cpt { controls: { showSidePanel: (Closed /\ _) } } _ = do , triggerSidePanel } }
pure $ H.div {} []
cpt { controls: { showSidePanel: (Opened /\ _)
, triggers: { triggerAnnotatedDocIdChange } }
, session } _ = do , session } _ = do
(mCorpusId /\ setMCorpusId) <- R.useState' Nothing (mCorpusId /\ setMCorpusId) <- R.useState' Nothing
(mListId /\ setMListId) <- R.useState' Nothing (mListId /\ setMListId) <- R.useState' Nothing
...@@ -372,9 +374,11 @@ sidePanelCpt = R.hooksComponentWithModule thisModule "sidePanel" cpt ...@@ -372,9 +374,11 @@ sidePanelCpt = R.hooksComponentWithModule thisModule "sidePanel" cpt
-- log2 "[sidePanel trigger] trigger corpusId change" corpusId -- log2 "[sidePanel trigger] trigger corpusId change" corpusId
-- log2 "[sidePanel trigger] trigger listId change" listId -- log2 "[sidePanel trigger] trigger listId change" listId
-- log2 "[sidePanel trigger] trigger nodeId change" nodeId -- log2 "[sidePanel trigger] trigger nodeId change" nodeId
-- TODO work on this?
setMCorpusId $ const $ Just corpusId setMCorpusId $ const $ Just corpusId
setMListId $ const $ Just listId setMListId $ const $ Just listId
setMNodeId $ const $ Just nodeId setMNodeId $ const $ Just nodeId
R2.callTrigger triggerSidePanel unit
-- log2 "[sidePanel] trigger" trigger -- log2 "[sidePanel] trigger" trigger
R2.setTrigger triggerAnnotatedDocIdChange trigger R2.setTrigger triggerAnnotatedDocIdChange trigger
...@@ -382,7 +386,11 @@ sidePanelCpt = R.hooksComponentWithModule thisModule "sidePanel" cpt ...@@ -382,7 +386,11 @@ sidePanelCpt = R.hooksComponentWithModule thisModule "sidePanel" cpt
-- log "[sidePanel] clearing triggerAnnotatedDocIdChange" -- log "[sidePanel] clearing triggerAnnotatedDocIdChange"
R2.clearTrigger triggerAnnotatedDocIdChange R2.clearTrigger triggerAnnotatedDocIdChange
pure $ H.div { className: "side-panel" } [ let mainStyle = case showSidePanel of
Opened -> { display: "block" }
_ -> { display: "none" }
pure $ H.div { style: mainStyle } [
sidePanelDocView { mCorpusId, mListId, mNodeId, session } [] sidePanelDocView { mCorpusId, mListId, mNodeId, session } []
] ]
...@@ -390,7 +398,7 @@ type SidePanelDocView = ( ...@@ -390,7 +398,7 @@ type SidePanelDocView = (
mCorpusId :: Maybe NodeID mCorpusId :: Maybe NodeID
, mListId :: Maybe ListId , mListId :: Maybe ListId
, mNodeId :: Maybe NodeID , mNodeId :: Maybe NodeID
, session :: Session , session :: Session
) )
sidePanelDocView :: R2.Component SidePanelDocView sidePanelDocView :: R2.Component SidePanelDocView
...@@ -408,6 +416,9 @@ sidePanelDocViewCpt = R.hooksComponentWithModule thisModule "sidePanel" cpt ...@@ -408,6 +416,9 @@ sidePanelDocViewCpt = R.hooksComponentWithModule thisModule "sidePanel" cpt
, mNodeId: Just nodeId , mNodeId: Just nodeId
, session } _ = do , session } _ = do
-- pure $ H.h4 {} [ H.text txt ] -- pure $ H.h4 {} [ H.text txt ]
pure $ D.documentLayout { listId, mCorpusId, nodeId, session } [] pure $ D.documentLayout { listId
, mCorpusId
, nodeId
, session } []
where where
txt = "mCorpusId: " <> show mCorpusId <> ", listId: " <> show listId <> ", nodeId: " <> show nodeId txt = "mCorpusId: " <> show mCorpusId <> ", listId: " <> show listId <> ", nodeId: " <> show nodeId
...@@ -46,7 +46,7 @@ type TextsLayoutControls = ( ...@@ -46,7 +46,7 @@ type TextsLayoutControls = (
initialControls :: R.Hooks (Record TextsLayoutControls) initialControls :: R.Hooks (Record TextsLayoutControls)
initialControls = do initialControls = do
showSidePanel <- R.useState' InitialClosed showSidePanel <- R.useState' Opened
triggers <- emptySidePanelTriggers triggers <- emptySidePanelTriggers
pure $ { pure $ {
......
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