Commit 64a7d396 authored by Abinaya Sudhir's avatar Abinaya Sudhir
parents b3b820f8 7588c9a6
...@@ -71,12 +71,11 @@ performAction NoOp _ _ = void do ...@@ -71,12 +71,11 @@ performAction NoOp _ _ = void do
performAction (SelectDatabase selected) _ _ = void do performAction (SelectDatabase selected) _ _ = void do
modifyState \( state) -> state { select_database = selected } modifyState \( state) -> state { select_database = selected }
performAction (UnselectDatabase unselected) _ _ = void do performAction (UnselectDatabase unselected) _ _ = void do
modifyState \( state) -> state { unselect_database = unselected } modifyState \( state) -> state { unselect_database = unselected }
performAction (LoadDatabaseDetails) _ _ = void do performAction (LoadDatabaseDetails) _ _ = void do
res <- lift $ getDatabaseDetails $ QueryString{query_query: "string",query_name: ["Pubmed"]} res <- lift $ getDatabaseDetails $ QueryString { query_query: "string",query_name: ["Pubmed"]}
case res of case res of
Left err -> cotransform $ \(state) -> state Left err -> cotransform $ \(state) -> state
Right resData -> do Right resData -> do
...@@ -87,6 +86,55 @@ performAction GO _ _ = void do ...@@ -87,6 +86,55 @@ performAction GO _ _ = void do
modifyState id modifyState id
layoutModal :: forall e. { response :: Array Response | e} -> Array ReactElement
layoutModal state =
[button [ _type "button"
, _data { "toggle" : "modal"
, "target" : ".myModal"
}
][text "Launch modal"]
, div [ className "modal fade myModal"
, role "dialog"
, _data {show : true}
][ div [ className "modal-dialog"
, role "document"
] [ div [ className "modal-content"]
[ div [ className "modal-header"]
[ h5 [ className "modal-title"
]
[ text "CorpusView"
]
, button [ _type "button"
, className "close"
, _data { dismiss : "modal"}
] [ span [ aria {hidden : true}]
[ text "X"]
]
]
, div [ className "modal-body"]
[ ul [ className "list-group"] ( map fn1 state.response ) ]
, div [className "modal-footer"]
[ button [ _type "button"
, className "btn btn-secondary"
, _data {dismiss : "modal"}
] [ text "GO"]
]
]
]
]
]
where
fn1 (Response o) =
li [className "list-group-item justify-content-between"]
[
span [] [text o.name]
, span [className "badge badge-default badge-pill"] [ text $ show o.count]
]
layoutAddcorpus :: forall props eff . Spec (console::CONSOLE, ajax::AJAX, dom::DOM | eff) State props Action layoutAddcorpus :: forall props eff . Spec (console::CONSOLE, ajax::AJAX, dom::DOM | eff) State props Action
layoutAddcorpus = simpleSpec performAction render layoutAddcorpus = simpleSpec performAction render
...@@ -100,29 +148,7 @@ layoutAddcorpus = simpleSpec performAction render ...@@ -100,29 +148,7 @@ layoutAddcorpus = simpleSpec performAction render
div [className "jumbotron"] div [className "jumbotron"]
[ div [className "row"] [ div [className "row"]
[ [
div [className "col-md-6"] div [className "col-md-6"] (layoutModal state)
[
button [_type "button", _data {"toggle" : "modal", "target" : ".myModal"}][text "Launch modal"]
, div [className "modal fade myModal",role "dialog", _data {show : true} ]
[ div [className "modal-dialog",role "document"]
[ div [className "modal-content"]
[ div [className "modal-header"]
[ h5 [className "modal-title"] [ text "CorpusView"]
, button [ _type "button",className "close", _data { dismiss : "modal"}]
[ span [aria {hidden : true}] [ text "X"]
]
]
, div [className "modal-body"]
[ ul [className "list-group"] $ map fn1 state.response
]
, div [className "modal-footer"]
[ button [ _type "button", className "btn btn-secondary", _data {dismiss : "modal"}]
[ text "GO"]
]
]
]
]
]
, div [className "col-md-6"] , div [className "col-md-6"]
[ [
h3 [] [text "Corpusview"] h3 [] [text "Corpusview"]
......
...@@ -17,7 +17,7 @@ randomChars : randomizes chars in a word. ...@@ -17,7 +17,7 @@ randomChars : randomizes chars in a word.
TODO: add some tests as examples. TODO: add some tests as examples.
-} -}
module RandomText where module Gargantext.RandomText where
import Prelude import Prelude
......
...@@ -69,7 +69,7 @@ jumboTitle b = div jumbo ...@@ -69,7 +69,7 @@ jumboTitle b = div jumbo
] ]
] ]
, div [ className "col-md-2 content"] , div [ className "col-md-2 content"]
[p [ className "right" ] [ p [ className "right" ]
[ div [_id "logo-designed" ] [ div [_id "logo-designed" ]
[ img [ src "images/logo.png", title "Project hosted by CNRS (France, Europa, Solar System)" ] [ img [ src "images/logo.png", title "Project hosted by CNRS (France, Europa, Solar System)" ]
[] []
......
...@@ -4,8 +4,10 @@ import DOM ...@@ -4,8 +4,10 @@ import DOM
import AddCorpusview as AC import AddCorpusview as AC
import Control.Monad.Eff.Console (CONSOLE) import Control.Monad.Eff.Console (CONSOLE)
import Data.Array (concat)
import Data.Either (Either(..)) import Data.Either (Either(..))
import Data.Foldable (fold) import Data.Foldable (fold, intercalate)
import Data.Lens (Lens', Prism', lens, over, prism) import Data.Lens (Lens', Prism', lens, over, prism)
import Data.Maybe (Maybe(Nothing, Just)) import Data.Maybe (Maybe(Nothing, Just))
import DocView as DV import DocView as DV
...@@ -177,7 +179,8 @@ routingSpec = simpleSpec performAction defaultRender ...@@ -177,7 +179,8 @@ routingSpec = simpleSpec performAction defaultRender
layout0 :: forall eff props. Spec (E eff) AppState props Action -> Spec (E eff) AppState props Action layout0 :: forall eff props. Spec (E eff) AppState props Action
-> Spec (E eff) AppState props Action
layout0 layout = layout0 layout =
fold fold
[ layoutSidebar [ layoutSidebar
...@@ -187,7 +190,8 @@ layout0 layout = ...@@ -187,7 +190,8 @@ layout0 layout =
, layoutFooter , layoutFooter
] ]
where where
innerLayout :: Spec (E eff) AppState props Action -> Spec (E eff) AppState props Action innerLayout :: Spec (E eff) AppState props Action
-> Spec (E eff) AppState props Action
innerLayout = over _render \render d p s c -> innerLayout = over _render \render d p s c ->
[ div [_id "page-wrapper"] [ div [_id "page-wrapper"]
[ [
...@@ -233,7 +237,6 @@ divLogo = a [ className "navbar-brand logoSmall" ...@@ -233,7 +237,6 @@ divLogo = a [ className "navbar-brand logoSmall"
] [] ] []
] ]
divDropdownLeft :: ReactElement divDropdownLeft :: ReactElement
divDropdownLeft = ul [className "nav navbar-nav"] divDropdownLeft = ul [className "nav navbar-nav"]
[ ul [className "nav navbar-nav pull-left"] [ ul [className "nav navbar-nav pull-left"]
...@@ -247,8 +250,17 @@ divDropdownLeft = ul [className "nav navbar-nav"] ...@@ -247,8 +250,17 @@ divDropdownLeft = ul [className "nav navbar-nav"]
] [] ] []
, text " Info" , text " Info"
] ]
, ul [className "dropdown-menu"] , ul [className "dropdown-menu"] divLeftdropdownElements
(( map liNav [ LiNav { title : "Quick start, tutorials and methodology" ]
]
]
-- WYSIWYG = Pure React
divLeftdropdownElements :: Array ReactElement
divLeftdropdownElements = menu
[ -- ===========================================================
[ LiNav { title : "Quick start, tutorials and methodology"
, href : "https://iscpif.fr/gargantext/your-first-map/" , href : "https://iscpif.fr/gargantext/your-first-map/"
, icon : "fas fa-book" , icon : "fas fa-book"
, text : "Documentation" , text : "Documentation"
...@@ -259,9 +271,8 @@ divDropdownLeft = ul [className "nav navbar-nav"] ...@@ -259,9 +271,8 @@ divDropdownLeft = ul [className "nav navbar-nav"]
, text : "Feedback" , text : "Feedback"
} }
] ]
) , -----------------------------------------------------------
<> [li [className "divider"] []] <> [ LiNav { title : "Interactive chat"
(map liNav [ LiNav { title : "Interactive chat"
, href : "https://chat.iscpif.fr/channel/gargantext" , href : "https://chat.iscpif.fr/channel/gargantext"
, icon : "fab fa-rocketchat" , icon : "fab fa-rocketchat"
, text : "Chat" , text : "Chat"
...@@ -272,19 +283,20 @@ divDropdownLeft = ul [className "nav navbar-nav"] ...@@ -272,19 +283,20 @@ divDropdownLeft = ul [className "nav navbar-nav"]
, text : "Forum" , text : "Forum"
} }
] ]
) ,------------------------------------------------------------
<> [li [className "divider"] []] <> [ LiNav { title : "More about us (you)"
[ liNav (LiNav { title : "More about us (you)"
, href : "http://iscpif.fr" , href : "http://iscpif.fr"
, icon : "fas fa-question-circle" , icon : "fas fa-question-circle"
, text : "About" , text : "About"
} }
)
]
)
]
]
] ]
] -- ===========================================================
menu :: Array (Array LiNav) -> Array ReactElement
menu ns = intercalate divider $ map (map liNav) ns
where
divider :: Array ReactElement
divider = [li [className "divider"] []]
data LiNav = LiNav { title :: String data LiNav = LiNav { title :: String
...@@ -312,8 +324,9 @@ liNav (LiNav { title:tit ...@@ -312,8 +324,9 @@ liNav (LiNav { title:tit
-- TODO put the search form in the center of the navBar -- TODO put the search form in the center of the navBar
divSearchBar :: ReactElement divSearchBar :: ReactElement
divSearchBar = ul [ className "nav navbar-nav", style { "margin-left" : "146px"}] divSearchBar = ul [ className "nav navbar-nav"
[ div [className "navbar-form"] , style { "margin-left" : "146px"}
] [ div [className "navbar-form"]
[ input [ className "search-query" [ input [ className "search-query"
, placeholder "Query, URL or FILE (works with Firefox or Chromium browsers)" , placeholder "Query, URL or FILE (works with Firefox or Chromium browsers)"
, _type "text" , _type "text"
...@@ -330,7 +343,8 @@ divSearchBar = ul [ className "nav navbar-nav", style { "margin-left" : "146px"} ...@@ -330,7 +343,8 @@ divSearchBar = ul [ className "nav navbar-nav", style { "margin-left" : "146px"}
--divDropdownRight :: Render AppState props Action --divDropdownRight :: Render AppState props Action
divDropdownRight :: ReactElement divDropdownRight :: ReactElement
divDropdownRight = ul [className "nav navbar-nav pull-right"] divDropdownRight =
ul [className "nav navbar-nav pull-right"]
[ [
-- TODO if logged in : enable dropdown to logout -- TODO if logged in : enable dropdown to logout
li [className "dropdown"] li [className "dropdown"]
...@@ -383,8 +397,7 @@ layoutSpec :: forall eff props. Spec (E eff) AppState props Action ...@@ -383,8 +397,7 @@ layoutSpec :: forall eff props. Spec (E eff) AppState props Action
layoutSpec = layoutSpec =
fold fold
[ routingSpec [ routingSpec
, container $ , container $ withState pagesComponent
withState pagesComponent
] ]
where where
container :: Spec (E eff) AppState props Action -> Spec (E eff) AppState props Action container :: Spec (E eff) AppState props Action -> Spec (E eff) AppState props Action
......
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