module View exposing ( view ) import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (..) import List import Dict import Json.Decode as Json import Msg exposing (Msg) import Model exposing (..) import Model.Id exposing (..) import Timer.Model exposing (..) import Timer.View as Timer import Update exposing (..) view : Model -> Html Msg view model = div [] [ title , model.timers |> Dict.toList |> List.sortBy (.creationTime << snd) |> timers model ] title : Html Msg title = div [ class "headerBar" ] [ button [ onClick Msg.Initialize , class "title" ] [ text "Timer" ] , button [ onClick Msg.AddNewTimer , class "addTimer" ] [ i [ class "fa fa-fw fa-plus" ] [] ] ] timers : Model -> List (Id, Timer) -> Html Msg timers model timers = div [ class "timers" ] (List.map (Timer.view model) timers)