aboutsummaryrefslogtreecommitdiff
path: root/src/Views.elm
diff options
context:
space:
mode:
Diffstat (limited to 'src/Views.elm')
-rw-r--r--src/Views.elm35
1 files changed, 32 insertions, 3 deletions
diff --git a/src/Views.elm b/src/Views.elm
index c5cc159..5e2dbcb 100644
--- a/src/Views.elm
+++ b/src/Views.elm
@@ -1,7 +1,12 @@
1module Views exposing (viewAccuracy, viewProgress, viewWpm) 1module Views exposing (viewAccuracy, viewProgress, viewWordLengthOptions, viewWpm)
2 2
3import Array exposing (..) 3import Array exposing (..)
4import Base exposing (..) 4import Base exposing (..)
5import Css exposing (..)
6import Html
7import Html.Styled exposing (..)
8import Html.Styled.Events exposing (onClick)
9import Styles exposing (styledListItem, styledUnorderedList)
5import Time exposing (Posix, toHour, toMinute, toSecond, utc) 10import Time exposing (Posix, toHour, toMinute, toSecond, utc)
6import Utils exposing (diffDuration, wordCountWith) 11import Utils exposing (diffDuration, wordCountWith)
7 12
@@ -42,8 +47,15 @@ viewWpm model =
42 Maybe.withDefault "XX" wpm 47 Maybe.withDefault "XX" wpm
43 48
44 49
45viewProgress : Int -> Int -> String 50viewProgress : Model -> String
46viewProgress soFar total = 51viewProgress model =
52 let
53 soFar =
54 model.currentWord + 1
55
56 total =
57 model.config.length
58 in
47 String.fromInt soFar ++ "/" ++ String.fromInt total 59 String.fromInt soFar ++ "/" ++ String.fromInt total
48 60
49 61
@@ -69,3 +81,20 @@ viewAccuracy words =
69 81
70 Just a -> 82 Just a ->
71 String.fromInt <| truncate a 83 String.fromInt <| truncate a
84
85
86viewWordLengthOptions : Html Msg
87viewWordLengthOptions =
88 let
89 wl =
90 [ 10, 25, 50, 100 ]
91 in
92 styledUnorderedList []
93 (List.map
94 (\len ->
95 styledListItem
96 [ onClick (Base.WordLengthChanged len) ]
97 [ text <| String.fromInt len ]
98 )
99 wl
100 )