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