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

import Prelude hiding (div)
Nicolas Pouillard's avatar
Nicolas Pouillard committed
4
-- import Gargantext.Components.Login as LN
5
import Gargantext.Pages.Layout.Actions (Action(..))
6
import Gargantext.Pages.Layout.Specs.AddCorpus as AC
Nicolas Pouillard's avatar
Nicolas Pouillard committed
7 8
-- import Gargantext.Pages.Corpus.Doc.Facets as TV
-- import Gargantext.Pages.Corpus.Doc.Annotation as D
9

10
import Gargantext.Pages.Corpus as Corpus
11 12
import Gargantext.Pages.Corpus.Doc.Facets.Documents         as DV
import Gargantext.Pages.Corpus.Doc.Facets.Graph             as GE
Nicolas Pouillard's avatar
Nicolas Pouillard committed
13
-- import Gargantext.Pages.Corpus.Doc.Facets.Terms.NgramsTable as NG
14

15
import Gargantext.Pages.Annuaire.User.Contacts as C
16
import Gargantext.Pages.Annuaire   as Annuaire
Nicolas Pouillard's avatar
Nicolas Pouillard committed
17 18
-- import Gargantext.Pages.Home as L
-- import Gargantext.Pages.Layout.Specs.Search as S
19 20
import Gargantext.Router (Routes(..))

Nicolas Pouillard's avatar
Nicolas Pouillard committed
21 22 23
dispatchAction :: forall ignored m.
                  Monad m =>
                  (Action -> m Unit) -> ignored -> Routes -> m Unit
24 25

dispatchAction dispatcher _ Home = do
Nicolas Pouillard's avatar
Nicolas Pouillard committed
26 27 28
  dispatcher Initialize
  dispatcher $ SetRoute Home
  -- dispatcher $ LandingA TODO
29 30

dispatchAction dispatcher _ Login = do
Nicolas Pouillard's avatar
Nicolas Pouillard committed
31 32 33
  dispatcher Initialize
  dispatcher $ SetRoute Login
  -- dispatcher $ LoginA TODO
34 35

dispatchAction dispatcher _ AddCorpus = do
Nicolas Pouillard's avatar
Nicolas Pouillard committed
36 37
  dispatcher $ SetRoute   AddCorpus
  dispatcher $ AddCorpusA AC.LoadDatabaseDetails
38

39 40 41
dispatchAction dispatcher _ (DocView n) = do
  dispatcher $ SetRoute   (DocView n)
  dispatcher $ DocViewA $ DV.LoadData n
42

43
dispatchAction dispatcher _ (Corpus n) = do
44 45
  dispatcher $ SetRoute     $ Corpus n
  dispatcher $ CorpusAction $ Corpus.Load n
46

47
dispatchAction dispatcher _ SearchView = do
Nicolas Pouillard's avatar
Nicolas Pouillard committed
48 49
  dispatcher $ SetRoute SearchView
  -- dispatcher $ SearchA TODO
50 51

dispatchAction dispatcher _ (UserPage id) = do
Nicolas Pouillard's avatar
Nicolas Pouillard committed
52 53
  dispatcher $ SetRoute $ UserPage id
  -- dispatcher $ UserPageA TODO
54
  dispatcher $ UserPageA $ C.FetchContact id
55

56
dispatchAction dispatcher _ (Annuaire id) = do
57 58
  dispatcher $ SetRoute       $ Annuaire id
  dispatcher $ AnnuaireAction $ Annuaire.Load id
59 60 61 62

dispatchAction dispatcher _ (Folder id) = do
  dispatcher $ SetRoute $ Folder id

63
dispatchAction dispatcher _ (DocAnnotation i) = do
Nicolas Pouillard's avatar
Nicolas Pouillard committed
64 65
  dispatcher $ SetRoute $ DocAnnotation i
  -- dispatcher $ DocAnnotationViewA TODO
66 67

dispatchAction dispatcher _ Tabview = do
Nicolas Pouillard's avatar
Nicolas Pouillard committed
68 69
  dispatcher $ SetRoute Tabview
  -- dispatcher $ TabViewA TODO
70 71

dispatchAction dispatcher _ PGraphExplorer = do
Nicolas Pouillard's avatar
Nicolas Pouillard committed
72 73
  dispatcher $ SetRoute PGraphExplorer
  dispatcher $ GraphExplorerA $ GE.LoadGraph "imtNew.json"
74 75

dispatchAction dispatcher _ NGramsTable = do
Nicolas Pouillard's avatar
Nicolas Pouillard committed
76 77
  dispatcher $ SetRoute NGramsTable
  -- dispatcher $ NgramsA TODO
78 79

dispatchAction dispatcher _ Dashboard = do
Nicolas Pouillard's avatar
Nicolas Pouillard committed
80
  dispatcher $ SetRoute Dashboard