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
a47efda1
Commit
a47efda1
authored
Jul 10, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEAT PUBLIC] Home canvas
parent
4a090915
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
124 additions
and
20 deletions
+124
-20
Home.purs
src/Gargantext/Components/Nodes/Home.purs
+31
-15
Public.purs
src/Gargantext/Components/Nodes/Home/Public.purs
+84
-0
RandomText.purs
src/Gargantext/Components/Nodes/Home/RandomText.purs
+7
-4
Ends.purs
src/Gargantext/Ends.purs
+2
-1
No files found.
src/Gargantext/Components/Nodes/Home.purs
View file @
a47efda1
module Gargantext.Components.Nodes.Home where
import Prelude
import Data.Array (replicate)
import Data.Foldable (foldl)
import Data.Newtype (class Newtype)
import Effect (Effect)
import Gargantext.Components.Data.Landing (BlockText(..), BlockTexts(..), Button(..), LandingData(..))
import Gargantext.Components.Lang (LandingLang(..))
import Gargantext.Components.Lang.Landing.EnUS as En
import Gargantext.Components.Lang.Landing.FrFR as Fr
import Gargantext.Components.Nodes.Home.Public (PublicData(..), publicLayout)
import Gargantext.License (license)
import Gargantext.Prelude (Unit, bind, map, pure, unit, void, ($), (<>))
import Reactix as R
import Reactix.DOM.HTML as H
import Routing.Hash (setHash)
import Gargantext.License (license)
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.Lang (LandingLang(..))
type Props = ()
...
...
@@ -48,15 +50,27 @@ homeLayout lang = R.createElement homeLayoutCpt {landingData} []
where landingData = langLandingData lang
homeLayoutCpt :: R.Component ( landingData :: LandingData )
homeLayoutCpt = R.
static
Component "LayoutLanding" cpt
homeLayoutCpt = R.
hooks
Component "LayoutLanding" cpt
where
cpt {landingData} _ =
H.span {}
[ H.div { className: "container1" } [ jumboTitle landingData false ]
, H.div { className: "container1" } [] -- TODO put research form
, H.div { className: "container1" } [ blocksRandomText' landingData ]
, license
]
cpt {landingData} _ = do
pds <- R.useState' ( replicate 6 (PublicData { title: "Title"
, abstract : foldl (<>) "" $ replicate 100 "abstract "
, img: "images/Gargantextuel-212x300.jpg"
, url : "https://.."
, date: "YY/MM/DD"
, database: "database"
, author : "Author"
}
)
)
pure $ H.span {}
[ H.div { className: "container1" } [ jumboTitle landingData false ]
, H.div { className: "container1" } [] -- TODO put research form
, H.div { className: "container1" } [ blocksRandomText' landingData ]
, H.div { className: "container1" } [ publicLayout {publicDatas:pds} ]
, license
]
------------------------------------------------------------------------
...
...
@@ -89,6 +103,8 @@ docButton (Button b) =
, H.text b.text
]
-- | TODO
-- <img src='logo.png' onmouseover="this.src='gargantextuel.png';" onmouseout="this.src='logo.png';" />
jumboTitle :: LandingData -> Boolean -> R.Element
jumboTitle (LandingData hd) b =
H.div {className: jumbo}
...
...
src/Gargantext/Components/Nodes/Home/Public.purs
0 → 100644
View file @
a47efda1
module Gargantext.Components.Nodes.Home.Public where
import Data.String (take)
import Gargantext.Prelude
import Data.Tuple.Nested ((/\))
import Data.Newtype (class Newtype)
import Effect (Effect)
import Reactix as R
import Reactix.DOM.HTML as H
import Gargantext.Sessions (Session(..))
type PublicProps = (publicDatas :: R.State (Array PublicData)
-- , session :: Session
)
newtype PublicData = PublicData
{ title :: String
, abstract :: String
, img :: String
, url :: String
, date :: String
, database :: String
, author :: String
}
publicLayout :: Record PublicProps -> R.Element
publicLayout props = R.createElement publicLayoutCpt props []
publicLayoutCpt :: R.Component PublicProps
publicLayoutCpt = R.staticComponent "[G.C.N.H.Public.publicLayout" cpt
where
cpt {publicDatas} _ =
H.span {}
[ H.div { className: "container1" } [ H.h2 {} [H.text "Public Maps"]]
-- | TODO browse maps
-- | TODO random maps
, album pds
]
where
(pds /\ _setPublicData) = publicDatas
album :: Array PublicData -> R.Element
album pd = H.div {className: "album py-5 bg-light"}
[ H.div { className: "container" }
[ H.div { className : "row" }
(map (\tab -> H.div {className : "col-md-6 content"} [tableau tab]) pd )
]
]
tableau :: PublicData -> R.Element
tableau (PublicData {title, abstract, img, url, date, database, author}) =
H.div {className: "card mb-6 box-shadow"}
[ H.a { target: "_blank", href: url } [ H.div { className:"center"}
[H.img { src: img
, width: "50%"
}
]
]
, H.div { className : "card-body"}
[ H.h3 {} [H.text title]
, H.p { className: "card-text"} [H.text $ (take 252 abstract) <> "..."]
, H.div { className: "center justify-content-between align-items-center"}
[ H.div { className: "btn-group" }
[ H.button { className : "btn btn-default flex-between"
, href : url
, role : "button"
} [ H.text "View the map" ]
{- TODO
, H.button { className : "btn btn-default flex-start"
, href : url
, role : "button"
} [ H.text "More like this" ]
-}
]
, H.div { className : "small text-muted flex-end" } [ H.text $ "Made by " <> author
<> " on " <> date
<> " with " <> database
]
]
]
]
src/Gargantext/Components/Nodes/Home/RandomText.purs
View file @
a47efda1
...
...
@@ -50,10 +50,12 @@ randomChars word = case (length (toCharArray word)) >= 5 of
-------------------------------------------------------------------
words :: String -> Array String
words sentence = filter ((/=) "") $ split (Pattern " ") sentence
words sentence = filter ((/=) "")
$ split (Pattern " ") sentence
sentences :: String -> Array String
sentences paragraph = filter ((/=) "") $ split (Pattern ".") paragraph
sentences paragraph = filter ((/=) "")
$ split (Pattern ".") paragraph
-------------------------------------------------------------------
...
...
@@ -63,7 +65,8 @@ data RandomWheel a = RandomWheel { before :: Array a
}
randomPart :: forall b. Array b -> Effect (Array b)
randomPart array = randomArrayPoly middle >>= \(middle') -> pure ( start <> middle' <> end)
randomPart array = randomArrayPoly middle
>>= \(middle') -> pure ( start <> middle' <> end)
where
start = take 2 array
middle = dropEnd 2 $ drop 2 array
...
...
@@ -93,7 +96,7 @@ randomArray array = unsafePartial $ do
case maybeDuring of
Nothing ->
crash "[ERROR] It should never happen."
crash "[
G.C.N.H.R.RandomText
ERROR] It should never happen."
Just during ->
pure $ RandomWheel { before : remove n array
, during : during
...
...
src/Gargantext/Ends.purs
View file @
a47efda1
...
...
@@ -24,7 +24,8 @@ newtype Backend = Backend
{ name :: String
, baseUrl :: String
, prePath :: String
, version :: ApiVersion }
, version :: ApiVersion
}
backend :: ApiVersion -> String -> String -> String -> Backend
backend version prePath baseUrl name = Backend { name, version, prePath, baseUrl }
...
...
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