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

3 4
import Gargantext.Prelude

James Laver's avatar
James Laver committed
5
import Data.Maybe (Maybe(..))
6
import Data.Set as Set
James Laver's avatar
James Laver committed
7 8
import Toestand as T

9
import Gargantext.AsyncTasks as GAT
10 11 12
import Gargantext.Components.GraphExplorer.Sidebar.Types as GEST
import Gargantext.Components.Nodes.Lists.Types as ListsT
import Gargantext.Components.Nodes.Texts.Types as TextsT
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 20 21
import Gargantext.Utils.Toestand as T2

type App =
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
  { 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
  , tileAxisXList       :: Array (Record Tile)
  , tileAxisYList       :: Array (Record Tile)
James Laver's avatar
James Laver committed
43 44 45 46
  }

emptyApp :: App
emptyApp =
47 48 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
  , tileAxisXList       : mempty
  , tileAxisYList       : mempty
James Laver's avatar
James Laver committed
68 69
  }

70
type Boxes =
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
  { 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
  , tileAxisXList       :: T.Box (Array (Record Tile))
  , tileAxisYList       :: T.Box (Array (Record Tile))
James Laver's avatar
James Laver committed
92
  }