Skip to content

London | 26-ITP-Sep | Shirin Panahian | Sprint 3 | Build an alarm clock app - #1578

Open
shirinpanahian wants to merge 6 commits into
CodeYourFuture:mainfrom
shirinpanahian:feat/alarm-clock
Open

shirinpanahian wants to merge 6 commits into
CodeYourFuture:mainfrom
shirinpanahian:feat/alarm-clock

Conversation

@shirinpanahian

Copy link
Copy Markdown

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Task code

CYF-1098

Changelist

  • Implemented an alarm clock with a countdown timer.
  • Added input validation for the alarm duration.
  • Added time formatting in minutes and seconds.
  • Added Play and Stop functionality for the alarm.
  • Added visual feedback when the countdown reaches zero.

@shirinpanahian shirinpanahian added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Nov 23, 2026
Comment thread Sprint-3/alarmclock/alarmclock.js Outdated
if (timeInSecond <= 0) {
clearInterval(timer);
playAlarm();
document.body.style.background = "lightRed";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I’ve changed lightRed to the valid CSS colour "red"

@cyf-ai-code-reviewer cyf-ai-code-reviewer Bot added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Nov 23, 2026
@cyf-ai-code-reviewer

Copy link
Copy Markdown

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.

@shirinpanahian shirinpanahian added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Nov 23, 2026

@iscmiguelsamaniego iscmiguelsamaniego left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

@Stephanieewelu

Stephanieewelu commented Nov 27, 2026 •

Copy link
Copy Markdown

Great work on this. The core countdown, input validation, and page title updates all meet the task requirements.
Existing intervals are properly cleared before starting a new alarm, and the display reliably reaches 00:00 before audio playback begins.
Your updated stop handler also correctly clears the active timer and pauses the alarm sound.
As an optional improvement, you might consider having stopAlarm() restore the original background styling and reset the display text so the UI doesn't remain stuck in the expired red state.
Everything works as expected, so this is ready to merge whether or not you decide to include that extra polish.

@shirinpanahian

Copy link
Copy Markdown
Author

Thank you for the feedback Stephanieewelu! I've implemented the suggested improvements in stopAlarm() to restore the original background styling and reset the display text when the alarm is stopped.

@Poonam-raj

Copy link
Copy Markdown

@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

@Stephanieewelu

Copy link
Copy Markdown

Thank you. I would leave it for the first reviewer to continue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants