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
04fb25c1
Commit
04fb25c1
authored
Sep 20, 2019
by
James Laver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor G.P.Home to use Reactix
parent
6cf771f9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
123 additions
and
159 deletions
+123
-159
Home.purs
src/Gargantext/Pages/Home.purs
+123
-9
Actions.purs
src/Gargantext/Pages/Home/Actions.purs
+0
-26
Specs.purs
src/Gargantext/Pages/Home/Specs.purs
+0
-108
States.purs
src/Gargantext/Pages/Home/States.purs
+0
-16
No files found.
src/Gargantext/Pages/Home.purs
View file @
04fb25c1
module Gargantext.Pages.Home
( module Gargantext.Pages.Home.States
, module Gargantext.Pages.Home.Actions
, module Gargantext.Pages.Home.Specs
) where
module Gargantext.Pages.Home where
import Gargantext.Pages.Home.States
import Gargantext.Pages.Home.Actions
import Gargantext.Pages.Home.Specs
import Prelude
import Data.Lens (re)
import Data.Lens.Iso.Newtype (_Newtype)
import Data.Newtype (class Newtype, unwrap)
import Effect (Effect)
import Reactix as R
import Reactix.DOM.HTML as H
import Routing.Hash (setHash)
import Gargantext.Components.Lang.Landing.EnUS as En
import Gargantext.Components.Lang.Landing.FrFR as Fr
import Gargantext.Components.Data.Landing (BlockText(..), BlockTexts(..), Button(..), LandingData(..))
import Gargantext.Components.Data.Lang (Lang(..))
import Gargantext.Utils.Reactix as R2
type Props = ()
newtype State = State
{ userName :: String
, password :: String
}
derive instance newtypeState :: Newtype State _
initialState :: State
initialState = State { userName : "", password : "" }
data Action
= Documentation
| Enter
| Login
| SignUp
performAction :: Action -> Effect Unit
performAction Documentation = pure unit
performAction Enter = void $ setHash "/search"
performAction Login = void $ setHash "/login"
performAction SignUp = pure unit
-- Layout |
landingData :: Lang -> LandingData
landingData FR = Fr.landingData
landingData EN = En.landingData
------------------------------------------------------------------------
layoutLanding :: Lang -> R.Element
layoutLanding lang = R.createElement layoutLandingCpt props []
where props = { landingData: landingData lang }
layoutLandingCpt :: R.Component ( landingData :: LandingData )
layoutLandingCpt = R.hooksComponent "LayoutLanding" cpt
where
cpt {landingData} _ = do
pure $ H.span {} [
H.div { className: "container1" }
[ jumboTitle landingData false ]
, H.div { className: "container1" } [] -- TODO put research form
, H.div { className: "container1" } [ blocksRandomText' landingData ]
]
------------------------------------------------------------------------
blocksRandomText' :: LandingData -> R.Element
blocksRandomText' (LandingData hd) = blocksRandomText hd.blockTexts
blocksRandomText :: BlockTexts -> R.Element
blocksRandomText (BlockTexts bt) =
H.div { className: "row" } ( map showBlock bt.blocks )
where
showBlock :: BlockText -> R.Element
showBlock (BlockText b) =
H.div { className: "col-md-4 content" }
[ H.h3 {}
[ H.a { href: b.href, title: b.title}
[ H.i {className: b.icon} []
, H.text (" " <> b.titleText) ] ]
, H.p {} [ H.text b.text ]
, H.p {} [ docButton b.docButton ] ]
docButton :: Button -> R.Element
docButton (Button b) =
H.a { className: "btn btn-outline-primary btn-sm spacing-class"
, href: b.href
, target: "blank"
, title: b.title
} [ H.span { aria: {hidden : true}
, className: "glyphicon glyphicon-hand-right"
} []
, H.text b.text
]
jumboTitle :: LandingData -> Boolean -> R.Element
jumboTitle (LandingData hd) b =
H.div {className: jumbo}
[ H.div { className: "row" }
[ H.div { className: "col-md-12 content" }
[ H.div { className: "center" }
[ H.div { id: "logo-designed" }
[ H.img { src: "images/logo.png"
, title: hd.logoTitle
}
]
]
]
]
]
where
jumbo = case b of
true -> "jumbotron"
false -> ""
imageEnter :: LandingData -> _ -> R.Element
imageEnter (LandingData hd) action =
H.div {className: "row"}
[ H.div {className: "col-md-offset-5 col-md-6 content"}
[ H.img { src: "images/Gargantextuel-212x300.jpg"
, id: "funnyimg"
, title: hd.imageTitle
, action
}
]
]
-- Dispatch here
src/Gargantext/Pages/Home/Actions.purs
deleted
100644 → 0
View file @
6cf771f9
module Gargantext.Pages.Home.Actions where
import Prelude hiding (div)
import Effect.Class (liftEffect)
import Gargantext.Pages.Home.States (State)
import Routing.Hash (setHash)
import Thermite (PerformAction)
data Action
= Documentation
| Enter
| Login
| SignUp
performAction :: PerformAction State {} Action
performAction Documentation _ _ = pure unit
performAction Enter _ _ = void do
liftEffect $ setHash "/search"
performAction Login _ _ = void do
liftEffect $ setHash "/login"
performAction SignUp _ _ = pure unit
src/Gargantext/Pages/Home/Specs.purs
deleted
100644 → 0
View file @
6cf771f9
module Gargantext.Pages.Home.Specs where
import Prelude hiding (div)
import Data.Lens (re)
import Data.Lens.Iso.Newtype (_Newtype)
import Data.Newtype (unwrap)
import Gargantext.Components.Lang.Landing.EnUS as En
import Gargantext.Components.Lang.Landing.FrFR as Fr
import Gargantext.Components.Data.Landing (BlockText(..), BlockTexts(..), Button(..), LandingData(..))
import Gargantext.Components.Data.Lang (Lang(..))
import Gargantext.Pages.Home.Actions (Action, performAction)
import Reactix as R
import Reactix.DOM.HTML as H
import React (ReactElement)
import React.DOM.Props (Props)
import Thermite (Spec, hideState, focusState, Render, simpleSpec)
import Gargantext.Utils.Reactix as R2
-- Layout |
landingData :: Lang -> LandingData
landingData FR = Fr.landingData
landingData EN = En.landingData
layoutLanding :: Lang -> Spec {} {} Void
layoutLanding = layoutLanding' <<< landingData
------------------------------------------------------------------------
layoutLanding' :: LandingData -> Spec {} {} Void
layoutLanding' hd = R2.elSpec $ R.hooksComponent "LayoutLanding" cpt
where
cpt {} _children = do
pure $ H.span {} [
H.div { className: "container1" }
[ jumboTitle hd false ]
, H.div { className: "container1" } [] -- TODO put research form
, H.div { className: "container1" } [ blocksRandomText' hd ]
]
------------------------------------------------------------------------
blocksRandomText' :: LandingData -> R.Element
blocksRandomText' (LandingData hd) = blocksRandomText hd.blockTexts
blocksRandomText :: BlockTexts -> R.Element
blocksRandomText (BlockTexts bt) =
H.div { className: "row" } ( map showBlock bt.blocks )
where
showBlock :: BlockText -> R.Element
showBlock (BlockText b) =
H.div { className: "col-md-4 content" }
[ H.h3 {} [ H.a { href: b.href, title: b.title}
[ H.i {className: b.icon} []
, H.text (" " <> b.titleText)
]
]
, H.p {} [ H.text b.text ]
, H.p {} [ docButton b.docButton ]
]
docButton :: Button -> R.Element
docButton (Button b) =
H.a { className: "btn btn-outline-primary btn-sm spacing-class"
, href: b.href
, target: "blank"
, title: b.title
} [ H.span { aria: {hidden : true}
, className: "glyphicon glyphicon-hand-right"
} []
, H.text b.text
]
jumboTitle :: LandingData -> Boolean -> R.Element
jumboTitle (LandingData hd) b =
H.div {className: jumbo}
[ H.div { className: "row" }
[ H.div { className: "col-md-12 content" }
[ H.div { className: "center" }
[ H.div { id: "logo-designed" }
[ H.img { src: "images/logo.png"
, title: hd.logoTitle
}
]
]
]
]
]
where
jumbo = case b of
true -> "jumbotron"
false -> ""
imageEnter :: LandingData -> Props -> R.Element
imageEnter (LandingData hd) action =
H.div {className: "row"}
[ H.div {className: "col-md-offset-5 col-md-6 content"}
[ H.img { src: "images/Gargantextuel-212x300.jpg"
, id: "funnyimg"
, title: hd.imageTitle
, action
}
]
]
src/Gargantext/Pages/Home/States.purs
deleted
100644 → 0
View file @
6cf771f9
module Gargantext.Pages.Home.States where
import Data.Newtype (class Newtype)
newtype State = State
{ userName :: String
, password :: String
}
derive instance newtypeState :: Newtype State _
initialState :: State
initialState = State
{ userName : ""
, password : ""
}
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