aboutsummaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/src/Client.elm3
-rw-r--r--client/src/Messages.elm5
2 files changed, 6 insertions, 2 deletions
diff --git a/client/src/Client.elm b/client/src/Client.elm
index aa6194e..e3ecbf6 100644
--- a/client/src/Client.elm
+++ b/client/src/Client.elm
@@ -53,7 +53,8 @@ viewOpponent : Messages.Opponent -> Html msg
viewOpponent opponent = Html.div [] <|
[ Html.text opponent.name
] ++
- if opponent.ready then [Html.text " ✅"] else []
+ (if opponent.admin then [Html.text " 👑"] else []) ++
+ (if opponent.ready then [Html.text " ✅"] else [])
view : Model -> List (Html Msg)
view model = case model of
diff --git a/client/src/Messages.elm b/client/src/Messages.elm
index 40a04a2..3324886 100644
--- a/client/src/Messages.elm
+++ b/client/src/Messages.elm
@@ -58,19 +58,22 @@ jsonEncCards val =
type alias Opponent =
{ name: String
+ , admin: Bool
, ready: Bool
}
jsonDecOpponent : Json.Decode.Decoder ( Opponent )
jsonDecOpponent =
- Json.Decode.succeed (\pname pready -> {name = pname, ready = pready})
+ Json.Decode.succeed (\pname padmin pready -> {name = pname, admin = padmin, ready = pready})
|> required "name" (Json.Decode.string)
+ |> required "admin" (Json.Decode.bool)
|> required "ready" (Json.Decode.bool)
jsonEncOpponent : Opponent -> Value
jsonEncOpponent val =
Json.Encode.object
[ ("name", Json.Encode.string val.name)
+ , ("admin", Json.Encode.bool val.admin)
, ("ready", Json.Encode.bool val.ready)
]