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
0e5d4847
Commit
0e5d4847
authored
Jul 30, 2019
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Pages] thermite -> reactix migration for some components
parent
0df64011
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
78 deletions
+77
-78
Specs.purs
src/Gargantext/Pages/Layout/Specs.purs
+77
-78
No files found.
src/Gargantext/Pages/Layout/Specs.purs
View file @
0e5d4847
...
@@ -7,6 +7,8 @@ import Effect (Effect)
...
@@ -7,6 +7,8 @@ import Effect (Effect)
import React (ReactElement)
import React (ReactElement)
import React.DOM (a, button, div, footer, hr', img, li, p, span, text, ul)
import React.DOM (a, button, div, footer, hr', img, li, p, span, text, ul)
import React.DOM.Props (_data, _id, aria, className, href, onClick, role, src, style, tabIndex, target, title, height, width)
import React.DOM.Props (_data, _id, aria, className, href, onClick, role, src, style, tabIndex, target, title, height, width)
import Reactix as R
import Reactix.DOM.HTML as H
import Thermite (Render, Spec, _render, defaultPerformAction, defaultRender, focus, simpleSpec, withState, noState, cmapProps)
import Thermite (Render, Spec, _render, defaultPerformAction, defaultRender, focus, simpleSpec, withState, noState, cmapProps)
-- import Unsafe.Coerce (unsafeCoerce)
-- import Unsafe.Coerce (unsafeCoerce)
...
@@ -31,7 +33,7 @@ import Gargantext.Pages.Layout.Specs.Search as S
...
@@ -31,7 +33,7 @@ import Gargantext.Pages.Layout.Specs.Search as S
import Gargantext.Pages.Layout.Specs.SearchBar as SB
import Gargantext.Pages.Layout.Specs.SearchBar as SB
import Gargantext.Pages.Layout.States (AppState, _addCorpusState, _graphExplorerState, _loginState, _searchState)
import Gargantext.Pages.Layout.States (AppState, _addCorpusState, _graphExplorerState, _loginState, _searchState)
import Gargantext.Router (Routes(..))
import Gargantext.Router (Routes(..))
import Gargantext.Utils.Reactix
(scuff)
import Gargantext.Utils.Reactix
as R2
layoutSpec :: Spec AppState {} Action
layoutSpec :: Spec AppState {} Action
layoutSpec =
layoutSpec =
...
@@ -94,7 +96,7 @@ layout0 layout =
...
@@ -94,7 +96,7 @@ layout0 layout =
withState \st ->
withState \st ->
case st.loginState.authData of
case st.loginState.authData of
Just (AuthData {tree_id}) ->
Just (AuthData {tree_id}) ->
ls $ cmapProps (const {root: tree_id, mCurrentRoute: st.currentRoute})
as
ls $ cmapProps (const {root: tree_id, mCurrentRoute: st.currentRoute})
$ noState $ Tree.treeview
Nothing ->
Nothing ->
outerLayout1
outerLayout1
, rs bs
, rs bs
...
@@ -111,8 +113,6 @@ layout0 layout =
...
@@ -111,8 +113,6 @@ layout0 layout =
] (render d p s c) ]
] (render d p s c) ]
cont = over _render \render d p s c -> [ div [className "row" ] (render d p s c) ]
cont = over _render \render d p s c -> [ div [className "row" ] (render d p s c) ]
as = noState Tree.treeview
bs = innerLayout $ layout
bs = innerLayout $ layout
innerLayout :: Spec AppState {} Action
innerLayout :: Spec AppState {} Action
...
@@ -142,7 +142,7 @@ layout1 layout =
...
@@ -142,7 +142,7 @@ layout1 layout =
[ withState \st ->
[ withState \st ->
case st.loginState.authData of
case st.loginState.authData of
Just (AuthData {tree_id}) ->
Just (AuthData {tree_id}) ->
ls $ cmapProps (const {root: tree_id, mCurrentRoute: st.currentRoute})
as
ls $ cmapProps (const {root: tree_id, mCurrentRoute: st.currentRoute})
$ noState $ Tree.treeview
Nothing ->
Nothing ->
outerLayout1
outerLayout1
, rs bs
, rs bs
...
@@ -156,8 +156,6 @@ layout1 layout =
...
@@ -156,8 +156,6 @@ layout1 layout =
rs = over _render \render d p s c -> [ div [if (s.showTree) then className "col-md-10" else className "col-md-12"] (render d p s c) ]
rs = over _render \render d p s c -> [ div [if (s.showTree) then className "col-md-10" else className "col-md-12"] (render d p s c) ]
cont = over _render \render d p s c -> [ div [className "row" ] (render d p s c) ]
cont = over _render \render d p s c -> [ div [className "row" ] (render d p s c) ]
as = noState Tree.treeview
bs = innerLayout $ layout
bs = innerLayout $ layout
innerLayout :: Spec AppState {} Action
innerLayout :: Spec AppState {} Action
...
@@ -180,29 +178,29 @@ searchBar = simpleSpec defaultPerformAction render
...
@@ -180,29 +178,29 @@ searchBar = simpleSpec defaultPerformAction render
] [ div [className "container-fluid"
] [ div [className "container-fluid"
]
]
[ div [ className "navbar-inner" ]
[ div [ className "navbar-inner" ]
[ divLogo
[
R2.scuff
divLogo
, div [ className "collapse navbar-collapse"
, div [ className "collapse navbar-collapse"
]
]
$ [ divDropdownLeft ]
$ [
R2.scuff
divDropdownLeft ]
<> [ scuff (SB.searchBar SB.defaultProps) ]
<> [
R2.
scuff (SB.searchBar SB.defaultProps) ]
<> [ divDropdownRight d s ]
<> [
R2.scuff $
divDropdownRight d s ]
]
]
]
]
]
]
]
]
divLogo :: R
eact
Element
divLogo :: R
.
Element
divLogo =
a [ className
"navbar-brand logoSmall"
divLogo =
H.a { className:
"navbar-brand logoSmall"
, href
"#/"
, href:
"#/"
] [ img [ src
"images/logoSmall.png"
} [ H.img { src:
"images/logoSmall.png"
, title
"Back to home."
, title:
"Back to home."
, width
"30"
, width:
"30"
, height
"28"
, height:
"28"
]
}
]
]
divDropdownLeft :: R
eact
Element
divDropdownLeft :: R
.
Element
divDropdownLeft = divDropdownLeft' (LiNav { title : "About Gargantext"
divDropdownLeft = divDropdownLeft' (LiNav { title : "About Gargantext"
, href : "#"
, href : "#"
, icon : "glyphicon glyphicon-info-sign"
, icon : "glyphicon glyphicon-info-sign"
...
@@ -210,32 +208,33 @@ divDropdownLeft = divDropdownLeft' (LiNav { title : "About Gargantext"
...
@@ -210,32 +208,33 @@ divDropdownLeft = divDropdownLeft' (LiNav { title : "About Gargantext"
}
}
)
)
divDropdownLeft' :: LiNav -> R
eact
Element
divDropdownLeft' :: LiNav -> R
.
Element
divDropdownLeft' mb =
ul [className "nav navbar-nav"]
divDropdownLeft' mb =
H.ul {className: "nav navbar-nav"}
[ ul [className "nav navbar-nav pull-left"]
[ H.ul {className: "nav navbar-nav pull-left"}
[ li [className "dropdown"]
[ H.li {className: "dropdown"}
[ menuButton mb
[ menuButton mb
, menuElements'
, menuElements'
]
]
]
]
]
]
menuButton :: LiNav -> R
eact
Element
menuButton :: LiNav -> R
.
Element
menuButton (LiNav { title : title'
menuButton (LiNav { title : title'
, href : href'
, href : href'
, icon : icon'
, icon : icon'
, text : text'
, text : text'
}) = a [ className "dropdown-toggle navbar-text"
}) = H.a { className: "dropdown-toggle navbar-text"
, _data {toggle: "dropdown"}
, data: {toggle: "dropdown"}
, href href', role "button"
, href: href'
, title title'
, role: "button"
][ span [ aria {hidden : true}
, title: title'
, className icon'
} [ H.span { aria: {hidden : true}
] []
, className: icon'
, text (" " <> text')
} []
]
, H.text (" " <> text')
]
menuElements' :: ReactElement
menuElements' :: R.Element
menuElements' = menuElements-- title, icon, text
menuElements' = menuElements-- title, icon, text
[ -- ===========================================================
[ -- ===========================================================
[ LiNav { title : "Quick start, tutorials and methodology"
[ LiNav { title : "Quick start, tutorials and methodology"
...
@@ -271,14 +270,14 @@ menuElements' = menuElements-- title, icon, text
...
@@ -271,14 +270,14 @@ menuElements' = menuElements-- title, icon, text
] -- ===========================================================
] -- ===========================================================
-- | Menu in the sidebar, syntactic sugar
-- | Menu in the sidebar, syntactic sugar
menuElements :: Array (Array LiNav) -> R
eact
Element
menuElements :: Array (Array LiNav) -> R
.
Element
menuElements ns = dropDown $ intercalate divider $ map (map liNav) ns
menuElements ns = dropDown $ intercalate divider $ map (map liNav) ns
where
where
dropDown :: Array R
eactElement -> React
Element
dropDown :: Array R
.Element -> R.
Element
dropDown =
ul [className "dropdown-menu"]
dropDown =
H.ul {className: "dropdown-menu"}
divider :: Array R
eact
Element
divider :: Array R
.
Element
divider = [
li [className "divider"]
[]]
divider = [
H.li {className: "divider"}
[]]
-- | surgar for target : "blank"
-- | surgar for target : "blank"
--data LiNav_ = LiNav_ { title :: String
--data LiNav_ = LiNav_ { title :: String
...
@@ -294,52 +293,52 @@ data LiNav = LiNav { title :: String
...
@@ -294,52 +293,52 @@ data LiNav = LiNav { title :: String
, text :: String
, text :: String
}
}
liNav :: LiNav -> R
eact
Element
liNav :: LiNav -> R
.
Element
liNav (LiNav { title : title'
liNav (LiNav { title : title'
, href : href'
, href : href'
, icon : icon'
, icon : icon'
, text : text'
, text : text'
}
}
) =
li [] [ a [ tabIndex
(-1)
) =
H.li {} [ H.a { tabIndex:
(-1)
, target
"blank"
, target:
"blank"
, title
title'
, title:
title'
, href
href'
, href:
href'
] [ span [ className icon' ]
[]
} [ H.span { className: icon' }
[]
,
text $ " " <> text'
, H.
text $ " " <> text'
]
]
]
]
logLinks :: (Action -> Effect Unit) -> AppState -> R
eact
Element
logLinks :: (Action -> Effect Unit) -> AppState -> R
.
Element
logLinks d s = case s.loginState.authData of
logLinks d s = case s.loginState.authData of
Nothing -> loginLink
Nothing -> loginLink
Just _ -> logoutLink
Just _ -> logoutLink
where
where
loginLink =
loginLink =
a [ aria
{hidden : true}
H.a { aria:
{hidden : true}
, className
"glyphicon glyphicon-log-in"
, className:
"glyphicon glyphicon-log-in"
, onClick $ \e -> d ShowLogin
, on: {click: \e -> d ShowLogin}
, style
{color:"white"}
, style:
{color:"white"}
, title
"Log in and save your time"
, title:
"Log in and save your time"
-- TODO hover: bold
-- TODO hover: bold
]
}
[
text " Login / Signup"]
[H.
text " Login / Signup"]
-- TODO dropdown to logout
-- TODO dropdown to logout
logoutLink =
logoutLink =
a [ aria
{hidden : true}
H.a { aria:
{hidden : true}
, className
"glyphicon glyphicon-log-out"
, className:
"glyphicon glyphicon-log-out"
, onClick $ \e -> d Logout
, on: {click: \e -> d Logout}
, style
{color:"white"}
, style:
{color:"white"}
, title
"Log out" -- TODO
, title:
"Log out" -- TODO
-- TODO hover: bold
-- TODO hover: bold
]
}
[
text " Logout"]
[H.
text " Logout"]
divDropdownRight :: (Action -> Effect Unit) -> AppState -> R
eact
Element
divDropdownRight :: (Action -> Effect Unit) -> AppState -> R
.
Element
divDropdownRight d s =
divDropdownRight d s =
ul [className "nav navbar-nav pull-right"]
H.ul {className: "nav navbar-nav pull-right"}
[ li [className "dropdown"]
[ H.li {className: "dropdown"}
[ logLinks d s ]
[ logLinks d s ]
]
]
...
...
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