summaryrefslogtreecommitdiff
path: root/src/Main/Throwshade.purs
blob: 9f5a084de94d4ef8adc3d9abe4dd87a6783e32e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
module Main.Throwshade where

import Prelude

import Config as Config
import Effect (Effect)
import Effect.Aff (launchAff_)
import Effect.Class (liftEffect)
import Effect.Console (log)
import Fetch (fetch)
import UI (setShader, submitShader)
import Utils (byId, getTextArea, listen, setText)

main :: Effect Unit
main = launchAff_ do
  liftEffect $ log "hello it is throwshade"
  input <- byId "lcolonq-throwshade-textarea"
  test <- byId "lcolonq-throwshade-button-test"
  { text: shader } <- fetch (Config.apiServer <> "/shader") {}
  cur <- byId "lcolonq-throwshade-current"
  setText cur =<< shader
  listen test "click" \_ -> do
    s <- getTextArea input
    setShader s
  submit <- byId "lcolonq-throwshade-button-submit"
  listen submit "click" \_ -> do
    s <- getTextArea input
    submitShader s