Commit 64a7d396 authored by Abinaya Sudhir's avatar Abinaya Sudhir
parents b3b820f8 7588c9a6
......@@ -71,12 +71,11 @@ performAction NoOp _ _ = void do
performAction (SelectDatabase selected) _ _ = void do
modifyState \( state) -> state { select_database = selected }
performAction (UnselectDatabase unselected) _ _ = void do
modifyState \( state) -> state { unselect_database = unselected }
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
Left err -> cotransform $ \(state) -> state
Right resData -> do
......@@ -87,6 +86,55 @@ performAction GO _ _ = void do
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 = simpleSpec performAction render
......@@ -100,29 +148,7 @@ layoutAddcorpus = simpleSpec performAction render
div [className "jumbotron"]
[ div [className "row"]
[
div [className "col-md-6"]
[
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"] (layoutModal state)
, div [className "col-md-6"]
[
h3 [] [text "Corpusview"]
......@@ -146,7 +172,7 @@ layoutAddcorpus = simpleSpec performAction render
newtype QueryString = QueryString
{
query_query :: String
, query_name :: Array String
, query_name :: Array String
}
queryString :: QueryString
......
......@@ -17,7 +17,7 @@ randomChars : randomizes chars in a word.
TODO: add some tests as examples.
-}
module RandomText where
module Gargantext.RandomText where
import Prelude
......
......@@ -69,10 +69,10 @@ jumboTitle b = div jumbo
]
]
, div [ className "col-md-2 content"]
[p [ className "right" ]
[ div [_id "logo-designed" ]
[ img [ src "images/logo.png", title "Project hosted by CNRS (France, Europa, Solar System)" ]
[]
[ p [ className "right" ]
[ div [_id "logo-designed" ]
[ img [ src "images/logo.png", title "Project hosted by CNRS (France, Europa, Solar System)" ]
[]
]
]
]
......
......@@ -4,8 +4,10 @@ import DOM
import AddCorpusview as AC
import Control.Monad.Eff.Console (CONSOLE)
import Data.Array (concat)
import Data.Either (Either(..))
import Data.Foldable (fold)
import Data.Foldable (fold, intercalate)
import Data.Lens (Lens', Prism', lens, over, prism)
import Data.Maybe (Maybe(Nothing, Just))
import DocView as DV
......@@ -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 =
fold
[ layoutSidebar
......@@ -187,7 +190,8 @@ layout0 layout =
, layoutFooter
]
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 ->
[ div [_id "page-wrapper"]
[
......@@ -233,7 +237,6 @@ divLogo = a [ className "navbar-brand logoSmall"
] []
]
divDropdownLeft :: ReactElement
divDropdownLeft = ul [className "nav navbar-nav"]
[ ul [className "nav navbar-nav pull-left"]
......@@ -247,46 +250,55 @@ divDropdownLeft = ul [className "nav navbar-nav"]
] []
, text " Info"
]
, ul [className "dropdown-menu"]
(( map liNav [ LiNav { title : "Quick start, tutorials and methodology"
, href : "https://iscpif.fr/gargantext/your-first-map/"
, icon : "fas fa-book"
, text : "Documentation"
}
, LiNav { title : "Report bug here"
, href : "https://www.iscpif.fr/gargantext/feedback-and-bug-reports/"
, icon : "glyphicon glyphicon-bullhorn"
, text : "Feedback"
}
]
)
<> [li [className "divider"] []] <>
(map liNav [ LiNav { title : "Interactive chat"
, href : "https://chat.iscpif.fr/channel/gargantext"
, icon : "fab fa-rocketchat"
, text : "Chat"
}
, LiNav { title : "Asynchronous discussions"
, href : "https://discourse.iscpif.fr/c/gargantext"
, icon : "fab fa-discourse"
, text : "Forum"
}
]
)
<> [li [className "divider"] []] <>
[ liNav (LiNav { title : "More about us (you)"
, href : "http://iscpif.fr"
, icon : "fas fa-question-circle"
, text : "About"
}
)
]
)
]
, ul [className "dropdown-menu"] divLeftdropdownElements
]
]
]
-- WYSIWYG = Pure React
divLeftdropdownElements :: Array ReactElement
divLeftdropdownElements = menu
[ -- ===========================================================
[ LiNav { title : "Quick start, tutorials and methodology"
, href : "https://iscpif.fr/gargantext/your-first-map/"
, icon : "fas fa-book"
, text : "Documentation"
}
, LiNav { title : "Report bug here"
, href : "https://www.iscpif.fr/gargantext/feedback-and-bug-reports/"
, icon : "glyphicon glyphicon-bullhorn"
, text : "Feedback"
}
]
, -----------------------------------------------------------
[ LiNav { title : "Interactive chat"
, href : "https://chat.iscpif.fr/channel/gargantext"
, icon : "fab fa-rocketchat"
, text : "Chat"
}
, LiNav { title : "Asynchronous discussions"
, href : "https://discourse.iscpif.fr/c/gargantext"
, icon : "fab fa-discourse"
, text : "Forum"
}
]
,------------------------------------------------------------
[ LiNav { title : "More about us (you)"
, href : "http://iscpif.fr"
, icon : "fas fa-question-circle"
, 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
, href :: String
, icon :: String
......@@ -312,42 +324,44 @@ liNav (LiNav { title:tit
-- TODO put the search form in the center of the navBar
divSearchBar :: ReactElement
divSearchBar = ul [ className "nav navbar-nav", style { "margin-left" : "146px"}]
[ div [className "navbar-form"]
[ input [ className "search-query"
, placeholder "Query, URL or FILE (works with Firefox or Chromium browsers)"
, _type "text"
, style { height: "35px"
, width : "450px"
-- , color: "white"
-- , background : "#A1C2D8"
}
] []
-- TODO add button in navbar (and "enter" execution)
-- , div [] [button [][]]
]
divSearchBar = ul [ className "nav navbar-nav"
, style { "margin-left" : "146px"}
] [ div [className "navbar-form"]
[ input [ className "search-query"
, placeholder "Query, URL or FILE (works with Firefox or Chromium browsers)"
, _type "text"
, style { height: "35px"
, width : "450px"
-- , color: "white"
-- , background : "#A1C2D8"
}
] []
-- TODO add button in navbar (and "enter" execution)
-- , div [] [button [][]]
]
]
--divDropdownRight :: Render AppState props Action
divDropdownRight :: ReactElement
divDropdownRight = ul [className "nav navbar-nav pull-right"]
[
-- TODO if logged in : enable dropdown to logout
li [className "dropdown"]
[
a [ aria {hidden : true}
, className "glyphicon glyphicon-log-in"
, href "#/login"
, style {color:"white"}
, title "Log in and save your time"
-- TODO hover: bold
]
-- TODO if logged in
--, text " username"
-- else
[text " Login / Signup"]
]
]
divDropdownRight =
ul [className "nav navbar-nav pull-right"]
[
-- TODO if logged in : enable dropdown to logout
li [className "dropdown"]
[
a [ aria {hidden : true}
, className "glyphicon glyphicon-log-in"
, href "#/login"
, style {color:"white"}
, title "Log in and save your time"
-- TODO hover: bold
]
-- TODO if logged in
--, text " username"
-- else
[text " Login / Signup"]
]
]
......@@ -383,8 +397,7 @@ layoutSpec :: forall eff props. Spec (E eff) AppState props Action
layoutSpec =
fold
[ routingSpec
, container $
withState pagesComponent
, container $ withState pagesComponent
]
where
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