Present a full-screen in-app alarm overlay when a shift is about to start - #176
Merged
Conversation
…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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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/clockinwith 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+ShiftAlarmHostin the root layout): imperative singleton mirroring the appAlert pattern. Two triggers converge onpresentShiftAlarm():addNotificationReceivedListenerinapp/_layout.tsx: works on any screen when the scheduled notification is delivered while foregrounded.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: cleannpm test: 16 files, 114 tests passed (8 new tests for the payload guard, dedup, and controller registration)npm run lint: clean