Commit 0ce54177 authored by Mael NICOLAS's avatar Mael NICOLAS

Added the route, Dashboard link send now to "#/dashboard", need to do the page :^)

parent b3bf8672
...@@ -42,7 +42,7 @@ myCorpus :: Int -> String -> NTree (Tuple String String) ...@@ -42,7 +42,7 @@ myCorpus :: Int -> String -> NTree (Tuple String String)
myCorpus n name = NNode n false name myCorpus n name = NNode n false name
[ NLeaf (Tuple "Facets" "#/docView") [ NLeaf (Tuple "Facets" "#/docView")
, NLeaf (Tuple "Graph" "#/docView") , NLeaf (Tuple "Graph" "#/docView")
, NLeaf (Tuple "Dashboard" "#/userPage") , NLeaf (Tuple "Dashboard" "#/dashboard")
] ]
exampleTree :: NTree (Tuple String String) exampleTree :: NTree (Tuple String String)
......
...@@ -81,6 +81,7 @@ data Action ...@@ -81,6 +81,7 @@ data Action
| AnnotationDocumentViewA D.Action | AnnotationDocumentViewA D.Action
| TreeViewA NT.Action | TreeViewA NT.Action
| TabViewA TV.Action | TabViewA TV.Action
| DashboardA Dsh.Action
| Search String | Search String
| Go | Go
| CorpusAnalysisA CA.Action | CorpusAnalysisA CA.Action
...@@ -91,16 +92,11 @@ performAction :: forall eff props. PerformAction ( dom :: DOM ...@@ -91,16 +92,11 @@ performAction :: forall eff props. PerformAction ( dom :: DOM
) AppState props Action ) AppState props Action
performAction (SetRoute route) _ _ = void do performAction (SetRoute route) _ _ = void do
modifyState $ _ {currentRoute = pure route} modifyState $ _ {currentRoute = pure route}
performAction (Search s) _ _ = void do performAction (Search s) _ _ = void do
modifyState $ _ {search = s} modifyState $ _ {search = s}
performAction Go _ _ = void do performAction Go _ _ = void do
_ <- lift $ setHash "/addCorpus" _ <- lift $ setHash "/addCorpus"
modifyState id modifyState id
performAction _ _ _ = void do performAction _ _ _ = void do
modifyState id modifyState id
...@@ -172,6 +168,11 @@ _userPageAction = prism UserPageA \action -> ...@@ -172,6 +168,11 @@ _userPageAction = prism UserPageA \action ->
UserPageA caction -> Right caction UserPageA caction -> Right caction
_-> Left action _-> Left action
_dashBoardAction :: Prism' Action Dsh.Action
_dashBoardAction = prism DashboardA \action ->
case action of
DashboardA caction -> Right caction
_ -> Left action
_annotationdocumentviewState :: Lens' AppState D.State _annotationdocumentviewState :: Lens' AppState D.State
_annotationdocumentviewState = lens (\s -> s.annotationdocumentView) (\s ss -> s{annotationdocumentView = ss}) _annotationdocumentviewState = lens (\s -> s.annotationdocumentView) (\s ss -> s{annotationdocumentView = ss})
...@@ -205,18 +206,18 @@ _tabviewAction = prism TabViewA \action -> ...@@ -205,18 +206,18 @@ _tabviewAction = prism TabViewA \action ->
TabViewA caction -> Right caction TabViewA caction -> Right caction
_-> Left action _-> Left action
_corpusState :: Lens' AppState CA.State _corpusState :: Lens' AppState CA.State
_corpusState = lens (\s -> s.corpusAnalysis) (\s ss -> s {corpusAnalysis = ss}) _corpusState = lens (\s -> s.corpusAnalysis) (\s ss -> s {corpusAnalysis = ss})
_corpusAction :: Prism' Action CA.Action _corpusAction :: Prism' Action CA.Action
_corpusAction = prism CorpusAnalysisA \action -> _corpusAction = prism CorpusAnalysisA \action ->
case action of case action of
CorpusAnalysisA caction -> Right caction CorpusAnalysisA caction -> Right caction
_-> Left action _-> Left action
_dashBoardSate :: Lens' AppState Dsh.State
_dashBoardSate = lens (\s -> s.dashboard) (\s ss -> s {dashboard = ss})
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
...@@ -240,8 +241,7 @@ pagesComponent s = ...@@ -240,8 +241,7 @@ pagesComponent s =
selectSpec Tabview = layout0 $ focus _tabviewState _tabviewAction TV.tab1 selectSpec Tabview = layout0 $ focus _tabviewState _tabviewAction TV.tab1
-- To be removed -- To be removed
selectSpec SearchView = layout0 $ focus _searchState _searchAction S.searchSpec selectSpec SearchView = layout0 $ focus _searchState _searchAction S.searchSpec
selectSpec Dashboard = layout0 $ focus _dashBoardSate _dashBoardAction Dsh.layoutDashboard
routingSpec :: forall props eff. Spec (dom :: DOM |eff) AppState props Action routingSpec :: forall props eff. Spec (dom :: DOM |eff) AppState props Action
routingSpec = simpleSpec performAction defaultRender routingSpec = simpleSpec performAction defaultRender
...@@ -516,45 +516,38 @@ dispatchAction dispatcher _ Home = do ...@@ -516,45 +516,38 @@ dispatchAction dispatcher _ Home = do
_ <- dispatcher $ SetRoute $ Home _ <- dispatcher $ SetRoute $ Home
_ <- dispatcher $ LandingA $ L.NoOp _ <- dispatcher $ LandingA $ L.NoOp
pure unit pure unit
dispatchAction dispatcher _ Login = do 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 dispatchAction dispatcher _ AddCorpus = do
_ <- dispatcher $ SetRoute $ AddCorpus _ <- dispatcher $ SetRoute $ AddCorpus
_ <- dispatcher $ AddCorpusA $ AC.LoadDatabaseDetails _ <- dispatcher $ AddCorpusA $ AC.LoadDatabaseDetails
pure unit pure unit
dispatchAction dispatcher _ DocView = do dispatchAction dispatcher _ DocView = do
_ <- dispatcher $ SetRoute $ DocView _ <- dispatcher $ SetRoute $ DocView
_ <- dispatcher $ DocViewA $ DV.LoadData _ <- dispatcher $ DocViewA $ DV.LoadData
pure unit pure unit
dispatchAction dispatcher _ SearchView = do dispatchAction dispatcher _ SearchView = do
_ <- dispatcher $ SetRoute $ SearchView _ <- dispatcher $ SetRoute $ SearchView
_ <- dispatcher $ SearchA $ S.NoOp _ <- dispatcher $ SearchA $ S.NoOp
pure unit pure unit
dispatchAction dispatcher _ UserPage = do dispatchAction dispatcher _ UserPage = do
_ <- dispatcher $ SetRoute $ UserPage _ <- dispatcher $ SetRoute $ UserPage
_ <- dispatcher $ UserPageA $ UP.NoOp _ <- dispatcher $ UserPageA $ UP.NoOp
pure unit pure unit
dispatchAction dispatcher _ (AnnotationDocumentView i) = do dispatchAction dispatcher _ (AnnotationDocumentView i) = do
_ <- dispatcher $ SetRoute $ AnnotationDocumentView i _ <- dispatcher $ SetRoute $ AnnotationDocumentView i
_ <- dispatcher $ AnnotationDocumentViewA $ D.NoOp _ <- dispatcher $ AnnotationDocumentViewA $ D.NoOp
pure unit pure unit
dispatchAction dispatcher _ Tabview = do dispatchAction dispatcher _ Tabview = do
_ <- dispatcher $ SetRoute $ Tabview _ <- dispatcher $ SetRoute $ Tabview
_ <- dispatcher $ TabViewA $ TV.NoOp _ <- dispatcher $ TabViewA $ TV.NoOp
pure unit pure unit
dispatchAction dispatcher _ CorpusAnalysis = do dispatchAction dispatcher _ CorpusAnalysis = do
_ <- dispatcher $ SetRoute $ CorpusAnalysis _ <- dispatcher $ SetRoute $ CorpusAnalysis
--_ <- dispatcher $ CorpusAnalysisA $ CA.NoOp --_ <- dispatcher $ CorpusAnalysisA $ CA.NoOp
pure unit pure unit
dispatchAction dispatcher _ Dashboard = do
_ <- dispatcher $ SetRoute $ Dashboard
pure unit
...@@ -25,6 +25,7 @@ data Routes ...@@ -25,6 +25,7 @@ data Routes
| AnnotationDocumentView Int | AnnotationDocumentView Int
| Tabview | Tabview
| CorpusAnalysis | CorpusAnalysis
| Dashboard
instance showRoutes :: Show Routes where instance showRoutes :: Show Routes where
...@@ -36,7 +37,8 @@ instance showRoutes :: Show Routes where ...@@ -36,7 +37,8 @@ instance showRoutes :: Show Routes where
show UserPage = "UserPage" show UserPage = "UserPage"
show (AnnotationDocumentView i) = "DocumentView" show (AnnotationDocumentView i) = "DocumentView"
show Tabview = "Tabview" show Tabview = "Tabview"
show CorpusAnalysis = "corpus" show CorpusAnalysis = "Corpus"
show Dashboard = "Dashboard"
int :: Match Int int :: Match Int
int = floor <$> num int = floor <$> num
...@@ -53,6 +55,7 @@ routing = ...@@ -53,6 +55,7 @@ routing =
<|> addcorpusRoute <|> addcorpusRoute
<|> corpusAnalysis <|> corpusAnalysis
<|> home <|> home
<|> dashboard
where where
tabview = Tabview <$ route "tabview" tabview = Tabview <$ route "tabview"
documentView = AnnotationDocumentView <$> (route "documentView" *> int) documentView = AnnotationDocumentView <$> (route "documentView" *> int)
...@@ -63,6 +66,7 @@ routing = ...@@ -63,6 +66,7 @@ routing =
loginRoute = Login <$ route "login" loginRoute = Login <$ route "login"
corpusAnalysis = CorpusAnalysis <$ route "corpus" corpusAnalysis = CorpusAnalysis <$ route "corpus"
home = Home <$ lit "" home = Home <$ lit ""
dashboard = Dashboard <$ route "dashboard"
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