aboutsummaryrefslogtreecommitdiff
path: root/src/View.elm
diff options
context:
space:
mode:
Diffstat (limited to 'src/View.elm')
-rw-r--r--src/View.elm56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/View.elm b/src/View.elm
new file mode 100644
index 0000000..5b3ad8d
--- /dev/null
+++ b/src/View.elm
@@ -0,0 +1,56 @@
+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)