diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Data.elm | 2 | ||||
-rw-r--r-- | src/Main.elm | 23 | ||||
-rw-r--r-- | src/Styles.elm | 9 | ||||
-rw-r--r-- | src/Views.elm | 13 |
4 files changed, 35 insertions, 12 deletions
diff --git a/src/Data.elm b/src/Data.elm index 95c92c1..244f149 100644 --- a/src/Data.elm +++ b/src/Data.elm | |||
@@ -23,7 +23,7 @@ punctuations = | |||
23 | 23 | ||
24 | falseWeightedBool : Random.Generator Bool | 24 | falseWeightedBool : Random.Generator Bool |
25 | falseWeightedBool = | 25 | falseWeightedBool = |
26 | Random.weighted ( 20, True ) [ ( 80, False ) ] | 26 | Random.weighted ( 5, True ) [ ( 95, False ) ] |
27 | 27 | ||
28 | 28 | ||
29 | randomWord : Config -> Random.Generator ( Int, Bool, Bool ) | 29 | randomWord : Config -> Random.Generator ( Int, Bool, Bool ) |
diff --git a/src/Main.elm b/src/Main.elm index 620ef7c..4ca4934 100644 --- a/src/Main.elm +++ b/src/Main.elm | |||
@@ -4,7 +4,7 @@ import Array exposing (..) | |||
4 | import Base exposing (..) | 4 | import Base exposing (..) |
5 | import Browser | 5 | import Browser |
6 | import Css | 6 | import Css |
7 | import Css.Global exposing (global, selector) | 7 | import Css.Global exposing (everything, global, selector) |
8 | import Data exposing (..) | 8 | import Data exposing (..) |
9 | import Html | 9 | import Html |
10 | import Html.Styled exposing (..) | 10 | import Html.Styled exposing (..) |
@@ -217,15 +217,20 @@ currentContents model = | |||
217 | 217 | ||
218 | view : Model -> Html Msg | 218 | view : Model -> Html Msg |
219 | view model = | 219 | view model = |
220 | pre [] | 220 | div [] |
221 | [ p [] [ text ("POS: " ++ viewProgress model) ] | 221 | [ div [] |
222 | , p [] [ text ("WPM: " ++ viewWpm model) ] | 222 | [ viewWordLengthOptions |
223 | , p [] [ text ("ACC: " ++ viewAccuracy model.words) ] | 223 | , viewStats model |
224 | , viewWordLengthOptions | 224 | ] |
225 | , toPara model.words model.currentWord (currentContents model) | 225 | , div [] |
226 | , styledInput [ onInput handleInputChanged, value model.inputBox ] [] | 226 | [ toPara model.words model.currentWord (currentContents model) |
227 | , styledButton [ onClick Redo ] [ text "redo" ] | 227 | , div [] |
228 | [ styledInput [ onInput handleInputChanged, value model.inputBox ] [] | ||
229 | , styledButton [ onClick Redo ] [ text "redo" ] | ||
230 | ] | ||
231 | ] | ||
228 | , global [ selector "li:not(:last-child)::after" [ Css.property "content" "' / '" ] ] | 232 | , global [ selector "li:not(:last-child)::after" [ Css.property "content" "' / '" ] ] |
233 | , global [ everything [ Css.fontFamily Css.monospace ] ] | ||
229 | ] | 234 | ] |
230 | 235 | ||
231 | 236 | ||
diff --git a/src/Styles.elm b/src/Styles.elm index 57c124b..36bd1a3 100644 --- a/src/Styles.elm +++ b/src/Styles.elm | |||
@@ -65,3 +65,12 @@ styledTextBox = | |||
65 | , width (px 500) | 65 | , width (px 500) |
66 | , display inlineBlock | 66 | , display inlineBlock |
67 | ] | 67 | ] |
68 | |||
69 | |||
70 | actionContainer : List (Attribute msg) -> List (Html msg) -> Html msg | ||
71 | actionContainer = | ||
72 | styled | ||
73 | div | ||
74 | [ padding (px 12) | ||
75 | , width (pct 100) | ||
76 | ] | ||
diff --git a/src/Views.elm b/src/Views.elm index 5e2dbcb..b56a945 100644 --- a/src/Views.elm +++ b/src/Views.elm | |||
@@ -1,4 +1,4 @@ | |||
1 | module Views exposing (viewAccuracy, viewProgress, viewWordLengthOptions, viewWpm) | 1 | module Views exposing (..) |
2 | 2 | ||
3 | import Array exposing (..) | 3 | import Array exposing (..) |
4 | import Base exposing (..) | 4 | import Base exposing (..) |
@@ -56,7 +56,7 @@ viewProgress model = | |||
56 | total = | 56 | total = |
57 | model.config.length | 57 | model.config.length |
58 | in | 58 | in |
59 | String.fromInt soFar ++ "/" ++ String.fromInt total | 59 | String.fromInt soFar ++ ":" ++ String.fromInt total |
60 | 60 | ||
61 | 61 | ||
62 | viewAccuracy : Array Word -> String | 62 | viewAccuracy : Array Word -> String |
@@ -98,3 +98,12 @@ viewWordLengthOptions = | |||
98 | ) | 98 | ) |
99 | wl | 99 | wl |
100 | ) | 100 | ) |
101 | |||
102 | |||
103 | viewStats : Model -> Html Msg | ||
104 | viewStats model = | ||
105 | styledUnorderedList [] | ||
106 | [ styledListItem [] [ text ("WPM " ++ viewWpm model) ] | ||
107 | , styledListItem [] [ text ("ACC " ++ viewAccuracy model.words) ] | ||
108 | , styledListItem [] [ text ("POS " ++ viewProgress model) ] | ||
109 | ] | ||