blob: 5b3ad8d9093e4c9621155d5feead818cf0542a04 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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)
|