Commit 3b021b7f authored by Abinaya Sudhir's avatar Abinaya Sudhir

Changed document view to annotation document view

parent e0df79f2
module DocumentView where module AnnotationDocumentView where
import Prelude hiding (div) import Prelude hiding (div)
import React (ReactElement) import React (ReactElement)
......
...@@ -23,7 +23,7 @@ import React.DOM.Props as RP ...@@ -23,7 +23,7 @@ import React.DOM.Props as RP
import SearchForm as S import SearchForm as S
import Thermite (PerformAction, Render, Spec, _render, defaultRender, focus, modifyState, simpleSpec, withState) import Thermite (PerformAction, Render, Spec, _render, defaultRender, focus, modifyState, simpleSpec, withState)
import UserPage as UP import UserPage as UP
import DocumentView as D import AnnotationDocumentView as D
type E e = (dom :: DOM, ajax :: AJAX, console :: CONSOLE | e) type E e = (dom :: DOM, ajax :: AJAX, console :: CONSOLE | e)
...@@ -35,7 +35,7 @@ type AppState = ...@@ -35,7 +35,7 @@ type AppState =
, docViewState :: DV.State , docViewState :: DV.State
, searchState :: S.State , searchState :: S.State
, userPage :: UP.State , userPage :: UP.State
, documentView :: D.State , annotationdocumentView :: D.State
} }
initAppState :: AppState initAppState :: AppState
...@@ -47,7 +47,7 @@ initAppState = ...@@ -47,7 +47,7 @@ initAppState =
, docViewState : DV.tdata , docViewState : DV.tdata
, searchState : S.initialState , searchState : S.initialState
, userPage : UP.initialState , userPage : UP.initialState
, documentView : D.initialState , annotationdocumentView : D.initialState
} }
data Action data Action
...@@ -59,7 +59,7 @@ data Action ...@@ -59,7 +59,7 @@ data Action
| DocViewA DV.Action | DocViewA DV.Action
| SearchA S.Action | SearchA S.Action
| UserPageA UP.Action | UserPageA UP.Action
| DocumentViewA D.Action | AnnotationDocumentViewA D.Action
performAction :: forall eff props. PerformAction ( dom :: DOM performAction :: forall eff props. PerformAction ( dom :: DOM
...@@ -139,14 +139,14 @@ _userPageAction = prism UserPageA \action -> ...@@ -139,14 +139,14 @@ _userPageAction = prism UserPageA \action ->
_-> Left action _-> Left action
_documentviewState :: Lens' AppState D.State _annotationdocumentviewState :: Lens' AppState D.State
_documentviewState = lens (\s -> s.documentView) (\s ss -> s{documentView = ss}) _annotationdocumentviewState = lens (\s -> s.annotationdocumentView) (\s ss -> s{annotationdocumentView = ss})
_documentviewAction :: Prism' Action D.Action _annotationdocumentviewAction :: Prism' Action D.Action
_documentviewAction = prism DocumentViewA \action -> _annotationdocumentviewAction = prism AnnotationDocumentViewA \action ->
case action of case action of
DocumentViewA caction -> Right caction AnnotationDocumentViewA caction -> Right caction
_-> Left action _-> Left action
...@@ -169,7 +169,7 @@ pagesComponent s = ...@@ -169,7 +169,7 @@ pagesComponent s =
selectSpec AddCorpus = layout0 $ focus _addCorpusState _addCorpusAction AC.layoutAddcorpus selectSpec AddCorpus = layout0 $ focus _addCorpusState _addCorpusAction AC.layoutAddcorpus
selectSpec DocView = layout0 $ focus _docViewState _docViewAction DV.layoutDocview selectSpec DocView = layout0 $ focus _docViewState _docViewAction DV.layoutDocview
selectSpec UserPage = layout0 $ focus _userPageState _userPageAction UP.layoutUser selectSpec UserPage = layout0 $ focus _userPageState _userPageAction UP.layoutUser
selectSpec (DocumentView i) = layout0 $ focus _documentviewState _documentviewAction D.docview selectSpec (AnnotationDocumentView i) = layout0 $ focus _annotationdocumentviewState _annotationdocumentviewAction D.docview
-- To be removed -- To be removed
selectSpec SearchView = layout0 $ focus _searchState _searchAction S.searchSpec selectSpec SearchView = layout0 $ focus _searchState _searchAction S.searchSpec
...@@ -437,7 +437,7 @@ dispatchAction dispatcher _ UserPage = do ...@@ -437,7 +437,7 @@ dispatchAction dispatcher _ UserPage = do
_ <- dispatcher $ UserPageA $ UP.NoOp _ <- dispatcher $ UserPageA $ UP.NoOp
pure unit pure unit
dispatchAction dispatcher _ (DocumentView i) = do dispatchAction dispatcher _ (AnnotationDocumentView i) = do
_ <- dispatcher $ SetRoute $ DocumentView i _ <- dispatcher $ SetRoute $ AnnotationDocumentView i
_ <- dispatcher $ UserPageA $ UP.NoOp _ <- dispatcher $ AnnotationDocumentViewA $ D.NoOp
pure unit pure unit
...@@ -22,7 +22,7 @@ data Routes ...@@ -22,7 +22,7 @@ data Routes
| DocView | DocView
| SearchView | SearchView
| UserPage | UserPage
| DocumentView Int | AnnotationDocumentView Int
instance showRoutes :: Show Routes where instance showRoutes :: Show Routes where
...@@ -32,7 +32,7 @@ instance showRoutes :: Show Routes where ...@@ -32,7 +32,7 @@ instance showRoutes :: Show Routes where
show DocView = "DocView" show DocView = "DocView"
show SearchView = "SearchView" show SearchView = "SearchView"
show UserPage = "UserPage" show UserPage = "UserPage"
show (DocumentView i) = "DocumentView" show (AnnotationDocumentView i) = "DocumentView"
int :: Match Int int :: Match Int
int = floor <$> num int = floor <$> num
...@@ -48,7 +48,7 @@ routing = ...@@ -48,7 +48,7 @@ routing =
<|> addcorpusRoute <|> addcorpusRoute
<|> home <|> home
where where
documentView = DocumentView <$> (route "documentView" *> int) documentView = AnnotationDocumentView <$> (route "documentView" *> int)
userPageRoute = UserPage <$ route "userPage" userPageRoute = UserPage <$ route "userPage"
searchRoute = SearchView <$ route "search" searchRoute = SearchView <$ route "search"
docviewRoute = DocView <$ route "docView" docviewRoute = DocView <$ route "docView"
......
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