Skip to content

[feature/enhance-ui] UI improvements to home and alarm screen - #4

Merged
HoweiAY merged 10 commits into
mainfrom
feature/enhance-ui
Aug 12, 2026
Merged

HoweiAY merged 10 commits into
mainfrom
feature/enhance-ui

Conversation

@HoweiAY

@HoweiAY HoweiAY commented Aug 11, 2026 •

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Added a live clock to the alarm screen that updates every second.
    • Added task-specific icons and accessibility descriptions to alarm cards.
    • Added a snoozed-alarm badge on the home screen.
    • Added a confirmation flow to dismiss all snoozed alarms at once.
  • Bug Fixes

    • Improved error handling when dismissing snoozed alarms fails.
    • Fixed alarms scheduled for the current time being treated as immediately due.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7ee2cbcd-2dd2-4671-a12a-0fde84b0e3fd

📥 Commits

Reviewing files that changed from the base of the PR and between e49bb52 and 799c02d.

📒 Files selected for processing (2)
  • src/store/alarmRegistrationsStore.ts
  • test/unit/utils/time.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/store/alarmRegistrationsStore.ts

📝 Walkthrough

Walkthrough

The alarm store now tracks and dismisses snoozed alarms with generation checks. The home screen provides a confirmation flow. The alarm screen shows live time, and alarm cards show task-specific icons and accessibility text. Scheduling tests cover exact-time and boundary behavior.

Changes

Snoozed alarm flow and presentation

Layer / File(s) Summary
Registration generation persistence
drizzle/*, src/data/schema.ts, src/store/alarmRegistrationsStore.ts
The database schema adds registration generations. The registration store reads, increments, and persists generation values.
Snoozed registration state and dismissal
src/store/alarmStore.ts, src/utils/time.ts
The store synchronizes snooze registrations, cancels notifications, removes registrations with generation checks, and updates next-alarm timing.
Alarm display and validation
src/app/(main)/index.tsx, src/app/(alarm)/alarm.tsx, src/components/AlarmCard.tsx, test/unit/utils/time.test.ts
The home screen displays and dismisses snoozed alarms. The alarm screen refreshes time every second. AlarmCard displays task icons, days, and accessibility text. Unit tests cover scheduling boundaries.

Estimated code review effort: 3 (Moderate) | ~30 minutes

Sequence Diagram(s)

sequenceDiagram
  participant HomeScreen
  participant alarmStore
  participant alarmRegistrationStore
  participant alarmScheduler
  HomeScreen->>alarmStore: subscribe to snoozedCount
  HomeScreen->>alarmStore: confirm and dismissAllSnoozedAlarms
  alarmStore->>alarmScheduler: cancel snooze notifications
  alarmStore->>alarmRegistrationStore: remove snooze registrations
Loading

Possibly related PRs

Suggested reviewers: hyauyeung

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the home and alarm screen UI changes, which are the primary stated objective of the pull request.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/enhance-ui

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/AlarmCard.tsx`:
- Around line 46-53: Update the Pressable accessibilityLabel in AlarmCard to
include alarm.task alongside the existing time and days information, ensuring
assistive technology announces the task represented by the icon.

In `@src/store/alarmStore.ts`:
- Around line 153-165: Update the bulk-dismiss flow around snoozedIds and its
Promise.allSettled callbacks to capture each snooze registration’s generation
token, then cancel and remove only when that token still matches the current
registration for the alarm. Preserve the required AlarmSchedulerModule
identifier scheme and ensure a newer snooze is never cancelled or deregistered
by an older dismissal.
- Around line 168-178: Update the dismissal action containing the failed count
calculation so it propagates partial failures to its caller instead of resolving
normally. When failed is greater than zero, reject after retaining the existing
failure details; preserve the successful return value when all snoozed alarms
are dismissed.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f39ed250-0148-4772-92db-ab5add942767

📥 Commits

Reviewing files that changed from the base of the PR and between 799abab and 9a8fac6.

📒 Files selected for processing (4)
  • src/app/(alarm)/alarm.tsx
  • src/app/(main)/index.tsx
  • src/components/AlarmCard.tsx
  • src/store/alarmStore.ts

Comment thread src/components/AlarmCard.tsx
Comment thread src/store/alarmStore.ts Outdated
Comment thread src/store/alarmStore.ts Outdated

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/utils/time.ts (1)

63-65: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add boundary tests for computeNextAlarm in src/utils/time.ts. Cover candidates equal to now, one minute after now, and one minute before now. The equality and past cases must roll to the next week. Run npm run lint and npx tsc --noEmit.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/utils/time.ts` around lines 63 - 65, Add boundary tests for
computeNextAlarm covering candidates equal to now, one minute after now, and one
minute before now; assert equality and past candidates roll forward by one week
while the future candidate does not. Run npm run lint and npx tsc --noEmit to
verify the changes.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/store/alarmRegistrationsStore.ts`:
- Around line 96-118: Update the upsert flow to allocate generation atomically
in SQLite: replace the pre-write existing-record calculation with an insert
conflict update that increments the stored generation and returns the resulting
row/generation. Use the returned generation when updating Zustand records,
including calls concurrent with fetchRecords(), and preserve the existing
alarmId/type uniqueness target.

---

Nitpick comments:
In `@src/utils/time.ts`:
- Around line 63-65: Add boundary tests for computeNextAlarm covering candidates
equal to now, one minute after now, and one minute before now; assert equality
and past candidates roll forward by one week while the future candidate does
not. Run npm run lint and npx tsc --noEmit to verify the changes.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: dd3e5b22-b350-4fe9-9a62-a926aed8d969

📥 Commits

Reviewing files that changed from the base of the PR and between 9a8fac6 and e49bb52.

📒 Files selected for processing (9)
  • drizzle/0004_striped_exiles.sql
  • drizzle/meta/0004_snapshot.json
  • drizzle/meta/_journal.json
  • drizzle/migrations.js
  • src/components/AlarmCard.tsx
  • src/data/schema.ts
  • src/store/alarmRegistrationsStore.ts
  • src/store/alarmStore.ts
  • src/utils/time.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/store/alarmStore.ts

Comment thread src/store/alarmRegistrationsStore.ts Outdated
Replace pre-read of generation from Zustand state with SQL-level
`generation + 1` in onConflictDoUpdate, returning the result row
to eliminate a race window where concurrent upserts could compute
the same generation number from stale in-memory state.
Cover candidate == now (rolls forward 7 days), candidate one minute
after now (keeps same day), and candidate one minute before now
(rolls forward 6d 23h 59m).
@HoweiAY
HoweiAY requested a review from hyauyeung August 12, 2026 11:56
@HoweiAY

HoweiAY commented Aug 12, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@HoweiAY
HoweiAY merged commit 16dcf17 into main Aug 12, 2026
1 check passed
@HoweiAY
HoweiAY deleted the feature/enhance-ui branch August 12, 2026 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants