aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Update/Update.elm13
-rw-r--r--src/View/Timer.elm8
2 files changed, 16 insertions, 5 deletions
diff --git a/src/Update/Update.elm b/src/Update/Update.elm
index 76f3f1d..48d3008 100644
--- a/src/Update/Update.elm
+++ b/src/Update/Update.elm
@@ -12,6 +12,7 @@ import Maybe
import Keyboard (KeyCode)
import Char
import Debug
+import List
import Model.Model (..)
import Model.Timer (..)
@@ -89,10 +90,14 @@ update action model =
ValidTimerEdition ->
case model.timerEdition of
Just timerEdition ->
- { model
- | timers <- updateTimerTime timerEdition model.timers
- , timerEdition <- Nothing
- }
+ if List.isEmpty timerEdition.numbers
+ then
+ { model | timerEdition <- Nothing }
+ else
+ { model
+ | timers <- updateTimerTime timerEdition model.timers
+ , timerEdition <- Nothing
+ }
Nothing ->
{ model | timerEdition <- Nothing }
ReadOnly ->
diff --git a/src/View/Timer.elm b/src/View/Timer.elm
index 4523334..ca5edc6 100644
--- a/src/View/Timer.elm
+++ b/src/View/Timer.elm
@@ -9,6 +9,7 @@ import String
import Time (Time)
import Signal
import Maybe
+import List
import Model.Model (..)
import Model.Timer (..)
@@ -56,7 +57,12 @@ timeBlock model (id, timer) =
[ class "time block edition"
, onClick (stopIfRinging (id, timer) (Signal.send updates ValidTimerEdition))
]
- [ text (editionView edition.numbers) ]
+ [ if List.isEmpty edition.numbers
+ then
+ text (timeView timer.currentTime)
+ else
+ text (editionView edition.numbers)
+ ]
Nothing ->
button
[ class "time block"