Layout.purs 2.17 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
7
-- import Gargantext.Pages.Corpus.Tabs as TV
8

9 10 11
import Gargantext.Pages.Corpus.Document       as Document
import Gargantext.Pages.Corpus.Graph          as GE
-- import Gargantext.Pages.Corpus.Tabs.Terms.NgramsTable as NG
12

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

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

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

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

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

37
dispatchAction dispatcher _ (Corpus n) = do
38
  dispatcher $ SetRoute $ Corpus n
39

40
dispatchAction dispatcher _ SearchView = do
Nicolas Pouillard's avatar
Nicolas Pouillard committed
41 42
  dispatcher $ SetRoute SearchView
  -- dispatcher $ SearchA TODO
43 44

dispatchAction dispatcher _ (UserPage id) = do
Nicolas Pouillard's avatar
Nicolas Pouillard committed
45 46
  dispatcher $ SetRoute $ UserPage id
  -- dispatcher $ UserPageA TODO
47
  dispatcher $ UserPageA $ C.FetchContact id
48

49
dispatchAction dispatcher _ (Annuaire id) = do
50 51
  dispatcher $ SetRoute       $ Annuaire id
  dispatcher $ AnnuaireAction $ Annuaire.Load id
52 53 54 55

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

56 57 58
dispatchAction dispatcher _ (Document n) = do
  dispatcher $ SetRoute $ Document n
  dispatcher $ DocumentViewA $ Document.Load n
59 60

dispatchAction dispatcher _ PGraphExplorer = do
Nicolas Pouillard's avatar
Nicolas Pouillard committed
61 62
  dispatcher $ SetRoute PGraphExplorer
  dispatcher $ GraphExplorerA $ GE.LoadGraph "imtNew.json"
63 64

dispatchAction dispatcher _ NGramsTable = do
Nicolas Pouillard's avatar
Nicolas Pouillard committed
65 66
  dispatcher $ SetRoute NGramsTable
  -- dispatcher $ NgramsA TODO
67 68

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