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
cd949147
Commit
cd949147
authored
Jul 30, 2019
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Home] refactor to reactix, remove unnecessary state
parent
b9afb971
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
103 deletions
+72
-103
Login.purs
src/Gargantext/Components/Login.purs
+0
-34
Specs.purs
src/Gargantext/Pages/Home/Specs.purs
+72
-69
No files found.
src/Gargantext/Components/Login.purs
View file @
cd949147
...
@@ -11,7 +11,6 @@ import Effect.Aff (Aff)
...
@@ -11,7 +11,6 @@ import Effect.Aff (Aff)
import React.DOM (a, button, div, h2, h4, h5, i, input, label, p, span, text)
import React.DOM (a, button, div, h2, h4, h5, i, input, label, p, span, text)
import React.DOM.Props (_data, _id, _type, aria, className, href, maxLength, name, onClick, onInput, placeholder, role, target, value)
import React.DOM.Props (_data, _id, _type, aria, className, href, maxLength, name, onClick, onInput, placeholder, role, target, value)
import Thermite (PerformAction, Render, Spec, _render, modifyState_, simpleSpec)
import Thermite (PerformAction, Render, Spec, _render, modifyState_, simpleSpec)
import Unsafe.Coerce (unsafeCoerce)
import Web.HTML (window)
import Web.HTML (window)
import Web.HTML.Window (localStorage)
import Web.HTML.Window (localStorage)
import Web.Storage.Storage (getItem, setItem, removeItem)
import Web.Storage.Storage (getItem, setItem, removeItem)
...
@@ -153,39 +152,6 @@ renderSpec = simpleSpec performAction render
...
@@ -153,39 +152,6 @@ renderSpec = simpleSpec performAction render
]
]
]
]
-- div [ className "modal fade myModal"
-- , role "dialog"
-- , _data {show : true}
-- ][ div [ className "modal-dialog"
-- , role "document"
-- ] [ div [ className "modal-content"]
-- [ div [ className "modal-header"]
-- [ h5 [ className "modal-title"
-- ]
-- [ text "CorpusView"
-- ]
-- , button [ _type "button"
-- , className "close"
-- , _data { dismiss : "modal"}
-- ] [ span [ aria {hidden : true}]
-- [ text "X"]
-- ]
-- ]
-- , div [ className "modal-body"]
-- [ ul [ className "list-group"] ( map fn1 state.authData ) ]
-- , div [className "modal-footer"]
-- [ button [ _type "button"
-- , className "btn btn-secondary"
-- , _data {dismiss : "modal"}
-- ] [ text "GO"]
-- ]
-- ]
-- ]
-- ]
-- ]
getAuthData :: Effect (Maybe AuthData)
getAuthData :: Effect (Maybe AuthData)
getAuthData = do
getAuthData = do
...
...
src/Gargantext/Pages/Home/Specs.purs
View file @
cd949147
...
@@ -10,14 +10,15 @@ import Gargantext.Components.Lang.Landing.EnUS as En
...
@@ -10,14 +10,15 @@ import Gargantext.Components.Lang.Landing.EnUS as En
import Gargantext.Components.Lang.Landing.FrFR as Fr
import Gargantext.Components.Lang.Landing.FrFR as Fr
import Gargantext.Components.Data.Landing (BlockText(..), BlockTexts(..), Button(..), LandingData(..))
import Gargantext.Components.Data.Landing (BlockText(..), BlockTexts(..), Button(..), LandingData(..))
import Gargantext.Components.Data.Lang (Lang(..))
import Gargantext.Components.Data.Lang (Lang(..))
import Gargantext.Pages.Home.States (State, initialState)
import Gargantext.Pages.Home.Actions (Action, performAction)
import Gargantext.Pages.Home.Actions (Action, performAction)
import Reactix as R
import Reactix.DOM.HTML as H
import React (ReactElement)
import React (ReactElement)
import React.DOM (a, div, h3, i, img, p, span, text)
import React.DOM.Props (Props)
import React.DOM.Props (Props, _id, aria, className, href, src, target, title, height, width)
import Thermite (Spec, hideState, focusState, Render, simpleSpec)
import Thermite (Render, Spec, simpleSpec, hideState, focusState)
import Gargantext.Utils.Reactix as R2
-- Layout |
-- Layout |
...
@@ -26,80 +27,82 @@ landingData FR = Fr.landingData
...
@@ -26,80 +27,82 @@ landingData FR = Fr.landingData
landingData EN = En.landingData
landingData EN = En.landingData
layoutLanding :: Lang -> Spec {} {} Void
layoutLanding :: Lang -> Spec {} {} Void
layoutLanding = hideState (const $ unwrap initialState)
layoutLanding = layoutLanding' <<< landingData
<<< focusState (re _Newtype)
<<< layoutLanding' <<< landingData
------------------------------------------------------------------------
------------------------------------------------------------------------
layoutLanding' :: LandingData -> Spec
State {} Action
layoutLanding' :: LandingData -> Spec
{} {} Void
layoutLanding' hd =
simpleSpec performAction render
layoutLanding' hd =
R2.elSpec $ R.hooksComponent "LayoutLanding" cpt
where
where
render :: Render State {} Action
cpt {} _children = do
render dispatch _ state _ =
pure $ H.span {} [
[ div [ className "container1" ] [ jumboTitle hd false ]
H.div { className: "container1" }
, div [ className "container1" ] [] -- TODO put research form
[ jumboTitle hd false ]
, div [ className "container1" ] [ blocksRandomText' hd ]
, H.div { className: "container1" } [] -- TODO put research form
]
, H.div { className: "container1" } [ blocksRandomText' hd ]
]
------------------------------------------------------------------------
------------------------------------------------------------------------
blocksRandomText' :: LandingData -> R
eact
Element
blocksRandomText' :: LandingData -> R
.
Element
blocksRandomText' (LandingData hd) = blocksRandomText hd.blockTexts
blocksRandomText' (LandingData hd) = blocksRandomText hd.blockTexts
blocksRandomText :: BlockTexts -> R
eact
Element
blocksRandomText :: BlockTexts -> R
.
Element
blocksRandomText (BlockTexts bt) =
blocksRandomText (BlockTexts bt) =
div [ className "row" ]
( map showBlock bt.blocks )
H.div { className: "row" }
( map showBlock bt.blocks )
where
where
showBlock :: BlockText -> R
eact
Element
showBlock :: BlockText -> R
.
Element
showBlock (BlockText b) =
showBlock (BlockText b) =
div [ className "col-md-4 content" ]
H.div { className: "col-md-4 content" }
[ h3 [] [ a [ href b.href, title b.title]
[ H.h3 {} [ H.a { href: b.href, title: b.title}
[ i [className b.icon] []
[ H.i {className: b.icon} []
, text (" " <> b.titleText)
, H.text (" " <> b.titleText)
]
]
]
]
, p [] [ text b.text ]
, H.p {} [ H.text b.text ]
, p [] [ docButton b.docButton ]
, H.p {} [ docButton b.docButton ]
]
]
docButton :: Button -> ReactElement
docButton :: Button -> R.Element
docButton (Button b) = a [ className "btn btn-outline-primary btn-sm spacing-class"
docButton (Button b) =
, href b.href
H.a { className: "btn btn-outline-primary btn-sm spacing-class"
, target "blank"
, href: b.href
, title b.title
, target: "blank"
] [ span [ aria {hidden : true}
, title: b.title
, className "glyphicon glyphicon-hand-right"
} [ H.span { aria: {hidden : true}
] []
, className: "glyphicon glyphicon-hand-right"
, text b.text
} []
]
, H.text b.text
]
jumboTitle :: LandingData -> Boolean -> ReactElement
jumboTitle (LandingData hd) b = div jumbo
jumboTitle :: LandingData -> Boolean -> R.Element
[ div [className "row" ]
jumboTitle (LandingData hd) b =
[ div [ className "col-md-12 content"]
H.div {className: jumbo}
[ div [ className "center" ]
[ H.div { className: "row" }
[ div [_id "logo-designed" ]
[ H.div { className: "col-md-12 content" }
[ img [ src "images/logo.png"
[ H.div { className: "center" }
, title hd.logoTitle
[ H.div { id: "logo-designed" }
]
[ H.img { src: "images/logo.png"
]
, title: hd.logoTitle
]
}
]
]
]
]
]
]
where
]
jumbo = case b of
]
true -> [className "jumbotron"]
where
false -> []
jumbo = case b of
true -> "jumbotron"
imageEnter :: LandingData -> Props -> ReactElement
false -> ""
imageEnter (LandingData hd) action = div [className "row"]
[ div [className "col-md-offset-5 col-md-6 content"]
imageEnter :: LandingData -> Props -> R.Element
[ img [ src "images/Gargantextuel-212x300.jpg"
imageEnter (LandingData hd) action =
, _id "funnyimg"
H.div {className: "row"}
, title hd.imageTitle
[ H.div {className: "col-md-offset-5 col-md-6 content"}
, action
[ H.img { src: "images/Gargantextuel-212x300.jpg"
]
, id: "funnyimg"
]
, title: hd.imageTitle
]
, 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