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
28ccc767
Commit
28ccc767
authored
Jul 10, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PUBLIC] API connected
parent
353645de
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
95 additions
and
60 deletions
+95
-60
Corpus.purs
src/Gargantext/Components/Nodes/Corpus.purs
+8
-9
Home.purs
src/Gargantext/Components/Nodes/Home.purs
+3
-16
Public.purs
src/Gargantext/Components/Nodes/Home/Public.purs
+79
-30
Loader.purs
src/Gargantext/Hooks/Loader.purs
+5
-5
No files found.
src/Gargantext/Components/Nodes/Corpus.purs
View file @
28ccc767
...
...
@@ -29,16 +29,15 @@ import Gargantext.Types (NodeType(..), AffTableResult)
import Gargantext.Utils.Crypto as GUC
import Gargantext.Utils.Reactix as R2
type Props =
(
nodeId :: Int
type Props =
(
nodeId :: Int
, session :: Session
)
type Reload = R.State Int
type KeyProps =
(
key :: String
( key :: String
| Props
)
...
...
@@ -54,8 +53,8 @@ corpusLayoutCpt = R.hooksComponent "G.C.N.C.corpusLayout" cpt
useLoader {nodeId, reload: fst reload, session} loadCorpusWithReload $
\corpus -> corpusLayoutView {corpus, nodeId, reload, session}
type ViewProps =
(
corpus :: NodePoly Hyperdata
type ViewProps =
(
corpus :: NodePoly Hyperdata
, reload :: Reload
| Props
)
...
...
@@ -345,8 +344,8 @@ changeCode onc (Markdown md) CE.Haskell c = onc $ Haskell $ defaultHaskell' { ha
changeCode onc (Markdown md) CE.JSON c = onc $ Markdown $ defaultMarkdown' { text = c }
changeCode onc (Markdown md) CE.Markdown c = onc $ Markdown $ md { text = c }
type LoadProps =
(
nodeId :: Int
type LoadProps =
(
nodeId :: Int
, session :: Session
)
...
...
src/Gargantext/Components/Nodes/Home.purs
View file @
28ccc767
module Gargantext.Components.Nodes.Home where
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.Components.Nodes.Home.Public (
renderPublic
)
import Gargantext.License (license)
import Gargantext.Prelude (Unit,
bind,
map, pure, unit, void, ($), (<>))
import Gargantext.Prelude (Unit, map, pure, unit, void, ($), (<>))
import Reactix as R
import Reactix.DOM.HTML as H
import Routing.Hash (setHash)
...
...
@@ -53,22 +51,11 @@ homeLayoutCpt :: R.Component ( landingData :: LandingData )
homeLayoutCpt = R.hooksComponent "LayoutLanding" cpt
where
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}
]
, H.div { className: "container1" } [
renderPublic
]
, license
]
...
...
src/Gargantext/Components/Nodes/Home/Public.purs
View file @
28ccc767
module Gargantext.Components.Nodes.Home.Public where
import Data.Tuple (fst)
import Data.Argonaut as Argonaut
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Show (genericShow)
import Data.Maybe (Maybe(..))
import Data.NonEmpty (head)
import Data.String (take)
import Effect.Aff (Aff)
import Gargantext.Config (defaultBackends)
import Gargantext.Config.REST (get)
import Gargantext.Ends (backendUrl)
import Gargantext.Prelude
import Data.Tuple.Nested ((/\))
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Utils.Argonaut (genericSumDecodeJson, genericSumEncodeJson)
import Reactix as R
import Reactix.DOM.HTML as H
type PublicProps = (publicDatas ::
R.State
(Array PublicData)
type PublicProps = (publicDatas :: (Array PublicData)
-- , session :: Session
)
newtype
PublicData = PublicData
data
PublicData = PublicData
{ title :: String
, abstract :: String
, img :: String
...
...
@@ -19,22 +30,70 @@ newtype PublicData = PublicData
, date :: String
, database :: String
, author :: String
} | NoData { nodata :: String }
derive instance eqPublicData :: Eq PublicData
derive instance genericPublicData :: Generic PublicData _
instance showPublicData :: Show PublicData where
show = genericShow
instance decodeJsonPublicData :: Argonaut.DecodeJson PublicData where
decodeJson = genericSumDecodeJson
instance encodeJsonPublicData :: Argonaut.EncodeJson PublicData where
encodeJson = genericSumEncodeJson
------------------------------------------------------------------------
type LoadData = ()
type LoadProps = (reload :: Int)
loadPublicData :: Record LoadProps -> Aff (Array PublicData)
loadPublicData _l = get Nothing (backendUrl backend "public")
where
backend = head defaultBackends
renderPublic :: R.Element
renderPublic = R.createElement renderPublicCpt {} []
renderPublicCpt :: R.Component LoadData
renderPublicCpt = R.hooksComponent "G.C.N.Home.Public.renderPublic" cpt
where
cpt {} _ = do
reload <- R.useState' 0
{-
(pds /\ setPds) :: R.State PublicProps <- 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"
}
)
)
-}
useLoader { reload: fst reload } loadPublicData (\pd -> publicLayout {publicDatas: pd})
------------------------------------------------------------------------
publicLayout :: Record PublicProps -> R.Element
publicLayout props = R.createElement publicLayoutCpt props []
publicLayoutCpt :: R.Component PublicProps
publicLayoutCpt = R.
static
Component "[G.C.N.H.Public.publicLayout" cpt
publicLayoutCpt = R.
hooks
Component "[G.C.N.H.Public.publicLayout" cpt
where
cpt {publicDatas} _ =
H.span {}
cpt {publicDatas} _ =
do
pure $
H.span {}
[ H.div { className: "text-center" }
[ H.div { className:"container1" }
[ H.h2 {} [H.text "Public Maps"]
, H.p {className: "lead text-muted"} [H.text "Discover maps made with "
, H.div {className: "fa fa-heart"} []]
, H.p { className: "lead text-muted"}
[ H.text "Discover maps made with "
, H.div {className: "fa fa-heart"} []
]
, H.p { className:"flex-space-around" }
[ H.a { className: "btn btn-primary my-2"
, href :"https://gargantext.org"
...
...
@@ -44,28 +103,17 @@ publicLayoutCpt = R.staticComponent "[G.C.N.H.Public.publicLayout" cpt
]
-- | TODO browse maps
-- | TODO random maps
, album p
d
s
, album p
ublicData
s
]
where
(pds /\ _setPublicData) = publicDatas
{-
<section class="jumbotron text-center">
<div class="container" >
<h1 class="jumbotron-heading">Gargantext Maps</h1>
<p class="lead text-muted">Discover maps made with love</p>
<p>
<a href="http://gargantext.org" target="blank" class="btn btn-primary my-2">More about Gargantext</a>
<a href="http://iscpif.fr" target="blank" class="btn btn-secondary my-2">CNRS/ISC-PIF</a>
</p>
</div>
</section>
-}
album :: Array PublicData -> R.Element
album pd = H.div {className: "album py-5 bg-light"}
album pd
s
= 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 )
(map (\tab -> H.div {className : "col-md-6 content"}
[tableau tab]
) pds
)
]
]
...
...
@@ -102,3 +150,4 @@ tableau (PublicData {title, abstract, img, url, date, database, author}) =
]
]
]
tableau (NoData {nodata}) = H.div {className : "center"} [H.h2 {} [H.text "Create a corpus and publicize it"]]
src/Gargantext/Hooks/Loader.purs
View file @
28ccc767
...
...
@@ -24,8 +24,8 @@ import Gargantext.Utils.CacheAPI as GUC
import Gargantext.Utils.Reactix as R2
useLoader :: forall path st. Eq path
=>
path
useLoader :: forall path st. Eq path
=>
path
-> (path -> Aff st)
-> (st -> R.Element)
-> R.Hooks R.Element
...
...
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