Skip to content

Present a full-screen in-app alarm overlay when a shift is about to start - #176

Merged
SishirP17 merged 2 commits into
mainfrom
feature/shift-alarm-overlay
Jul 26, 2026
Merged

Present a full-screen in-app alarm overlay when a shift is about to start#176
SishirP17 merged 2 commits into
mainfrom
feature/shift-alarm-overlay

Conversation

@SishirP17

Copy link
Copy Markdown
Collaborator

What

When the 30-second shift alert fires while the app is open, the caregiver now lands on a full-screen in-app alarm overlay instead of a small system banner, with a one-tap path to the clock-in screen.

The overlay (ShiftAlarmOverlay): brand-gradient takeover with a wiggling alarm bell inside pulsing rings, "Shift starting soon" kicker, client name, live per-second countdown, and a frosted card with the scheduled time, address, and service code. A strong haptic fires on arrival and a heartbeat pulse repeats every 2s (for up to 30s). Actions: Go to clock-in (routes to /clockin with the same param shape as the dashboard card and the notification tap) and Dismiss (also hardware back). Auto-dismisses after 75s so an ignored alarm never strands a stale overlay. The alarm chime still comes from the delivered notification; the notification handler now suppresses only the banner for shift alerts in the foreground.

Plumbing (src/lib/shift-alarm.ts + ShiftAlarmHost in the root layout): imperative singleton mirroring the appAlert pattern. Two triggers converge on presentShiftAlarm():

  1. addNotificationReceivedListener in app/_layout.tsx: works on any screen when the scheduled notification is delivered while foregrounded.
  2. The dashboard's existing 5s foreground tick: covers Expo Go on Android, where local notifications are unavailable. It previously fired a lone haptic; it now presents the overlay, and its local fired-set was replaced by the module's dedup.

Dedup key is assignmentId@scheduledTime, so the overlay shows at most once per shift occurrence regardless of which trigger lands first or how often the tick re-enters the window. A trigger that races the host's mount does not consume the dedup slot.

Background/locked behavior is unchanged: system notification with the alarm chime, tap deep-links to clock-in.

Verification

  • npm run typecheck: clean
  • npm test: 16 files, 114 tests passed (8 new tests for the payload guard, dedup, and controller registration)
  • npm run lint: clean

…tart

When the 30-second shift alert lands while the app is open, the caregiver
now gets a full-screen soft alarm instead of the small system banner:
pulsing bell on the brand gradient, live countdown, client name, time,
address and service code, plus a repeating haptic pulse. "Go to clock-in"
routes to /clockin with the same params as the dashboard card and the
notification tap; "Dismiss" (or the back button) closes it, and it
auto-dismisses after 75 seconds if ignored.

Two triggers converge on presentShiftAlarm() in src/lib/shift-alarm.ts:
the root layout's addNotificationReceivedListener (any screen; the
notification handler suppresses the banner for shift alerts but keeps the
alarm chime playing) and the dashboard's foreground tick (covers Expo Go
on Android, where local notifications are unavailable). Presentation is
deduped per assignmentId@scheduledTime, replacing the dashboard's local
fired-set, so the overlay shows at most once per shift occurrence.
@SishirP17
SishirP17 requested a review from durga710 as a code owner July 26, 2026 19:36
@vercel

vercel Bot commented Jul 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
rayhealth-evv-platform-app Ready Ready Preview, Comment Jul 26, 2026 7:55pm

Same design language as NextVisitHero on the dashboard: the diagonal
navy-to-blue hero gradient, eyebrow with pulsing dot plus a tabular
countdown in the top corners, hero-scale client name, the 13px icon meta
row with dot dividers, a frosted service panel matching the route-preview
slot, and the frosted Tap to clock in CTA row. The full-screen alarm now
reads as the Up next card, urgently.
@SishirP17
SishirP17 merged commit 3dbee11 into main Jul 26, 2026
13 checks passed
@SishirP17
SishirP17 deleted the feature/shift-alarm-overlay branch July 26, 2026 20:02
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.

1 participant