Skip to content

Commit

Permalink
Remove unneeded type variant
Browse files Browse the repository at this point in the history
  • Loading branch information
Qluxzz committed Mar 19, 2024
1 parent 703a874 commit 4668de0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
19 changes: 9 additions & 10 deletions src/Game.elm
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ type LetterState
= CorrectPlace
| IncorrectPlace
| NotIncluded
| NotTried


type alias Letter =
Expand Down Expand Up @@ -296,9 +295,15 @@ keyboardView triedLetters canSubmit canClear =
|> List.map
(\char ->
div
[ HA.style "background" (backgroundColor (Maybe.withDefault NotTried (Dict.get char triedLetters)))
, HE.onClick (CharEntered char)
]
(HE.onClick (CharEntered char)
:: (case Dict.get char triedLetters of
Just c ->
[ HA.style "background" (backgroundColor c) ]

Nothing ->
[]
)
)
[ text (char |> Char.toUpper |> String.fromChar) ]
)

Expand Down Expand Up @@ -418,9 +423,6 @@ backgroundColor state =
CorrectPlace ->
"rgb(0, 190, 0)"

NotTried ->
"rgb(225, 225, 225)"

IncorrectPlace ->
"#ffb01e"

Expand Down Expand Up @@ -512,9 +514,6 @@ letterStateOrder x =
NotIncluded ->
2

NotTried ->
3


sortByLetterState : LetterState -> LetterState -> Order
sortByLetterState a b =
Expand Down
4 changes: 0 additions & 4 deletions src/Main.elm
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,6 @@ update msg model =

Game.NotIncluded ->
""

-- TODO: A letter used in an attempt can never have this state
Game.NotTried ->
"🟥"
)
attempt
)
Expand Down

0 comments on commit 4668de0

Please sign in to comment.