Layout.purs 2.55 KB
Newer Older
1
module Gargantext.Pages.Layout where
2 3 4

import Prelude hiding (div)
import Gargantext.Components.Login as LN
5
import Gargantext.Pages.Layout.Actions (Action(..))
6
import Gargantext.Pages.Layout.Specs.AddCorpus as AC
7
import Gargantext.Pages.Corpus.Doc.Facets as TV
8 9 10 11
import Gargantext.Pages.Corpus.Doc.Annotation as D

import Gargantext.Pages.Corpus.Doc.Facets.Documents         as DV
import Gargantext.Pages.Corpus.Doc.Facets.Graph             as GE
12
import Gargantext.Pages.Corpus.Doc.Facets.Terms.NgramsTable as NG
13

14 15
import Gargantext.Pages.Corpus.User.Users as U
import Gargantext.Pages.Home as L
16
import Gargantext.Pages.Layout.Specs.Search as S
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
import Gargantext.Router (Routes(..))

dispatchAction :: forall t115 t445 t447.
                  Bind t445 => Applicative t445  =>
                  (Action -> t445 t447) -> t115 -> Routes -> t445 Unit

dispatchAction dispatcher _ Home = do
  _ <- dispatcher Initialize
  _ <- dispatcher $ SetRoute Home
  _ <- dispatcher $ LandingA L.NoOp
  pure unit

dispatchAction dispatcher _ Login = do
  _ <- dispatcher Initialize
  _ <- dispatcher $ SetRoute Login
  _ <- dispatcher $ LoginA LN.NoOp
  pure unit

dispatchAction dispatcher _ AddCorpus = do
  _ <- dispatcher $ SetRoute AddCorpus
  _ <- dispatcher $ AddCorpusA AC.LoadDatabaseDetails
  pure unit

dispatchAction dispatcher _ DocView = do
  _ <- dispatcher $ SetRoute $ DocView
  _ <- dispatcher $ DocViewA $ DV.LoadData
  pure unit

dispatchAction dispatcher _ SearchView = do
  _ <- dispatcher $ SetRoute $ SearchView
  _ <- dispatcher $ SearchA  $ S.NoOp
  pure unit

dispatchAction dispatcher _ (UserPage id) = do
  _ <- dispatcher $ SetRoute  $ UserPage id
  _ <- dispatcher $ UserPageA $ U.NoOp
  _ <- dispatcher $ UserPageA $ U.FetchUser id
  pure unit

dispatchAction dispatcher _ (DocAnnotation i) = do
  _ <- dispatcher $ SetRoute  $ DocAnnotation i
  _ <- dispatcher $ DocAnnotationViewA $ D.NoOp
  pure unit

dispatchAction dispatcher _ Tabview = do
  _ <- dispatcher $ SetRoute  $ Tabview
  _ <- dispatcher $ TabViewA $ TV.NoOp
  pure unit

dispatchAction dispatcher _ CorpusAnalysis = do
  _ <- dispatcher $ SetRoute  $ CorpusAnalysis
  --_ <- dispatcher $ CorpusAnalysisA $ CA.NoOp
  pure unit

dispatchAction dispatcher _ PGraphExplorer = do
  _ <- dispatcher $ SetRoute  $ PGraphExplorer
  _ <- dispatcher $ GraphExplorerA $ GE.LoadGraph "imtNew.json"
  pure unit

dispatchAction dispatcher _ NGramsTable = do
  _ <- dispatcher $ SetRoute  $ NGramsTable
  _ <- dispatcher $ NgramsA $ NG.NoOp
  pure unit

dispatchAction dispatcher _ Dashboard = do
  _ <- dispatcher $ SetRoute $ Dashboard
  pure unit