Write a basic view function. Without styling, it's impossible to see.
This commit is contained in:
8
Go.elm
8
Go.elm
@@ -2,6 +2,7 @@ import Go.Types exposing (..)
|
||||
import Go.Game exposing (verify)
|
||||
import Go.Decoders exposing (decodeUpdatestring)
|
||||
import Go.Ws exposing (..)
|
||||
import Go.View exposing (..)
|
||||
import WebSocket
|
||||
import Html exposing (Html, div, text)
|
||||
|
||||
@@ -26,11 +27,14 @@ initDummy = (Model
|
||||
[], Cmd.none)
|
||||
|
||||
view : Model -> Html Msg
|
||||
view m = div [] [ text (toString m.currentColor) ]
|
||||
view m = div []
|
||||
[ text (toString m.currentColor)
|
||||
, renderBoard m.sessionSize m.board
|
||||
]
|
||||
|
||||
update : Msg -> Model -> (Model, Cmd Msg)
|
||||
update msg model = case msg of
|
||||
Place c -> case verify c model of
|
||||
Place indx -> case verify (indx, model.sessionColor) model of
|
||||
Nothing -> ( { model | error = Just "Can't place piece" }, Cmd.none)
|
||||
Just c -> ( { model | board = c::model.board }, sendMove model c)
|
||||
Update s -> case decodeUpdatestring s of
|
||||
|
||||
Reference in New Issue
Block a user