Layout.purs 1.93 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
import Gargantext.Pages.Corpus.Document       as Document
import Gargantext.Pages.Corpus.Graph          as GE
11
-- import Gargantext.Pages.Corpus.Tabs.Terms.NgramsTable as NG
12

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

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

dispatchAction dispatcher _ Home = do
Nicolas Pouillard's avatar
Nicolas Pouillard committed
22 23
  dispatcher $ SetRoute Home
  -- dispatcher $ LandingA TODO
24 25

dispatchAction dispatcher _ Login = do
Nicolas Pouillard's avatar
Nicolas Pouillard committed
26 27
  dispatcher $ SetRoute Login
  -- dispatcher $ LoginA TODO
28 29

dispatchAction dispatcher _ AddCorpus = do
Nicolas Pouillard's avatar
Nicolas Pouillard committed
30 31
  dispatcher $ SetRoute   AddCorpus
  dispatcher $ AddCorpusA AC.LoadDatabaseDetails
32

33
dispatchAction dispatcher _ (Corpus n) = do
34
  dispatcher $ SetRoute $ Corpus n
35

36
dispatchAction dispatcher _ SearchView = do
Nicolas Pouillard's avatar
Nicolas Pouillard committed
37 38
  dispatcher $ SetRoute SearchView
  -- dispatcher $ SearchA TODO
39 40

dispatchAction dispatcher _ (UserPage id) = do
Nicolas Pouillard's avatar
Nicolas Pouillard committed
41
  dispatcher $ SetRoute $ UserPage id
42

43 44 45
dispatchAction dispatcher _ (ContactPage id) = do
  dispatcher $ SetRoute $ ContactPage id

46
dispatchAction dispatcher _ (Annuaire id) = do
47
  dispatcher $ SetRoute $ Annuaire id
48 49 50 51

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

52 53 54
dispatchAction dispatcher _ (Document n) = do
  dispatcher $ SetRoute $ Document n
  dispatcher $ DocumentViewA $ Document.Load n
55

56 57 58
dispatchAction dispatcher _ (PGraphExplorer nid) = do
  dispatcher $ SetRoute $ PGraphExplorer nid
  dispatcher $ GraphExplorerA $ GE.LoadGraph nid
59
  --dispatcher $ GraphExplorerA $ GE.LoadGraph "imtNew.json"
60 61

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