Skip to content

Cape Town | 26-ITP-Sept | Leigh Ross | Sprint 3 | Build an alarm clock app - #1511

Open
leigh-ross wants to merge 6 commits into
CodeYourFuture:mainfrom
leigh-ross:coursework/alarm-clock-app
Open

leigh-ross wants to merge 6 commits into
CodeYourFuture:mainfrom
leigh-ross:coursework/alarm-clock-app

Conversation

@leigh-ross

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

  • Setup: Changed the page title to "Alarm clock app" and added initial styling for the layout and buttons.
  • Time Formatting: Implemented a function to convert raw seconds into a standard MM:SS format (e.g., 01:10).
  • Countdown Logic: Built the setAlarm function to start the countdown timer, update the screen every second, and trigger the audio alarm when it reaches 00:00.
  • Visual Flair: Added custom background images (hamsters) that change when the alarm is set, goes off, and stops.
  • Flashing Effect: Added an interval to toggle a red background class on the clock box when the alarm rings (limited to 20 flashes so it doesn't loop forever). The alarm sound continues playing until stopped.

@leigh-ross leigh-ross added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Nov 11, 2026
@LonMcGregor LonMcGregor added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Nov 16, 2026
let currentSeconds;

function setAlarm() {
clearInterval(countdownTimer);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

If Set Alarm is clicked while the previous alarm is still flashing, what happens to the existing flashTimer?

To "like" or "dislike" this comment, please follow this link

document.body.style.backgroundImage = "url('alarmsethamster.jfif')";
document.body.style.backgroundPosition = "center";
clearInterval(countdownTimer);
clearInterval(flashTimer);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

After Stop clears flashTimer, what removes red-bg from .centre?

To "like" or "dislike" this comment, please follow this link

@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 16, 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.

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

Labels

Reviewed Volunteer to add when completing a review with trainee action still to take.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants