Skip to content

ITP JAN 2025/ELFREDAH KEVIN-ALERECHI/DAT GROUP/ALARM CLOCK #494

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Elfredah
Copy link

@Elfredah Elfredah commented Apr 12, 2025

Done all requirmeents

<!

  • I have committed my files one by one, on purpose, and for a reason
  • I have titled my PR with COHORT_NAME | FIRST_NAME LAST_NAME | REPO_NAME | WEEK
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist

Briefly explain your PR.

Questions

Ask any questions you have for your reviewer.

@Elfredah Elfredah changed the title I redo and finished my sprint 3 assignments ITP JAN 2025/ELFREDAH KEVIN-ALERECHI/DAT GROUP/ALARM CLOCK Apr 12, 2025
@cjyuan cjyuan added the Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. label Apr 13, 2025
Copy link

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

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

The alarm sound cannot play but the code is working (to certain extent); the "Stop Button" is behaving mysteriously.

The branch should only only modified files that belong to the Alarm Clock project. Since you commit ALL changes in one commit instead of committing one file at a time, you can consider fixing the branch in the following way:

  • Replace all files (in the current branch) that do not belong to the Alarm Clock project by the same files in the main branch. You can download your main branch as a ZIP file from your Github repo.

Copy link

Choose a reason for hiding this comment

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

It is a better practice to separate JS code from HTML code. Can you transfer the JS code to alarmclock.js?

<input type="text" id="alarm-time" placeholder="Enter time in seconds">
<button onclick="setAlarm()">Set Alarm</button>
<button id="stop-alarm" onclick="stopAlarm()" style="display: none;">Stop Alarm</button>
<audio id="alarm-sound" src="https://www.soundjay.com/button/beep-07.wav" loop></audio>
Copy link

Choose a reason for hiding this comment

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

This audio cannot be loaded. Why not use the one in the project folder?

function formatTime(seconds) {
let minutes = Math.floor(seconds / 60);
let remainingSeconds = seconds % 60;
return `${minutes < 10 ? '0' + minutes : minutes}:${remainingSeconds < 10 ? '0' + remainingSeconds : remainingSeconds}`;
Copy link

Choose a reason for hiding this comment

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

Could consider using .padStart().


timeRemaining = alarmTime;
timeRemainingTitle.innerText = formatTime(timeRemaining);
stopButton.style.display = 'inline';
Copy link

Choose a reason for hiding this comment

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

You can also consider using visibility: visible and visibility: hidden to show/hide an element.
Using display : inline and display : none to show/hide an element can cause the elements in the UI rearranged.

Comment on lines +80 to +85
function stopAlarm() {
alarmSound.pause();
alarmSound.currentTime = 0;
document.body.style.backgroundColor = ''; // Reset background color
stopButton.style.display = 'none'; // Hide stop button
}
Copy link

Choose a reason for hiding this comment

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

If a user clicks the "Stop Button" while the clock is still counting down, the "Stop Button" will "disappear" (and reappear when the clock reaches 0). Is this a bug of feature?

@cjyuan cjyuan added 👀 Review Git Changes requested to do with Git Reviewed Volunteer to add when completing a review and removed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Apr 13, 2025
@cjyuan
Copy link

cjyuan commented Apr 13, 2025

On separate note, it is also a good practice to include a brief description of a PR in the PR template:
image

@Elfredah Elfredah added 🎯 Topic Code Review Reading, understanding, and analysing code Needs Review Participant to add when requesting review and removed Reviewed Volunteer to add when completing a review labels Apr 15, 2025
@cjyuan
Copy link

cjyuan commented Apr 16, 2025

I don't see anything changed since I last reviewed this PR. Have you pushed your changes to Github?

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review and removed Needs Review Participant to add when requesting review labels Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👀 Review Git Changes requested to do with Git Reviewed Volunteer to add when completing a review 🎯 Topic Code Review Reading, understanding, and analysing code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants