Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
Memiscape Purescript
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
Ali El Amrani
Memiscape Purescript
Commits
36b78810
Commit
36b78810
authored
Sep 14, 2021
by
Ali El Amrani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[add cpt loaded]
parent
4b95229f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
32 deletions
+59
-32
Infos.purs
src/Phylo/Components/Infos.purs
+59
-32
No files found.
src/Phylo/Components/Infos.purs
View file @
36b78810
...
...
@@ -5,10 +5,12 @@ import Prelude
import DOM.Simple.Console (log, log2)
import Data.Array (length)
import Data.Int (toNumber, round)
import Data.Maybe (Maybe(..),
fromMaybe
, maybe)
import Data.Maybe (Maybe(..),
isJust
, maybe)
import Data.Nullable (null, toMaybe)
import Effect.Aff (Aff, launchAff_)
import Effect (Effect)
import Effect.Aff (Aff, killFiber, launchAff, launchAff_)
import Effect.Class (liftEffect)
import Effect.Exception (error)
import FFI.Simple (delay)
import Graphics.D3.Base (D3Eff)
import Graphics.D3.Contour as Contour
...
...
@@ -23,42 +25,18 @@ type InfoCorpus =
, nbFondations :: Int
, nbPeriods :: Int
)
--getPhyloName =
-- launchAff_ $ do
-- mr <- PTE.fetchPhyloJSON
-- liftEffect $ do
-- case mr of
-- Nothing -> log "Nothing"
-- Just r -> log2 "r" r.name
-- pure $ maybe mr.name
intToString :: Int -> String
intToString x = show x
infoCorpusR :: R.Element
infoCorpusR = infoCorpus {nbDocs : 0
,nbFondations : 0
,nbPeriods : 0}
infoCorpus :: Record InfoCorpus -> R.Element
infoCorpus props = R.createElement infoCorpusCpt props []
infoCorpusCpt :: R.Component InfoCorpus
infoCorpusCpt = R.hooksComponent "infoCorpus" cpt where
cpt { } _children = do
-- R.useEffect'
-- launchAff_ $ do
-- mr <- PTE.fetchPhyloJSON
-- liftEffect $ do
pure $ H.div {className:"phyloCorpus"} [H.text "Here lies Corpus-info",
-- H.div {className:"phyloCorpus-info"}[H.text "0"]]
H.div {className:"phyloCorpus-info"}[H.text "Infos"]]
type InfoPhylo =
( nbTerms :: Int
, nbGroups :: Int
, nbBranches :: Int
)
infoCorpusR :: R.Element
infoCorpusR = infoCorpus {nbDocs : 0
,nbFondations : 0
,nbPeriods : 0}
infoPhyloR :: R.Element
infoPhyloR = infoPhylo {nbTerms : 0
,nbGroups : 0
...
...
@@ -71,4 +49,53 @@ infoPhyloCpt :: R.Component InfoPhylo
infoPhyloCpt = R.hooksComponent "infoPhylo" cpt where
cpt { } _children = do
pure $ H.div {className:"phyloInfos"} [H.text "Here lies Phylo-info",
H.div {className:"phyloInfos-info"}[H.text "0"]]
\ No newline at end of file
H.div {className:"phyloInfos-info"}[H.text "0"]]
infoCorpus :: Record InfoCorpus -> R.Element
infoCorpus props = R.createElement infoCorpusCpt props []
--infoCorpusCpt :: R.Component InfoCorpus
--infoCorpusCpt = R.hooksComponent "infoCorpus" cpt where
-- cpt { } _children = do
-- pure $ H.div {className:"phyloCorpus"} [H.text "Here lies Corpus-info",
-- H.div {className:"phyloCorpus-info"}[H.text $ "Corpus Info here"]
type InfoCorpusLoaded =
( fetched :: T.Box (Maybe PTE.PhyloJSON) )
infoCorpusCpt :: R.Component InfoCorpus
infoCorpusCpt = R.hooksComponent "infoCorpus" cpt where
cpt { } _children = do
fetched <- T.useBox Nothing
R.useEffect' $ do
launchAff_ $ do
mr <- PTE.fetchPhyloJSON
liftEffect $ do
case mr of
Nothing -> log "Nothing"
Just r -> T.write_ (Just r) fetched
pure $ infoCorpusLoaded { fetched } []
infoCorpusLoaded = R.createElement infoCorpusLoadedCpt
infoCorpusLoadedCpt :: R.Component InfoCorpusLoaded
infoCorpusLoadedCpt = R.hooksComponent "infoCorpusLoaded" cpt where
cpt { fetched } _ = do
fetched' <- T.useLive T.unequal fetched
case fetched' of
Nothing -> pure $ H.div {}[]
Just mr -> pure $ H.div {className:"phyloCorpus"}
[H.text "Here lies Corpus-info",
H.div {className:"phyloCorpus-info"}[H.text mr.name]]
--getPhyloName =
-- launchAff_ $ do
-- mr <- PTE.fetchPhyloJSON
-- liftEffect $ do
-- case mr of
-- Nothing -> log "Nothing"
-- Just r -> log2 "r" r.name
-- pure $ maybe mr.name
\ No newline at end of file
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