Main.purs 742 Bytes
Newer Older
1
module Main (main) where
Abinaya Sudhir's avatar
Abinaya Sudhir committed
2

3
import DOM.Simple (Element)
Alexandre Delanoë's avatar
Alexandre Delanoë committed
4 5 6
import DOM.Simple.Document (document)
import Data.Maybe (Maybe(..))
import Data.Nullable (toMaybe)
Sudhir Kumar's avatar
Sudhir Kumar committed
7
import Effect (Effect)
James Laver's avatar
James Laver committed
8
import FFI.Simple ((...))
9
import Gargantext.Components.App (app)
arturo's avatar
arturo committed
10
import Gargantext.Components.App.Store as AppStore
11
import Gargantext.Utils.Reactix as R2
Alexandre Delanoë's avatar
Alexandre Delanoë committed
12
import Prelude (Unit, ($))
Abinaya Sudhir's avatar
Abinaya Sudhir committed
13

arturo's avatar
arturo committed
14 15 16
here :: R2.Here
here = R2.here "Gargantext.Main"

17
main :: Effect Unit
18 19 20
main = paint $ toMaybe (document ... "getElementById" $ [ "app" ])

paint :: Maybe Element -> Effect Unit
arturo's avatar
arturo committed
21 22 23 24 25 26 27 28 29 30
paint Nothing  = here.error "[main] Container not found"
paint (Just c) = R2.render app' c
  where
    state = AppStore.options
    app' =
      AppStore.provide
      state
      [
        app {} []
      ]