Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

timer enhancements #187

Merged
merged 1 commit into from
Apr 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/elm/State.elm
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ update msg model =
NavigateToStimInfo ->
{ model | stimInfoDestination = model.view }
! []
:> update (NavigateTo StimInfo)
:> update (ifThenElse (model.view == StimTimer) (ChangeViewFromTimer StimInfo) (NavigateTo StimInfo))

ChangeSkinColour ->
{ model | skinColour = toggleSkinColour model } ! [ changeSkinColour ( (toggleSkinColour model |> skinColourToHexValue), ".is-selected" ) ]
Expand Down
32 changes: 28 additions & 4 deletions src/elm/Views/StimTimer.elm
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ stimTimer model =
[ span [] [ text <| (formatTimeFirstDigits (floor <| model.counter / 60)) ++ ":" ]
, span [] [ text <| formatTimeSecondDigits (rem (round model.counter) 60) ]
]
, div [ class "mh7 flex justify-between mb5" ]
[ img [ onClick <| AdjustTimer Restart, src "./assets/StimTimer/timer_replay_btn.svg" ] []
, img [ onClick <| AdjustTimer Start, src "./assets/StimTimer/timer_play_btn.svg" ] []
, img [ onClick <| AdjustTimer Pause, src "./assets/StimTimer/timer_pause_btn.svg" ] []
, div [ class "mh7 flex justify-around mb5" ]
[ div [ class "h4 flex flex-column justify-between" ]
[ img [ onClick <| AdjustTimer Restart, src "./assets/StimTimer/timer_replay_btn.svg" ] []
, p [] [ text "Restart" ]
]
, displayPlayOrPause model.timerStatus
]
, img [ class "mb4", src "./assets/StimTimer/white_divider_zigzag_thin.svg" ] []
, div []
Expand All @@ -56,3 +58,25 @@ formatTimeFirstDigits time =
formatTimeSecondDigits : Int -> String
formatTimeSecondDigits time =
ifThenElse ((String.length <| toString time) == 1) (toString time ++ "0") (toString time)


displayPlayOrPause : TimerStatus -> Html Msg
displayPlayOrPause timerstatus =
case timerstatus of
Started ->
div [ class "h4 flex flex-column justify-between" ]
[ img [ onClick <| AdjustTimer Pause, src "./assets/StimTimer/timer_pause_btn.svg" ] []
, p [] [ text "Pause" ]
]

Stopped ->
div [ class "h4 flex flex-column justify-between" ]
[ img [ onClick <| AdjustTimer Start, src "./assets/StimTimer/timer_play_btn.svg" ] []
, p [] [ text "Start" ]
]

Paused ->
div [ class "h4 flex flex-column justify-between" ]
[ img [ onClick <| AdjustTimer Start, src "./assets/StimTimer/timer_play_btn.svg" ] []
, p [] [ text "Start" ]
]