aboutsummaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorJasper Van der Jeugt2020-08-02 21:52:46 +0200
committerJasper Van der Jeugt2020-08-02 21:52:46 +0200
commit477dae400d5f32a0572698ba132a26bc4a340975 (patch)
treeb74ebd8d52c4be5523ff478240cc6731ecf1b61f /client
parentfce7342703e8d6353f65cf28914948366f54ef81 (diff)
Admin but it's broken
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)
]