Refactor to make how we're finding the given doodad more clear

This commit is contained in:
Tessa Kelly 2022-03-30 11:17:38 -07:00
parent c41eab81e8
commit 455ffb3796

View File

@ -180,12 +180,14 @@ view model =
view_ : Model -> Html Msg
view_ model =
let
examples filterBy =
List.filter (\m -> filterBy m) (Dict.values model.moduleStates)
findExampleByName name =
Dict.values model.moduleStates
|> List.filter (\m -> m.name == name)
|> List.head
in
case model.route of
Routes.Doodad doodad ->
case List.head (examples (\m -> m.name == doodad)) of
case findExampleByName doodad of
Just example ->
viewExample model example
|> Html.map (UpdateModuleStates example.name)