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
fd66a25f
Commit
fd66a25f
authored
Nov 13, 2020
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[texts] some work on adding top bar to texts
parent
650d443f
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
269 additions
and
116 deletions
+269
-116
App.purs
src/Gargantext/Components/App.purs
+51
-20
Forest.purs
src/Gargantext/Components/Forest.purs
+29
-16
Tree.purs
src/Gargantext/Components/Forest/Tree.purs
+40
-40
ControlsToggleButton.purs
...antext/Components/GraphExplorer/ControlsToggleButton.purs
+1
-1
Lists.purs
src/Gargantext/Components/Nodes/Lists.purs
+0
-1
Texts.purs
src/Gargantext/Components/Nodes/Texts.purs
+83
-19
SidePanelToggleButton.purs
...gantext/Components/Nodes/Texts/SidePanelToggleButton.purs
+32
-0
Types.purs
src/Gargantext/Components/Nodes/Texts/Types.purs
+11
-0
SimpleLayout.purs
src/Gargantext/Components/SimpleLayout.purs
+1
-1
TopBar.purs
src/Gargantext/Components/TopBar.purs
+18
-17
Sessions.purs
src/Gargantext/Sessions.purs
+3
-1
No files found.
src/Gargantext/Components/App.purs
View file @
fd66a25f
...
@@ -3,12 +3,14 @@ module Gargantext.Components.App where
...
@@ -3,12 +3,14 @@ module Gargantext.Components.App where
import Data.Array (fromFoldable)
import Data.Array (fromFoldable)
import Data.Maybe (Maybe(..), maybe')
import Data.Maybe (Maybe(..), maybe')
import Data.Tuple (fst, snd)
import Data.Tuple (fst, snd)
import Data.Tuple.Nested ((/\))
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Gargantext.Prelude
import Gargantext.Prelude
import Gargantext.Components.Footer (footer)
import Gargantext.Components.Footer (footer)
import Gargantext.Components.Forest (forestLayout)
import Gargantext.Components.Forest (forestLayout
, forestLayoutWithTopBar
)
import Gargantext.Components.GraphExplorer (explorerLayout)
import Gargantext.Components.GraphExplorer (explorerLayout)
import Gargantext.Components.Lang (LandingLang(..))
import Gargantext.Components.Lang (LandingLang(..))
import Gargantext.Components.Login (login)
import Gargantext.Components.Login (login)
...
@@ -21,7 +23,7 @@ import Gargantext.Components.Nodes.File (fileLayout)
...
@@ -21,7 +23,7 @@ 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)
import Gargantext.Components.Nodes.Lists (listsLayout)
import Gargantext.Components.Nodes.Lists (listsLayout)
import Gargantext.Components.Nodes.Texts
(textsLayout)
import Gargantext.Components.Nodes.Texts
as Texts
import Gargantext.Components.SimpleLayout (simpleLayout)
import Gargantext.Components.SimpleLayout (simpleLayout)
import Gargantext.Config (defaultFrontends, defaultBackends, publicBackend)
import Gargantext.Config (defaultFrontends, defaultBackends, publicBackend)
import Gargantext.Hooks.Router (useHashRouter)
import Gargantext.Hooks.Router (useHashRouter)
...
@@ -30,6 +32,7 @@ import Gargantext.Routes (AppRoute(..))
...
@@ -30,6 +32,7 @@ import Gargantext.Routes (AppRoute(..))
import Gargantext.Sessions (useSessions)
import Gargantext.Sessions (useSessions)
import Gargantext.Sessions as Sessions
import Gargantext.Sessions as Sessions
import Gargantext.Types as GT
import Gargantext.Types as GT
import Gargantext.Utils.Reactix as R2
thisModule :: String
thisModule :: String
thisModule = "Gargantext.Components.App"
thisModule = "Gargantext.Components.App"
...
@@ -53,7 +56,7 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where
...
@@ -53,7 +56,7 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where
showLogin <- R.useState' false
showLogin <- R.useState' false
backend <- R.useState' Nothing
backend <- R.useState' Nothing
reload
<- R.useState' 0
appReload
<- R.useState' 0
showCorpus <- R.useState' false
showCorpus <- R.useState' false
...
@@ -61,7 +64,17 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where
...
@@ -61,7 +64,17 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where
let backends = fromFoldable defaultBackends
let backends = fromFoldable defaultBackends
let ff f session = R.fragment [ f session, footer { session } ]
let ff f session = R.fragment [ f session, footer { session } ]
let forested = forestLayout { appReload: reload
let forested = forestLayout { appReload
, asyncTasksRef
, backend
, frontends
, handed
, route: fst route
, sessions: fst sessions
, showLogin: snd showLogin
, treeReloadRef
}
let forestedTB = forestLayoutWithTopBar { appReload
, asyncTasksRef
, asyncTasksRef
, backend
, backend
, frontends
, frontends
...
@@ -94,7 +107,7 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where
...
@@ -94,7 +107,7 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where
ContactPage sid aId nodeId -> withSession sid $ \session -> forested [
ContactPage sid aId nodeId -> withSession sid $ \session -> forested [
annuaireUserLayout {
annuaireUserLayout {
annuaireId: aId
annuaireId: aId
, appReload
: reload
, appReload
, asyncTasksRef
, asyncTasksRef
, frontends
, frontends
, nodeId
, nodeId
...
@@ -123,9 +136,10 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where
...
@@ -123,9 +136,10 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where
Home -> forested [
Home -> forested [
homeLayout { backend, lang: LL_EN, publicBackend, sessions, visible: showLogin }
homeLayout { backend, lang: LL_EN, publicBackend, sessions, visible: showLogin }
]
]
Lists sid nodeId -> withSession sid $ \session -> forested [
Lists sid nodeId -> withSession sid $
\session -> forested [
listsLayout {
listsLayout {
appReload: r
eload
appR
eload
, asyncTasksRef
, asyncTasksRef
, nodeId
, nodeId
, session
, session
...
@@ -162,12 +176,29 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where
...
@@ -162,12 +176,29 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where
Team sid nodeId -> withSession sid $ \session -> forested [
Team sid nodeId -> withSession sid $ \session -> forested [
corpusLayout { nodeId, session }
corpusLayout { nodeId, session }
]
]
Texts sid nodeId -> withSession sid $ \session -> forested [
Texts sid nodeId -> withSession sid $
textsLayout { frontends, nodeId, session, sessionUpdate }
\session -> Texts.textsWithForest {
]
forestProps: {
appReload
, asyncTasksRef
, backend
, frontends
, handed
, route: fst route
, sessions: fst sessions
, showLogin: snd showLogin
, treeReloadRef
}
, textsProps: {
frontends
, nodeId
, session
, sessionUpdate
}
} []
UserPage sid nodeId -> withSession sid $ \session -> forested [
UserPage sid nodeId -> withSession sid $ \session -> forested [
userLayout {
userLayout {
appReload
: reload
appReload
, asyncTasksRef
, asyncTasksRef
, frontends
, frontends
, nodeId
, nodeId
...
...
src/Gargantext/Components/Forest.purs
View file @
fd66a25f
module Gargantext.Components.Forest where
module Gargantext.Components.Forest where
import Data.Array
(reverse)
import Data.Array
as A
import Data.Tuple (fst)
import Data.Tuple (fst)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..)
, fromMaybe
)
import Data.Set as Set
import Data.Set as Set
import Data.Tuple (fst, snd)
import Data.Tuple (fst, snd)
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
...
@@ -133,7 +133,20 @@ forestLayoutCpt :: R.Component ForestLayoutProps
...
@@ -133,7 +133,20 @@ forestLayoutCpt :: R.Component ForestLayoutProps
forestLayoutCpt = R.hooksComponentWithModule thisModule "forestLayout" cpt
forestLayoutCpt = R.hooksComponentWithModule thisModule "forestLayout" cpt
where
where
cpt props@{ handed } children = do
cpt props@{ handed } children = do
pure $ R.fragment [ topBar { handed }, forestLayoutMain props children ]
pure $ R.fragment [ topBar { handed } [], forestLayoutMain props children ]
-- a component, for which first child element is placed inside the top bar
-- while the remaining ones are put into the main view
forestLayoutWithTopBar :: R2.Component ForestLayoutProps
forestLayoutWithTopBar props = R.createElement forestLayoutWithTopBarCpt props
forestLayoutWithTopBarCpt :: R.Component ForestLayoutProps
forestLayoutWithTopBarCpt = R.hooksComponentWithModule thisModule "forestLayoutWithTopBar" cpt
where
cpt props@{ handed } children = do
let { head: topBarChild, tail: mainChildren } =
fromMaybe { head: H.div {} [], tail: [] } $ A.uncons children
pure $ R.fragment [ topBar { handed } [ topBarChild ], forestLayoutMain props mainChildren ]
forestLayoutMain :: R2.Component ForestLayoutProps
forestLayoutMain :: R2.Component ForestLayoutProps
forestLayoutMain props = R.createElement forestLayoutMainCpt props
forestLayoutMain props = R.createElement forestLayoutMainCpt props
...
@@ -152,12 +165,12 @@ forestLayoutMainCpt = R.hooksComponentWithModule thisModule "forestLayoutMain" c
...
@@ -152,12 +165,12 @@ forestLayoutMainCpt = R.hooksComponentWithModule thisModule "forestLayoutMain" c
, treeReloadRef } children = do
, treeReloadRef } children = do
let ordering =
let ordering =
case fst handed of
case fst handed of
LeftHanded -> reverse
LeftHanded ->
A.
reverse
RightHanded -> identity
RightHanded -> identity
pure $ R2.row $ ordering [
pure $ R2.row $ ordering [
H.div { className: "col-md-2", style: { paddingTop: "60px" } }
H.div { className: "col-md-2", style: { paddingTop: "60px" } }
[
[
forest { appReload
forest { appReload
, asyncTasksRef
, asyncTasksRef
, backend
, backend
, frontends
, frontends
...
...
src/Gargantext/Components/Forest/Tree.purs
View file @
fd66a25f
...
@@ -38,11 +38,12 @@ import Gargantext.Types (ID, Reload, isPublic, publicize)
...
@@ -38,11 +38,12 @@ import Gargantext.Types (ID, Reload, isPublic, publicize)
import Gargantext.Types as GT
import Gargantext.Types as GT
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
thisModule :: String
thisModule = "Gargantext.Components.Forest.Tree"
thisModule = "Gargantext.Components.Forest.Tree"
------------------------------------------------------------------------
------------------------------------------------------------------------
type CommonProps =
type CommonProps =
(
(
frontends :: Frontends
frontends :: Frontends
, handed :: GT.Handed
, handed :: GT.Handed
, mCurrentRoute :: Maybe AppRoute
, mCurrentRoute :: Maybe AppRoute
, openNodes :: R.State OpenNodes
, openNodes :: R.State OpenNodes
...
@@ -51,7 +52,8 @@ type CommonProps =
...
@@ -51,7 +52,8 @@ type CommonProps =
)
)
------------------------------------------------------------------------
------------------------------------------------------------------------
type Props = ( asyncTasks :: GAT.Reductor
type Props = (
asyncTasks :: GAT.Reductor
, root :: ID
, root :: ID
| CommonProps
| CommonProps
)
)
...
@@ -70,8 +72,8 @@ treeView props = R.createElement treeViewCpt props []
...
@@ -70,8 +72,8 @@ treeView props = R.createElement treeViewCpt props []
, reload
, reload
, root
, root
, session
, session
} _children =
pure
} _children =
do
$ treeLoadView { asyncTasks
pure
$ treeLoadView { asyncTasks
, frontends
, frontends
, handed
, handed
, mCurrentRoute
, mCurrentRoute
...
@@ -114,7 +116,8 @@ getNodeTree :: Session -> GT.ID -> Aff FTree
...
@@ -114,7 +116,8 @@ getNodeTree :: Session -> GT.ID -> Aff FTree
getNodeTree session nodeId = get session $ GR.NodeAPI GT.Tree (Just nodeId) ""
getNodeTree session nodeId = get session $ GR.NodeAPI GT.Tree (Just nodeId) ""
--------------
--------------
type TreeViewProps = ( asyncTasks :: GAT.Reductor
type TreeViewProps = (
asyncTasks :: GAT.Reductor
, tree :: FTree
, tree :: FTree
| CommonProps
| CommonProps
)
)
...
@@ -134,13 +137,10 @@ loadedTreeView p = R.createElement loadedTreeViewCpt p []
...
@@ -134,13 +137,10 @@ loadedTreeView p = R.createElement loadedTreeViewCpt p []
, session
, session
-- , tasks
-- , tasks
, tree
, tree
} _ = pure $ H.ul { className: "tree"
} _ = do
}
pure $ H.ul { className: "tree" } [
[ H.div { className: if handed == GT.RightHanded
H.div { className: if handed == GT.RightHanded then "righthanded" else "lefthanded" } [
then "righthanded"
toHtml { asyncTasks
else "lefthanded"
}
[ toHtml { asyncTasks
, frontends
, frontends
, handed
, handed
, mCurrentRoute
, mCurrentRoute
...
@@ -156,8 +156,8 @@ loadedTreeView p = R.createElement loadedTreeViewCpt p []
...
@@ -156,8 +156,8 @@ loadedTreeView p = R.createElement loadedTreeViewCpt p []
------------------------------------------------------------------------
------------------------------------------------------------------------
type ToHtmlProps =
type ToHtmlProps =
(
(
asyncTasks :: GAT.Reductor
asyncTasks :: GAT.Reductor
-- , tasks :: Record Tasks
-- , tasks :: Record Tasks
, tree :: FTree
, tree :: FTree
| CommonProps
| CommonProps
...
...
src/Gargantext/Components/GraphExplorer/ControlsToggleButton.purs
View file @
fd66a25f
...
@@ -17,7 +17,7 @@ controlsToggleButton :: Record Props -> R.Element
...
@@ -17,7 +17,7 @@ controlsToggleButton :: Record Props -> R.Element
controlsToggleButton props = R.createElement controlsToggleButtonCpt props []
controlsToggleButton props = R.createElement controlsToggleButtonCpt props []
controlsToggleButtonCpt :: R.Component Props
controlsToggleButtonCpt :: R.Component Props
controlsToggleButtonCpt = R.hooksComponentWithModule thisModule "
graphC
ontrolsToggleButton" cpt
controlsToggleButtonCpt = R.hooksComponentWithModule thisModule "
c
ontrolsToggleButton" cpt
where
where
cpt {state} _ = do
cpt {state} _ = do
let (open /\ setOpen) = state
let (open /\ setOpen) = state
...
...
src/Gargantext/Components/Nodes/Lists.purs
View file @
fd66a25f
...
@@ -24,7 +24,6 @@ import Gargantext.Utils.Reactix as R2
...
@@ -24,7 +24,6 @@ import Gargantext.Utils.Reactix as R2
thisModule :: String
thisModule :: String
thisModule = "Gargantext.Components.Nodes.Lists"
thisModule = "Gargantext.Components.Nodes.Lists"
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
type Props = (
type Props = (
appReload :: GT.ReloadS
appReload :: GT.ReloadS
...
...
src/Gargantext/Components/Nodes/Texts.purs
View file @
fd66a25f
...
@@ -10,9 +10,11 @@ import Effect (Effect)
...
@@ -10,9 +10,11 @@ import Effect (Effect)
import Effect.Aff (launchAff_)
import Effect.Aff (launchAff_)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
import Record as Record
--------------------------------------------------------
--------------------------------------------------------
import Gargantext.AsyncTasks as GAT
import Gargantext.AsyncTasks as GAT
import Gargantext.Components.DocsTable as DT
import Gargantext.Components.DocsTable as DT
import Gargantext.Components.Forest as Forest
import Gargantext.Components.Loader (loader)
import Gargantext.Components.Loader (loader)
import Gargantext.Components.NgramsTable.Loader (clearCache)
import Gargantext.Components.NgramsTable.Loader (clearCache)
import Gargantext.Components.Node (NodePoly(..))
import Gargantext.Components.Node (NodePoly(..))
...
@@ -20,50 +22,112 @@ import Gargantext.Components.Nodes.Corpus (loadCorpusWithChild)
...
@@ -20,50 +22,112 @@ import Gargantext.Components.Nodes.Corpus (loadCorpusWithChild)
import Gargantext.Components.Nodes.Corpus.Chart.Histo (histo)
import Gargantext.Components.Nodes.Corpus.Chart.Histo (histo)
import Gargantext.Components.Nodes.Corpus.Types (CorpusData, Hyperdata(..), getCorpusInfo, CorpusInfo(..))
import Gargantext.Components.Nodes.Corpus.Types (CorpusData, Hyperdata(..), getCorpusInfo, CorpusInfo(..))
import Gargantext.Components.Nodes.Lists.Types as NT
import Gargantext.Components.Nodes.Lists.Types as NT
import Gargantext.Components.Nodes.Texts.SidePanelToggleButton (sidePanelToggleButton)
import Gargantext.Components.Nodes.Texts.Types
import Gargantext.Components.Tab as Tab
import Gargantext.Components.Tab as Tab
import Gargantext.Components.Table as Table
import Gargantext.Components.Table as Table
import Gargantext.Ends (Frontends)
import Gargantext.Ends (Frontends)
import Gargantext.Sessions (Session, Sessions, sessionId, getCacheState, setCacheState)
import Gargantext.Sessions (Session, Sessions, sessionId, getCacheState, setCacheState)
import Gargantext.Types (CTabNgramType(..), TabSubType(..), TabType(..))
import Gargantext.Types (CTabNgramType(..), Handed(..), ReloadS, TabSubType(..), TabType(..))
import Gargantext.Utils.Reactix as R2
thisModule :: String
thisModule :: String
thisModule = "Gargantext.Components.Nodes.Texts"
thisModule = "Gargantext.Components.Nodes.Texts"
--------------------------------------------------------
--------------------------------------------------------
type TextsWithForest = (
forestProps :: Record Forest.ForestLayoutProps
, textsProps :: Record CommonProps
)
type Props = (
textsWithForest :: R2.Component TextsWithForest
textsWithForest = R.createElement textsWithForestCpt
textsWithForestCpt :: R.Component TextsWithForest
textsWithForestCpt = R.hooksComponentWithModule thisModule "textsWithForest" cpt
where
cpt { forestProps
, textsProps } _ = do
controls <- initialControls
pure $ Forest.forestLayoutWithTopBar forestProps [
topBar { controls } []
, textsLayout (Record.merge textsProps { controls }) []
]
--------------------------------------------------------
type TextsLayoutControls = (
showSidePanel :: R.State SidePanelState
)
initialControls :: R.Hooks (Record TextsLayoutControls)
initialControls = do
showSidePanel <- R.useState' InitialClosed
pure $ {
showSidePanel
}
type TopBarProps = (
controls :: Record TextsLayoutControls
)
topBar :: R2.Component TopBarProps
topBar = R.createElement topBarCpt
topBarCpt :: R.Component TopBarProps
topBarCpt = R.hooksComponentWithModule thisModule "topBar" cpt
where
cpt { controls } _ = do
pure $
H.ul { className: "nav navbar-nav" } [
H.li {} [
sidePanelToggleButton { state: controls.showSidePanel } []
]
] -- head (goes to top bar)
------------------------------------------------------------------------
type CommonProps = (
frontends :: Frontends
frontends :: Frontends
, nodeId :: Int
, nodeId :: Int
, session :: Session
, session :: Session
, sessionUpdate :: Session -> Effect Unit
, sessionUpdate :: Session -> Effect Unit
)
)
textsLayout :: Record Props -> R.Element
type Props = (
textsLayout props = R.createElement textsLayoutCpt props []
controls :: Record TextsLayoutControls
| CommonProps
)
textsLayout :: R2.Component Props
textsLayout = R.createElement textsLayoutCpt
------------------------------------------------------------------------
textsLayoutCpt :: R.Component Props
textsLayoutCpt :: R.Component Props
textsLayoutCpt = R.hooksComponentWithModule thisModule "textsLayout" cpt where
textsLayoutCpt = R.hooksComponentWithModule thisModule "textsLayout" cpt
cpt { frontends, nodeId, session, sessionUpdate } _ = do
where
cpt { controls, frontends, nodeId, session, sessionUpdate } children = do
let sid = sessionId session
let sid = sessionId session
pure $ textsLayoutWithKey { frontends
pure $ textsLayoutWithKey { controls
, frontends
, key: show sid <> "-" <> show nodeId
, key: show sid <> "-" <> show nodeId
, nodeId
, nodeId
, session
, session
, sessionUpdate }
, sessionUpdate } children
type KeyProps = (
type KeyProps = (
key :: String
key :: String
| Props
| Props
)
)
textsLayoutWithKey :: R
ecord KeyProps -> R.Element
textsLayoutWithKey :: R
2.Component KeyProps
textsLayoutWithKey
props = R.createElement textsLayoutWithKeyCpt props []
textsLayoutWithKey
= R.createElement textsLayoutWithKeyCpt
textsLayoutWithKeyCpt :: R.Component KeyProps
textsLayoutWithKeyCpt :: R.Component KeyProps
textsLayoutWithKeyCpt = R.hooksComponentWithModule thisModule "textsLayoutWithKey" cpt
textsLayoutWithKeyCpt = R.hooksComponentWithModule thisModule "textsLayoutWithKey" cpt
where
where
cpt { frontends, nodeId, session, sessionUpdate } _ = do
cpt { frontends, nodeId, session, sessionUpdate } _
children
= do
cacheState <- R.useState' $ getCacheState NT.CacheOff session nodeId
cacheState <- R.useState' $ getCacheState NT.CacheOff session nodeId
pure $ loader { nodeId, session } loadCorpusWithChild $
pure $ loader { nodeId, session } loadCorpusWithChild $
...
...
src/Gargantext/Components/Nodes/Texts/SidePanelToggleButton.purs
0 → 100644
View file @
fd66a25f
module Gargantext.Components.Nodes.Texts.SidePanelToggleButton
( Props, sidePanelToggleButton
) where
import Data.Tuple.Nested ((/\))
import Prelude
import Reactix as R
import Reactix.DOM.HTML as H
import Gargantext.Components.Nodes.Texts.Types
import Gargantext.Utils.Reactix as R2
thisModule :: String
thisModule = "Gargantext.Components.Nodes.Texts.SidePanelToggleButton"
type Props = ( state :: R.State SidePanelState )
sidePanelToggleButton :: R2.Component Props
sidePanelToggleButton = R.createElement sidePanelToggleButtonCpt
sidePanelToggleButtonCpt :: R.Component Props
sidePanelToggleButtonCpt = R.hooksComponentWithModule thisModule "sidePanelToggleButton" cpt
where
cpt { state } _ = do
let (open /\ setOpen) = state
pure $
H.button { className: "btn btn-primary"
, on: { click: \_ -> setOpen $ toggleSidePanelState } } [ H.text (text open) ]
text InitialClosed = "Show Side Panel"
text Opened = "Show Side Panel"
text Closed = "Hide Side Panel"
src/Gargantext/Components/Nodes/Texts/Types.purs
0 → 100644
View file @
fd66a25f
module Gargantext.Components.Nodes.Texts.Types where
import Gargantext.Prelude
data SidePanelState = InitialClosed | Opened | Closed
derive instance eqSidePanelState :: Eq SidePanelState
toggleSidePanelState :: SidePanelState -> SidePanelState
toggleSidePanelState InitialClosed = Opened
toggleSidePanelState Closed = Opened
toggleSidePanelState Opened = Closed
src/Gargantext/Components/SimpleLayout.purs
View file @
fd66a25f
...
@@ -26,5 +26,5 @@ simpleLayoutCpt = R.hooksComponentWithModule thisModule "simpleLayout" cpt
...
@@ -26,5 +26,5 @@ simpleLayoutCpt = R.hooksComponentWithModule thisModule "simpleLayout" cpt
where
where
cpt { handed } children = do
cpt { handed } children = do
pure $ H.div { className: "simple-layout" } (
pure $ H.div { className: "simple-layout" } (
[ topBar { handed } ] <> children <> [ license ]
[ topBar { handed }
[]
] <> children <> [ license ]
)
)
src/Gargantext/Components/TopBar.purs
View file @
fd66a25f
...
@@ -10,6 +10,7 @@ import Reactix.DOM.HTML as H
...
@@ -10,6 +10,7 @@ import Reactix.DOM.HTML as H
import Gargantext.Prelude
import Gargantext.Prelude
import Gargantext.Types (Handed(..))
import Gargantext.Types (Handed(..))
import Gargantext.Utils.Reactix as R2
thisModule :: String
thisModule :: String
thisModule = "Gargantext.Components.TopBar"
thisModule = "Gargantext.Components.TopBar"
...
@@ -18,28 +19,28 @@ type TopBarProps = (
...
@@ -18,28 +19,28 @@ type TopBarProps = (
handed :: R.State Handed
handed :: R.State Handed
)
)
topBar :: R
ecord TopBarProps -> R.Element
topBar :: R
2.Component TopBarProps
topBar
props = R.createElement topBarCpt props []
topBar
= R.createElement topBarCpt
topBarCpt :: R.Component TopBarProps
topBarCpt :: R.Component TopBarProps
topBarCpt = R.hooksComponentWithModule thisModule "topBar" cpt
topBarCpt = R.hooksComponentWithModule thisModule "topBar" cpt
where
where
cpt { handed }
_
= do
cpt { handed }
children
= do
pure $ H.div { id: "dafixedtop"
pure $ H.div { id: "dafixedtop"
, role: "navigation"
, role: "navigation"
, className: "navbar navbar-inverse navbar-fixed-top" }
, className: "navbar navbar-inverse navbar-fixed-top" }
[ H.div { className: "container-fluid" }
[ H.div { className: "container-fluid" }
[ H.div { className: "navbar-inner" }
[ H.div { className: "navbar-inner" }
[ logo (fst handed)
[ logo (fst handed)
, H.div { className: "collapse navbar-collapse" <> navHanded}
, H.div { className: "collapse navbar-collapse" <> navHanded}
(
$ sortHanded
[
[ H.ul { className: "nav navbar-nav" <> navHanded} [divDropdownLeft
]
H.ul { className: "nav navbar-nav" <> navHanded} [
]
, H.ul { title: "If you are Left Handed you can change "
, H.ul { title: "If you are Left Handed you can change "
<> "the interface by clicking on me. Click "
<> "the interface by clicking on me. Click "
<> "again to come back to previous state."
<> "again to come back to previous state."
, className: "nav navbar-nav" <> navHanded
, className: "nav navbar-nav" <> navHanded
} [handedChooser { handed }]
} [handedChooser { handed }]
, H.ul { className: "nav navbar-nav" <> navHanded} [
]
, H.ul { className: "nav navbar-nav" <> navHanded} [divDropdownLeft
]
{-, H.ul { title: "Dark Mode soon here"
{-, H.ul { title: "Dark Mode soon here"
, className : "nav navbar-nav"
, className : "nav navbar-nav"
} [ H.li {} [ H.a {} [ H.span {className : "fa fa-moon"}[]
} [ H.li {} [ H.a {} [ H.span {className : "fa fa-moon"}[]
...
@@ -47,13 +48,13 @@ topBarCpt = R.hooksComponentWithModule thisModule "topBar" cpt
...
@@ -47,13 +48,13 @@ topBarCpt = R.hooksComponentWithModule thisModule "topBar" cpt
]
]
]
]
-}
-}
]
] <> children)
]
]
]
]
]
]
where
where
navHanded = if fst handed == LeftHanded then " navbar-right" else ""
navHanded = if fst handed == LeftHanded then " navbar-right" else ""
sortHanded = if fst handed == LeftHanded then reverse else reverse -- identity
--
sortHanded = if fst handed == LeftHanded then reverse else reverse -- identity
-- SB.searchBar {session, databases: allDatabases}
-- SB.searchBar {session, databases: allDatabases}
...
...
src/Gargantext/Sessions.purs
View file @
fd66a25f
...
@@ -117,7 +117,9 @@ instance encodeJsonSessions :: EncodeJson Sessions where
...
@@ -117,7 +117,9 @@ instance encodeJsonSessions :: EncodeJson Sessions where
unSessions :: Sessions -> Array Session
unSessions :: Sessions -> Array Session
unSessions (Sessions {sessions:s}) = A.fromFoldable s
unSessions (Sessions {sessions:s}) = A.fromFoldable s
useSessions :: R.Hooks (R2.Reductor Sessions Action)
type Reductor = R2.Reductor Sessions Action
useSessions :: R.Hooks Reductor
useSessions = R2.useReductor actAndSave (const loadSessions) unit
useSessions = R2.useReductor actAndSave (const loadSessions) unit
where
where
actAndSave :: R2.Actor Sessions Action
actAndSave :: R2.Actor Sessions Action
...
...
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