Data.purs 3.55 KB
Newer Older
1
module Gargantext.Components.App.Data (App, Boxes, emptyApp) where
James Laver's avatar
James Laver committed
2

3

4 5
import Gargantext.Prelude

James Laver's avatar
James Laver committed
6
import Data.Maybe (Maybe(..))
7
import Data.Set as Set
8
import Gargantext.AsyncTasks as GAT
9 10 11
import Gargantext.Components.GraphExplorer.Sidebar.Types as GEST
import Gargantext.Components.Nodes.Lists.Types as ListsT
import Gargantext.Components.Nodes.Texts.Types as TextsT
12
import Gargantext.Components.Themes as Themes
James Laver's avatar
James Laver committed
13
import Gargantext.Ends (Backend)
14
import Gargantext.Routes (AppRoute(Home), Tile)
15
import Gargantext.Sessions (Session, Sessions)
16
import Gargantext.Sessions as Sessions
17
import Gargantext.Sessions.Types (OpenNodes(..))
18
import Gargantext.Types (FrontendError, Handed(RightHanded), SidePanelState(..))
James Laver's avatar
James Laver committed
19
import Gargantext.Utils.Toestand as T2
20
import Toestand as T
James Laver's avatar
James Laver committed
21 22

type App =
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
  { backend             :: Maybe Backend
  , errors              :: Array FrontendError
  , forestOpen          :: OpenNodes
  , graphVersion        :: T2.Reload
  , handed              :: Handed
  , reloadForest        :: T2.Reload
  , reloadMainPage      :: T2.Reload
  , reloadRoot          :: T2.Reload
  , route               :: AppRoute
  , session             :: Maybe Session
  , sessions            :: Sessions
  , showCorpus          :: Boolean
  , showLogin           :: Boolean
  , showTree            :: Boolean
  , sidePanelGraph      :: Maybe (Record GEST.SidePanel)
  , sidePanelLists      :: Maybe (Record ListsT.SidePanel)
  , sidePanelTexts      :: Maybe (Record TextsT.SidePanel)
  , sidePanelState      :: SidePanelState
  , tasks               :: GAT.Storage
42
  , theme               :: Themes.Theme
43 44
  , tileAxisXList       :: Array (Record Tile)
  , tileAxisYList       :: Array (Record Tile)
James Laver's avatar
James Laver committed
45 46 47 48
  }

emptyApp :: App
emptyApp =
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
  { backend             : Nothing
  , errors              : []
  , forestOpen          : OpenNodes $ Set.empty
  , graphVersion        : T2.newReload
  , handed              : RightHanded
  , reloadForest        : T2.newReload
  , reloadMainPage      : T2.newReload
  , reloadRoot          : T2.newReload
  , route               : Home
  , session             : Nothing
  , sessions            : Sessions.empty
  , showCorpus          : false
  , showLogin           : false
  , showTree            : true
  , sidePanelGraph      : GEST.initialSidePanel
  , sidePanelLists      : ListsT.initialSidePanel
  , sidePanelTexts      : TextsT.initialSidePanel
  , sidePanelState      : InitialClosed
  , tasks               : GAT.empty
68
  , theme               : Themes.defaultTheme
69 70
  , tileAxisXList       : mempty
  , tileAxisYList       : mempty
James Laver's avatar
James Laver committed
71 72
  }

73
type Boxes =
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
  { backend             :: T.Box (Maybe Backend)
  , errors              :: T.Box (Array FrontendError)
  , forestOpen          :: T.Box OpenNodes
  , graphVersion        :: T2.ReloadS
  , handed              :: T.Box Handed
  , reloadForest        :: T2.ReloadS
  , reloadMainPage      :: T2.ReloadS
  , reloadRoot          :: T2.ReloadS
  , route               :: T.Box AppRoute
  , session             :: T.Box (Maybe Session)
  , sessions            :: T.Box Sessions
  , showCorpus          :: T.Box Boolean
  , showLogin           :: T.Box Boolean
  , showTree            :: T.Box Boolean
  , sidePanelGraph      :: T.Box (Maybe (Record GEST.SidePanel))
  , sidePanelLists      :: T.Box (Maybe (Record ListsT.SidePanel))
  , sidePanelTexts      :: T.Box (Maybe (Record TextsT.SidePanel))
  , sidePanelState      :: T.Box SidePanelState
  , tasks               :: T.Box GAT.Storage
93
  , theme               :: T.Box Themes.Theme
94 95
  , tileAxisXList       :: T.Box (Array (Record Tile))
  , tileAxisYList       :: T.Box (Array (Record Tile))
James Laver's avatar
James Laver committed
96
  }