Repository navigation
London | 26-ITP-Sep | Shirin Panahian | Sprint 3 | Build an alarm clock app - #1578
shirinpanahian wants to merge 8 commits into
Conversation
| if (timeInSecond <= 0) { | ||
| clearInterval(timer); | ||
| playAlarm(); | ||
| document.body.style.background = "lightRed"; |
There was a problem hiding this comment.
When the timer expires, what does the browser do with lightRed as a CSS color value?
To "like" or "dislike" this comment, please follow this link
There was a problem hiding this comment.
Thanks! I’ve changed lightRed to the valid CSS colour "red"
|
The CYF AI review has left comments. It will only review a PR one time. When you have addressed these comments, please request review again and a volunteer will take a look. |
iscmiguelsamaniego
left a comment
There was a problem hiding this comment.
Thank you so much for bringing all of this together! Your countdown logic, helper breakdown, and clean markup show real care and momentum.
Just one gentle thought to explore: how do the pieces connect end-to-end when a user sets, triggers, and resets an alarm? You're doing awesome—keep it up!
There was a problem hiding this comment.
Thank you so much for sharing this! Extracting formatTime and clearing previous intervals is super clean and thoughtful.
Just a gentle question: how might stopAlarm vs. pauseAlarm affect what happens when the user stops the alarm, and what happens with alarmTime.innerText right after the if/else block? You're doing great—keep it up!
There was a problem hiding this comment.
Thank you for pointing that out! 😊
stopAlarm() does more than pauseAlarm(). While pauseAlarm() only pauses the audio, stopAlarm() also clears the countdown interval, resets the audio to the beginning, changes the background color, and resets the displayed time to 00:00.
Regarding alarmTime.innerText, I realized that placing it after the if/else block means it runs regardless of which condition is true. Therefore, I removed the else section and the duplicate innerText statement. Now the time is updated only once per second, and when it reaches zero, it displays 00:00 instead of a negative value.
Thank you for helping me improve my code!
There was a problem hiding this comment.
Thank you so much for sharing the HTML! Having a descriptive title like "Alarm clock app" and keeping the IDs and buttons clean is really nice.
Just a gentle question: how might adding a <div> wrapper around the buttons affect layout or styling rules if any expect direct children? You're doing great—keep it up!
There was a problem hiding this comment.
Thank you for the feedback! 😊 I think adding a div around the buttons could make it easier to style them together and control their spacing. But I should also check my CSS because some selectors might expect the buttons to be direct children of the centre div. If I add a wrapper, those styles might not work the same way. Thanks for pointing that out!
|
Great work on this. The core countdown, input validation, and page title updates all meet the task requirements. |
|
Thank you for the feedback Stephanieewelu! I've implemented the suggested improvements in |
|
@Stephanieewelu @iscmiguelsamaniego - who is owning this code review? I can see both of you have added your feedback - we tend to say one person should stick to a review so it's more straightforward for the trainee and the reviewer. When you first start reviewing a PR, you can indicate you are taking this PR for review by adding the "Review in Progress" label. Please see our labelling flow for code review - in this PR no labels were added during or after review. Please make sure you add these so that our Portal platform and trainees can see when a review has been done / a PR is complete Can you decide between you who's owning this, add relevant label, and ask me any questions you might have :D |
|
Thank you. I would leave it for the first reviewer to continue. |
|
@iscmiguelsamaniego Could you please take a look at my PR when you get a chance? Thanks! |
There was a problem hiding this comment.
Test case: Set the timer to 1 second and wait for the countdown to complete. The background correctly changes to red when the alarm is triggered, which is great!
However, when you click the Set Alarm button again to start a new countdown, the background should reset to its original white colour. Currently, it remains red.
Could you please check this behaviour and ensure the background resets when a new alarm is started?
There was a problem hiding this comment.
Thank you for the feedback @ravinder25886 . I add code for reset the background to white and pause the alarm in Set Alarm
Learners, PR Template
Self checklist
Task code
CYF-1098
Changelist