diff options
-rw-r--r-- | design/design.css | 2 | ||||
-rw-r--r-- | src/Update/UpdateTimer.elm | 8 | ||||
-rw-r--r-- | src/View/Timer.elm | 29 |
3 files changed, 10 insertions, 29 deletions
diff --git a/design/design.css b/design/design.css index 159353c..187b9a6 100644 --- a/design/design.css +++ b/design/design.css @@ -87,7 +87,7 @@ color: #AA2222; } -.timers button.singleRemove { +.timers > .timer:only-of-type > button.remove { color: grey; } diff --git a/src/Update/UpdateTimer.elm b/src/Update/UpdateTimer.elm index 7033f81..e45a3c2 100644 --- a/src/Update/UpdateTimer.elm +++ b/src/Update/UpdateTimer.elm @@ -10,8 +10,7 @@ import Model.TimerState (..) import Model.Id (..) type TimerAction = - Restart - | Pause + Pause | ToggleRunning | Stop | SetTime Time @@ -19,11 +18,6 @@ type TimerAction = updateTimer : TimerAction -> Timer -> Timer updateTimer action timer = case action of - Restart -> - { timer - | currentTime <- initTime timer.initialTime - , state <- Running - } Pause -> { timer | state <- Idle } ToggleRunning -> diff --git a/src/View/Timer.elm b/src/View/Timer.elm index 9c302a4..4523334 100644 --- a/src/View/Timer.elm +++ b/src/View/Timer.elm @@ -34,10 +34,9 @@ timerView model (id, timer) = ] [ nameBlock (id, timer) , timeBlock model (id, timer) - , restartBlock (id, timer) , playPauseBlock (id, timer) , stopBlock (id, timer) - , removeBlock model (id, timer) + , removeBlock (id, timer) ] nameBlock : (Id, Timer) -> Html @@ -77,14 +76,6 @@ timeView time = restSeconds = totalSeconds `rem` 60 in (String.padLeft 2 '0' (toString totalMinutes)) ++ " : " ++ (String.padLeft 2 '0' (toString restSeconds)) -restartBlock : (Id, Timer) -> Html -restartBlock (id, timer) = - button - [ class <| "restart block" - , onClick (stopIfRinging (id, timer) (Signal.send updates (UpdateTimer id Restart))) - ] - [ i [ class "fa fa-fw fa-backward" ] [] ] - playPauseBlock : (Id, Timer) -> Html playPauseBlock (id, timer) = button @@ -105,17 +96,13 @@ stopBlock (id, timer) = ] [ i [ class "fa fa-fw fa-stop" ] [] ] -removeBlock : Model -> (Id, Timer) -> Html -removeBlock model (id, timer) = - let removeClass = - if numberOfTimers model > 1 - then "remove" - else "singleRemove" - in button - [ class <| "block " ++ removeClass - , onClick (Signal.send updates (RemoveTimer id)) - ] - [ i [ class "fa fa-fw fa-remove" ] [] ] +removeBlock : (Id, Timer) -> Html +removeBlock (id, timer) = + button + [ class <| "remove block" + , onClick (Signal.send updates (RemoveTimer id)) + ] + [ i [ class "fa fa-fw fa-remove" ] [] ] stopIfRinging : (Id, Timer) -> Signal.Message -> Signal.Message stopIfRinging (id, timer) message = |