Commit 43edcadb authored by Abinaya Sudhir's avatar Abinaya Sudhir

Addcorpusview page added to navigation

parent a12881eb
......@@ -19,7 +19,7 @@ import Data.MediaType.Common (applicationJSON)
import Network.HTTP.Affjax (AJAX, affjax, defaultRequest)
import Network.HTTP.RequestHeader (RequestHeader(..))
import Prelude hiding (div)
import React.DOM (a, button, div, form, h2, h4, i, input, label, p, span, text)
import React.DOM (a, button, div, form, h2, h3, h4, i, input, label, p, span, text)
import React.DOM.Props (_id, _type, className, href, maxLength, name, onClick, onInput, placeholder, target, value)
import Routing.Hash.Aff (setHash)
import Thermite (PerformAction, Render, Spec, modifyState, simpleSpec)
......@@ -63,4 +63,21 @@ addcorpusviewSpec = simpleSpec performAction render
where
render :: Render State props Action
render dispatch _ state _ =
[ ]
[
div [className "container"]
[
div [className "row"]
[
div [className "col align-self-start"]
[
h3 [] [text "Treeview"]
]
, div [className "col align-self-center"]
[
]
]
]
]
......@@ -14,6 +14,7 @@ import React.DOM (div)
import React.DOM.Props (_id, className)
import Landing as L
import Login as LN
import AddCorpusview as AC
type E e = (dom :: DOM, ajax :: AJAX, console :: CONSOLE | e)
......@@ -21,7 +22,7 @@ type AppState =
{ currentRoute :: Maybe Routes
, landingState :: L.State
, loginState :: LN.State
, addCorpusState :: AC.State
}
initAppState :: AppState
......@@ -29,7 +30,7 @@ initAppState =
{ currentRoute : Nothing
, landingState : L.initialState
, loginState : LN.initialState
, addCorpusState : AC.initialState
}
......@@ -38,7 +39,7 @@ data Action
| LandingA L.Action
| LoginA LN.Action
| SetRoute Routes
| AddCorpusA AC.Action
performAction :: forall eff props. PerformAction (dom :: DOM |eff) AppState props Action
......@@ -75,6 +76,18 @@ _loginAction = prism LoginA \action ->
_addCorpusState:: Lens' AppState AC.State
_addCorpusState = lens (\s -> s.addCorpusState) (\s ss -> s{addCorpusState = ss})
_addCorpusAction :: Prism' Action AC.Action
_addCorpusAction = prism AddCorpusA \action ->
case action of
AddCorpusA caction -> Right caction
_-> Left action
pagesComponent :: forall props eff. AppState -> Spec (E eff) AppState props Action
pagesComponent s =
case s.currentRoute of
......@@ -135,3 +148,8 @@ dispatchAction dispatcher _ Login = do
_ <- dispatcher $ SetRoute $ Login
_ <- dispatcher $ LoginA $ LN.NoOp
pure unit
dispatchAction dispatcher _ AddCorpus = do
_ <- dispatcher $ SetRoute $ AddCorpus
_ <- dispatcher $ AddCorpusA $ AC.NoOp
pure unit
......@@ -17,10 +17,12 @@ import Routing.Match.Class (lit, num)
data Routes
= Home
| Login
| AddCorpus
instance showRoutes :: Show Routes where
show Home = "Home"
show Login = "Login"
show AddCorpus = "AddCorpus"
int :: Match Int
int = floor <$> num
......@@ -28,8 +30,10 @@ int = floor <$> num
routing :: Match Routes
routing =
loginRoute
<|> addcorpusRoute
<|> home
where
addcorpusRoute = AddCorpus <$ route "AddCorpus"
loginRoute = Login <$ route "login"
home = Home <$ lit ""
route str = lit "" *> lit str
......
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