Disable reveal button once votes are revealed

This commit is contained in:
Correl Roush 2020-05-14 22:31:41 -04:00
parent 086ebb3da5
commit f0d4d307bd

View file

@ -203,7 +203,7 @@ view model =
{ title = model.room.name { title = model.room.name
, body = , body =
[ navBar { title = model.room.name, playerName = playerName } [ navBar { title = model.room.name, playerName = playerName }
, viewRoom model.player model.room model.showVotes , viewRoom model
] ]
} }
@ -217,11 +217,11 @@ view model =
} }
viewRoom : String -> Room -> Bool -> Element Msg viewRoom : Model -> Element Msg
viewRoom player room showVotes = viewRoom model =
let let
myVote = myVote =
Dict.get player room.players Dict.get model.player model.room.players
|> Maybe.andThen .vote |> Maybe.andThen .vote
in in
column [ width fill, spacing 20 ] column [ width fill, spacing 20 ]
@ -230,9 +230,9 @@ viewRoom player room showVotes =
[ el [ width (fillPortion 3), alignTop ] <| [ el [ width (fillPortion 3), alignTop ] <|
viewCards myVote viewCards myVote
, el [ width (fillPortion 1), alignTop ] <| , el [ width (fillPortion 1), alignTop ] <|
viewPlayers (Dict.values room.players) showVotes viewPlayers (Dict.values model.room.players) model.showVotes
] ]
, moderatorTools , moderatorTools model
] ]
@ -320,12 +320,12 @@ viewPlayers playerList showVotes =
} }
moderatorTools : Element Msg moderatorTools : Model -> Element Msg
moderatorTools = moderatorTools model =
row [ centerX, spacing 20 ] row [ centerX, spacing 20 ]
[ UI.actionButton [ UI.actionButton
[ centerX ] [ centerX ]
{ isActive = True { isActive = not model.showVotes
, onPress = Reveal , onPress = Reveal
, label = text "Reveal" , label = text "Reveal"
} }