From 29eac851219e36bccf2724b05d52b70438b5bf3f Mon Sep 17 00:00:00 2001 From: Joris Guyonvarch Date: Sat, 21 Mar 2015 12:40:48 +0100 Subject: Removing restart button --- src/Update/UpdateTimer.elm | 8 +------- src/View/Timer.elm | 29 ++++++++--------------------- 2 files changed, 9 insertions(+), 28 deletions(-) (limited to 'src') 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 = -- cgit v1.2.3