Main.purs 628 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
import Prelude (Unit, ($))
12
import Reactix as R
Abinaya Sudhir's avatar
Abinaya Sudhir committed
13

14

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

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

paint :: Maybe Element -> Effect Unit
arturo's avatar
arturo committed
22
paint Nothing  = here.error "[main] Container not found"
23 24
paint (Just c) = do
  R.render app c
arturo's avatar
arturo committed
25
  where
26
    app = App.app {}