Main.purs 633 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 as App
10
import Gargantext.Utils.Reactix as R2
11 12
import Prelude (Unit, ($), bind)
import Reactix as R
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
paint Nothing  = here.error "[main] Container not found"
22 23
paint (Just c) = do
  R.render app c
arturo's avatar
arturo committed
24
  where
25
    app = App.app {}