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
023702d0
Commit
023702d0
authored
Sep 15, 2021
by
arturo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
>>> BEGIN 333
* add Theme to global box container
parent
8a629d69
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
13 deletions
+16
-13
Data.purs
src/Gargantext/Components/App/Data.purs
+6
-2
Themes.purs
src/Gargantext/Components/Themes.purs
+7
-8
TopBar.purs
src/Gargantext/Components/TopBar.purs
+3
-3
No files found.
src/Gargantext/Components/App/Data.purs
View file @
023702d0
module Gargantext.Components.App.Data (App, Boxes, emptyApp) where
module Gargantext.Components.App.Data (App, Boxes, emptyApp) where
import Gargantext.Prelude
import Gargantext.Prelude
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Set as Set
import Data.Set as Set
import Toestand as T
import Gargantext.AsyncTasks as GAT
import Gargantext.AsyncTasks as GAT
import Gargantext.Components.GraphExplorer.Sidebar.Types as GEST
import Gargantext.Components.GraphExplorer.Sidebar.Types as GEST
import Gargantext.Components.Nodes.Lists.Types as ListsT
import Gargantext.Components.Nodes.Lists.Types as ListsT
import Gargantext.Components.Nodes.Texts.Types as TextsT
import Gargantext.Components.Nodes.Texts.Types as TextsT
import Gargantext.Components.Themes as Themes
import Gargantext.Ends (Backend)
import Gargantext.Ends (Backend)
import Gargantext.Routes (AppRoute(Home), Tile)
import Gargantext.Routes (AppRoute(Home), Tile)
import Gargantext.Sessions (Session, Sessions)
import Gargantext.Sessions (Session, Sessions)
...
@@ -17,6 +17,7 @@ import Gargantext.Sessions as Sessions
...
@@ -17,6 +17,7 @@ import Gargantext.Sessions as Sessions
import Gargantext.Sessions.Types (OpenNodes(..))
import Gargantext.Sessions.Types (OpenNodes(..))
import Gargantext.Types (FrontendError, Handed(RightHanded), SidePanelState(..))
import Gargantext.Types (FrontendError, Handed(RightHanded), SidePanelState(..))
import Gargantext.Utils.Toestand as T2
import Gargantext.Utils.Toestand as T2
import Toestand as T
type App =
type App =
{ backend :: Maybe Backend
{ backend :: Maybe Backend
...
@@ -38,6 +39,7 @@ type App =
...
@@ -38,6 +39,7 @@ type App =
, sidePanelTexts :: Maybe (Record TextsT.SidePanel)
, sidePanelTexts :: Maybe (Record TextsT.SidePanel)
, sidePanelState :: SidePanelState
, sidePanelState :: SidePanelState
, tasks :: GAT.Storage
, tasks :: GAT.Storage
, theme :: Themes.Theme
, tileAxisXList :: Array (Record Tile)
, tileAxisXList :: Array (Record Tile)
, tileAxisYList :: Array (Record Tile)
, tileAxisYList :: Array (Record Tile)
}
}
...
@@ -63,6 +65,7 @@ emptyApp =
...
@@ -63,6 +65,7 @@ emptyApp =
, sidePanelTexts : TextsT.initialSidePanel
, sidePanelTexts : TextsT.initialSidePanel
, sidePanelState : InitialClosed
, sidePanelState : InitialClosed
, tasks : GAT.empty
, tasks : GAT.empty
, theme : Themes.defaultTheme
, tileAxisXList : mempty
, tileAxisXList : mempty
, tileAxisYList : mempty
, tileAxisYList : mempty
}
}
...
@@ -87,6 +90,7 @@ type Boxes =
...
@@ -87,6 +90,7 @@ type Boxes =
, sidePanelTexts :: T.Box (Maybe (Record TextsT.SidePanel))
, sidePanelTexts :: T.Box (Maybe (Record TextsT.SidePanel))
, sidePanelState :: T.Box SidePanelState
, sidePanelState :: T.Box SidePanelState
, tasks :: T.Box GAT.Storage
, tasks :: T.Box GAT.Storage
, theme :: T.Box Themes.Theme
, tileAxisXList :: T.Box (Array (Record Tile))
, tileAxisXList :: T.Box (Array (Record Tile))
, tileAxisYList :: T.Box (Array (Record Tile))
, tileAxisYList :: T.Box (Array (Record Tile))
}
}
src/Gargantext/Components/Themes.purs
View file @
023702d0
...
@@ -86,7 +86,7 @@ markThemeToDOMTree (Theme { name }) = do
...
@@ -86,7 +86,7 @@ markThemeToDOMTree (Theme { name }) = do
type ThemeSwitcherProps = (
type ThemeSwitcherProps = (
theme :: Theme
theme :: T
.Box T
heme
, themes :: Array Theme
, themes :: Array Theme
)
)
...
@@ -97,19 +97,18 @@ themeSwitcherCpt :: R.Component ThemeSwitcherProps
...
@@ -97,19 +97,18 @@ themeSwitcherCpt :: R.Component ThemeSwitcherProps
themeSwitcherCpt = here.component "themeSwitcher" cpt
themeSwitcherCpt = here.component "themeSwitcher" cpt
where
where
cpt { theme, themes } _ = do
cpt { theme, themes } _ = do
currentTheme <- T.useBox theme
currentTheme <- T.useLive T.unequal theme
currentTheme' <- T.useLive T.unequal currentTheme
let option (Theme { name }) = H.option { value: name } [ H.text name ]
let option (Theme { name }) = H.option { value: name } [ H.text name ]
let options = map option themes
let options = map option themes
R.useEffectOnce' $ markThemeToDOMTree currentTheme
'
R.useEffectOnce' $ markThemeToDOMTree currentTheme
pure $ R2.select { className: "form-control"
pure $ R2.select { className: "form-control"
, defaultValue: themeName currentTheme
'
, defaultValue: themeName currentTheme
, on: { change: onChange
currentT
heme } } options
, on: { change: onChange
t
heme } } options
where
where
onChange
currentTheme
e = do
onChange
box
e = do
let value = R.unsafeEventValue e
let value = R.unsafeEventValue e
let mTheme = A.head $ A.filter (\(Theme { name }) -> value == name) themes
let mTheme = A.head $ A.filter (\(Theme { name }) -> value == name) themes
...
@@ -118,4 +117,4 @@ themeSwitcherCpt = here.component "themeSwitcher" cpt
...
@@ -118,4 +117,4 @@ themeSwitcherCpt = here.component "themeSwitcher" cpt
Just t -> do
Just t -> do
switchTheme t
switchTheme t
markThemeToDOMTree t
markThemeToDOMTree t
T.write_ t
currentTheme
T.write_ t
box
src/Gargantext/Components/TopBar.purs
View file @
023702d0
...
@@ -5,7 +5,7 @@ import Gargantext.Prelude
...
@@ -5,7 +5,7 @@ import Gargantext.Prelude
import Data.Foldable (intercalate)
import Data.Foldable (intercalate)
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.GraphExplorer.ToggleButton as Toggle
import Gargantext.Components.GraphExplorer.ToggleButton as Toggle
import Gargantext.Components.Themes (themeSwitcher,
defaultTheme,
allThemes)
import Gargantext.Components.Themes (themeSwitcher, allThemes)
import Gargantext.Types (Handed(..), reverseHanded)
import Gargantext.Types (Handed(..), reverseHanded)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Reactix as R
import Reactix as R
...
@@ -23,7 +23,7 @@ topBar = R.createElement topBarCpt
...
@@ -23,7 +23,7 @@ topBar = R.createElement topBarCpt
topBarCpt :: R.Component TopBarProps
topBarCpt :: R.Component TopBarProps
topBarCpt = here.component "topBar" cpt
topBarCpt = here.component "topBar" cpt
where
where
cpt { boxes: { handed, showTree } } children = do
cpt { boxes: { handed, showTree
, theme
} } children = do
handed' <- T.useLive T.unequal handed
handed' <- T.useLive T.unequal handed
pure $ H.div { className: "navbar navbar-expand-lg navbar-dark bg-dark"
pure $ H.div { className: "navbar navbar-expand-lg navbar-dark bg-dark"
...
@@ -41,7 +41,7 @@ topBarCpt = here.component "topBar" cpt
...
@@ -41,7 +41,7 @@ topBarCpt = here.component "topBar" cpt
([ divDropdownLeft {} []
([ divDropdownLeft {} []
, handButton
, handButton
, smiley
, smiley
, H.li { className: "nav-item" } [ themeSwitcher { theme
: defaultTheme
, H.li { className: "nav-item" } [ themeSwitcher { theme
, themes: allThemes } [] ]
, themes: allThemes } [] ]
, Toggle.treeToggleButton { state: showTree } []
, Toggle.treeToggleButton { state: showTree } []
] <> children)
] <> children)
...
...
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