Commit 76e18024 authored by Abinaya Sudhir's avatar Abinaya Sudhir

pulled code

parents ac67045d dfb784a8
......@@ -30,6 +30,7 @@ import Routing.Hash.Aff (setHash)
import Thermite (PerformAction, Render, Spec, _render, cotransform, focus, foreach, modifyState, simpleSpec, withState)
import Unsafe.Coerce (unsafeCoerce)
import Landing as L
type State =
......@@ -61,7 +62,10 @@ data Action
| GO
performAction :: forall eff props. PerformAction (console :: CONSOLE, ajax :: AJAX,dom::DOM | eff) State props Action
performAction :: forall eff props. PerformAction ( console :: CONSOLE
, ajax :: AJAX
, dom :: DOM
| eff ) State props Action
performAction NoOp _ _ = void do
modifyState id
......@@ -91,7 +95,8 @@ addcorpusviewSpec = simpleSpec performAction render
render :: Render State props Action
render dispatch _ state _ =
[
div [className "container"]
div [className "container"] [L.jumboTitle false]
, div [className "container"]
[
div [className "jumbotron"]
[ div [className "row"]
......
......@@ -51,9 +51,9 @@ type EchartsProps eff =
option :: Option, -- PropTypes.object.isRequired,
initOpts :: String, -- PropTypes.object,
notMerge :: Boolean,
lazyUpdate:: Boolean,
lazyUpdate :: Boolean,
loading :: Boolean,
optsLoading:: OptsLoading, -- PropTypes.object,
optsLoading :: OptsLoading, -- PropTypes.object,
onReady :: String, -- PropTypes.func,
resizable :: Boolean, -- PropTypes.bool,
onEvents :: String -- PropTypes.object
......@@ -63,7 +63,7 @@ type OptsLoading =
{ text :: String,
color :: Color, --- color
textColor :: Color, --color
maskColor:: Color, --color
maskColor :: Color, --color
zlevel :: Int
}
......@@ -80,11 +80,11 @@ type Option =
type DataZoom =
{"type":: String
, xAxisIndex:: Int
, filterMode:: String
, start:: Int
, end:: Int
{"type" :: String
, xAxisIndex :: Int
, filterMode :: String
, start :: Int
, end :: Int
}
type Grid =
......@@ -116,7 +116,7 @@ type Legend =
}
type Data =
{name :: String
{ name :: String
, icon :: String
, textStyle :: {}
}
......@@ -173,7 +173,7 @@ type AxisLabel =
type Series =
{name :: String
{ name :: String
, "type" :: String
, "data" :: Array Int
}
......@@ -373,16 +373,20 @@ yAxisIndex = unsafeMkProps "yAxisIndex"
-- , p''
-- ]
ex1 :: ReactElement
ex1 = echarts
histogram :: ReactElement
histogram = echarts
[ option
[ tooltip [trigger "axis"]
, grid [containLabel true]
, legend [data' ["Query A", "Query B", "Query C"]]
, legend [data' ["Map terms coverage", "Favorites", "All"]]
-- , legend [data' ["Map Terms coverage", "Favorites", "All"]]
, xAxis
[ type' "category"
, axisTick [alignWithLabel true]
, data' ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "July", "Aug", "Sep", "Oct", "Nov", "Dec"]
, data' ["Jan" , "Feb", "Mar" , "Apr"
, "May", "Jun", "July", "Aug"
, "Sep", "Oct", "Nov" , "Dec"
]
]
, dataZoom [dz1,dz1,dz2,dz2]
, yAxis [ya1, ya2]
......@@ -408,22 +412,22 @@ dz2 = unsafeFromPropsArray
ya1 = unsafeFromPropsArray
[ type' "value"
, name "Publications (by year)"
, name "Score metric"
, min 0
, position "left"
, position "right"
, axisLabel [formatter "{value}"]
]
ya2 = unsafeFromPropsArray
[ type' "value"
, name "Score metric"
, name "Publications (by year)"
, min 0
, position "right"
, position "left"
, axisLabel [formatter "{value}"]
]
sd1 = unsafeFromPropsArray
[ name "Query A"
[ name "Map terms coverage"
, type' "line"
, label [normal[showp true, position "top"]]
, lineStyle [ normal
......@@ -432,26 +436,26 @@ sd1 = unsafeFromPropsArray
, shadowBlur 10
, shadowOffsetY 10
]]
, data' [1, 13, 37, 35, 15, 13, 25, 21, 6, 45, 32, 2]
, data' [95, 80, 75, 35, 30, 50, 70, 80, 95, 95, 95, 99]
]
sd2 = unsafeFromPropsArray
[ name "Query B"
sd3 = unsafeFromPropsArray
[ name "All"
, type' "bar"
, label [normal[showp true, position "top"]]
, yAxisIndex 1
, data' [22, 22, 23, 77, 24, 55, 55, 89, 98, 164, 106, 224]
, data' [201, 222, 223, 777, 244, 255, 555, 879, 938, 1364, 1806, 2324]
]
sd3 = unsafeFromPropsArray
[ name "Query C"
sd2 = unsafeFromPropsArray
[ name "Favorites"
, type' "bar"
, label [normal[showp true, position "top"]]
, yAxisIndex 1
, data' [201, 222, 223, 777, 244, 255, 555, 879, 938, 1364, 1806, 2324]
, data' [22, 22, 23, 77, 24, 55, 139, 350, 150, 164, 106, 224]
]
p'' :: ReactElement
p'' = p [] []
This diff is collapsed.
This diff is collapsed.
......@@ -26,6 +26,9 @@ import Thermite (PerformAction, Render, Spec, modifyState, simpleSpec)
import Unsafe.Coerce (unsafeCoerce)
-- TODO: ask for login (modal) or account creation after 15 mn when user is not logged and has made one search at least
newtype State = State
{ username :: String
, password :: String
......@@ -49,7 +52,11 @@ data Action
| SetPassword String
performAction :: forall eff props. PerformAction (console :: CONSOLE, ajax :: AJAX,dom::DOM | eff) State props Action
performAction :: forall eff props. PerformAction ( console :: CONSOLE
, ajax :: AJAX
, dom :: DOM
| eff
) State props Action
performAction NoOp _ _ = void do
modifyState id
......@@ -150,16 +157,14 @@ getDeviseID :: forall eff. Eff (dom :: DOM | eff) (Maybe String)
getDeviseID = do
w <- window
ls <- localStorage w
i <- getItem "token" ls
pure $ i
getItem "token" ls
setToken :: forall e . String -> Eff (dom :: DOM | e) Unit
setToken s = do
w <- window
ls <- localStorage w
liftEff $ setItem "token" s ls
pure unit
setItem "token" s ls
......
This diff is collapsed.
......@@ -53,7 +53,17 @@ routing =
home = Home <$ lit ""
route str = lit "" *> lit str
routeHandler :: forall e. (Maybe Routes -> Routes -> Eff ( dom :: DOM, console :: CONSOLE | e) Unit) -> Maybe Routes -> Routes -> Eff (dom :: DOM, console :: CONSOLE | e) Unit
routeHandler :: forall e. ( Maybe Routes -> Routes -> Eff
( dom :: DOM
, console :: CONSOLE
| e
) Unit
) -> Maybe Routes -> Routes -> Eff
( dom :: DOM
, console :: CONSOLE
| e
) Unit
routeHandler dispatchAction old new = do
liftEff $ log $ "change route : " <> show new
w <- window
......
......@@ -6,11 +6,12 @@ import Control.Monad.Cont.Trans (lift)
import DOM (DOM)
import Network.HTTP.Affjax (AJAX)
import Prelude hiding (div)
import React.DOM (br', button, div, h3, input, text)
import React.DOM.Props (_id, _type, className, name, onClick, onInput, placeholder, value)
import React.DOM (br', button, div, h3, input, text, i, span, img)
import React.DOM.Props (_id, _type, className, name, onClick, onInput, placeholder, value, aria, src, title)
import Routing.Hash.Aff (setHash)
import Thermite (PerformAction, Render, Spec, modifyState, simpleSpec)
import Unsafe.Coerce (unsafeCoerce)
import Landing as L
type State =
{
......@@ -47,43 +48,41 @@ performAction GO _ _ = void do
unsafeEventValue :: forall event. event -> String
unsafeEventValue e = (unsafeCoerce e).target.value
-- TODO: case loggedIn of True -> Just Tree ; False -> Nothing
-- TODO: put the search form in the center of the page
searchSpec :: forall props eff . Spec (console::CONSOLE, ajax::AJAX, dom::DOM | eff) State props Action
searchSpec :: forall props eff . Spec ( console :: CONSOLE
, ajax :: AJAX
, dom :: DOM
| eff
) State props Action
searchSpec = simpleSpec performAction render
where
render :: Render State props Action
render dispatch _ state _ =
[
div [className "container"]
[
div [className "jumbotron"]
[
div [className "row"]
[
div [className "col-md-10"]
[ div [className "container"] [L.jumboTitle false]
, div [className "container"]
[ div [className "jumbotron" ]
[ div [className "row" ]
[ div [className "col-md-10" ]
[ br' []
, br' []
, div [className "form-group"]
[
input [className "form-control",
_id "id_password",
name "query",
placeholder "Enter Query",
_type "text",
value state.query,
onInput \e -> dispatch (SetQuery (unsafeEventValue e))
, div [ className "form-group"]
[ input [ className "form-control"
, _id "id_password"
, name "query"
, placeholder "Query, URL or FILE (works best with Firefox or Chromium browsers)"
, _type "text"
, value state.query
, onInput \e -> dispatch (SetQuery (unsafeEventValue e))
] []
, br'[]
]
]
, div [className "col-md-2"]
, div [ className "col-md-2"]
[ br' []
, br' []
-- TODO put Gargantext logo as search button
, button [onClick \_ -> dispatch GO] [text "GO"]
]
, br' []
]
]
]
......
This diff is collapsed.
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