Commit 4cab26ba authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

Merge branch 'dev' into dev-warnings-cleanup

parents 62743a0e 1b88dd0f
......@@ -12,7 +12,7 @@ import Data.Sequence as Seq
import Data.Set as Set
import Data.Tuple (fst, snd, Tuple(..))
import Data.Tuple.Nested ((/\))
import DOM.Simple.Console (log2)
-- import DOM.Simple.Console (log2)
import DOM.Simple.Types (Element)
import Effect.Aff (Aff)
import Reactix as R
......
......@@ -11,6 +11,7 @@ import Data.Tuple.Nested((/\))
import Reactix as R
import Reactix.DOM.HTML as RH
import Gargantext.Data.Array (catMaybes)
import Gargantext.Components.RandomText (words)
import Gargantext.Components.Nodes.Corpus.Graph.Tabs as GT
import Gargantext.Components.Graph as Graph
......@@ -54,11 +55,11 @@ sidebarCpt = R.hooksComponent "Sidebar" cpt
, href: "#home"
, role: "tab"
, aria: {controls: "home", selected: "true"}}
[ RH.text "Neighbours" ] ] ]
[ RH.text "Selected nodes" ] ] ]
, RH.div { className: "tab-content", id: "myTabContent" }
[ RH.div { className: "", id: "home", role: "tabpanel" }
(badge <$> badges) ] ]
, RH.div { className: "col-md-12", id: "horizontal-checkbox" }
(badge <$> badges props.selectedNodeIds nodesMap) ] ]
{-, RH.div { className: "col-md-12", id: "horizontal-checkbox" }
[ RH.ul {}
[ checkbox "Pubs"
, checkbox "Projects"
......@@ -66,6 +67,7 @@ sidebarCpt = R.hooksComponent "Sidebar" cpt
, checkbox "Others"
]
]
-}
, RH.div { className: "col-md-12", id: "query" }
[
query props.frontends props.metaData props.session nodesMap props.selectedNodeIds
......@@ -82,16 +84,10 @@ sidebarCpt = R.hooksComponent "Sidebar" cpt
, className: "checkbox"
, checked: true
, title: "Mark as completed" } ]
badges =
[ "objects"
, "evaluation"
, "dynamics"
, "virtual environments"
, "virtual reality"
, "performance analysis"
, "software engineering"
, "complex systems"
, "wireless communications" ]
badges (selectedNodeIds /\ _) nodesMap = map (\n -> n.label)
$ catMaybes
$ map (\n -> Map.lookup n nodesMap)
$ Set.toUnfoldable selectedNodeIds
query _ _ _ _ (selectedNodeIds /\ _) | Set.isEmpty selectedNodeIds = RH.div {} []
query frontends (GET.MetaData metaData) session nodesMap (selectedNodeIds /\ _) =
......@@ -108,3 +104,5 @@ sidebarCpt = R.hooksComponent "Sidebar" cpt
, listId: metaData.listId
, corpusLabel: metaData.title
}
......@@ -8,7 +8,7 @@ defaultBackends :: NonEmpty Array Backend
defaultBackends = local :| [prod, partner, demo, dev]
where
prod = backend V10 "/api/" "https://v4.gargantext.org" "iscpif.cnrs"
partner = backend V10 "/api/" "https://demo.gargantext.org" "institut-mines-telecom.imt"
partner = backend V10 "/api/" "https://dev.gargantext.org" "institut-mines-telecom.imt"
demo = backend V10 "/api/" "https://demo.gargantext.org" "demo.inshs.cnrs"
dev = backend V10 "/api/" "https://dev.gargantext.org" "devel.inshs.cnrs"
local = backend V10 "/api/" "http://localhost:8008" "local.cnrs"
......
module Gargantext.Data.Array
where
import Data.Tuple (Tuple(..))
import Data.Array as DA
import Data.Maybe
import Data.Sequence as DS
import Data.Tuple (Tuple(..))
import Prelude (bind, flip, identity, (<<<))
----------------------------------------------------------------------
-- | Split arrays tools
splitEvery :: forall a. Int -> Array a -> Array (Array a)
splitEvery _ [] = []
splitEvery n xs =
......@@ -18,3 +20,20 @@ splitAt n ls = Tuple (DS.toUnfoldable x) (DS.toUnfoldable xs)
where
Tuple x xs = DS.splitAt n (DS.fromFoldable ls)
----------------------------------------------------------------------
-- | Array with Maybe tools
mapMaybe :: forall a b. (a -> Maybe b) -> Array a -> Array b
mapMaybe f = concatMap (maybe [] singleton <<< f)
catMaybes :: forall a. Array (Maybe a) -> Array a
catMaybes = mapMaybe identity
----------------------------------------------------------------------
-- | Array misc tools
concatMap :: forall a b. (a -> Array b) -> Array a -> Array b
concatMap = flip bind
singleton :: forall a. a -> Array a
singleton a = [a]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment