Skip to content

feat(sleep): day navigation on the Sleep > Day view#84

Merged
saksham2001 merged 4 commits into
saksham2001:mainfrom
rgvxsthi:feat/sleep-day-navigation
Jul 16, 2026
Merged

feat(sleep): day navigation on the Sleep > Day view#84
saksham2001 merged 4 commits into
saksham2001:mainfrom
rgvxsthi:feat/sleep-day-navigation

Conversation

@rgvxsthi

Copy link
Copy Markdown
Contributor

Follow-up to #83 (stacked on it — the diff will narrow to just the day-nav commit once #83 merges).

Adds the ability to browse previous days on the Sleep → Day view, so the per-day session carousel isn't limited to today/last night.

  • Date stepper: ‹ › chevrons + a tappable date that opens a graphical picker. Horizontal swipe stays reserved for the session carousel; days move only via the stepper (no gesture conflict).
  • Anchoring: dayOffset shifts the now passed to sleepRange/dayReferenceNight, so the 4 AM "last night" flip is preserved at every offset.
  • Bounds: forward capped at today (disabled affordance); back to one week before the earliest recorded night, clamped to a 1-year floor. The carousel resets to page 1 on each day change.
  • Correctness: past days show the scripted coach line, never today's mislabeled LLM day summary; the summary refresh only fires on today.
  • UX/A11y: directional push transition (Reduce Motion → crossfade), a selection haptic per change, a reserved subtitle line so the hero never jumps across the Today/Yesterday label boundaries, a VoiceOver "day + session count" announcement, disabled-state traits, and ≥44 pt hit targets.

Designed via a UI / interaction / accessibility review pass. One optional a11y item intentionally deferred: making the carousel a VoiceOver adjustable element (swipe up/down between sessions).

@rgvxsthi
rgvxsthi requested a review from saksham2001 as a code owner July 12, 2026 07:55
rgvxsthi added 3 commits July 13, 2026 09:52
Browse previous days from the Day view with a date stepper (chevrons + a
tappable date that opens a graphical picker). Horizontal swipe stays
reserved for the session carousel; days move only via the stepper.

- dayOffset shifts the `now` passed to sleepRange/dayReferenceNight, so
  the 4 AM "last night" flip is preserved at every offset.
- Forward capped at today; back to one week before the earliest recorded
  night (1-year floor). Carousel resets to page 1 on each day change.
- Past days show the scripted coach, never today's mislabeled LLM summary.
- Directional push transition (Reduce Motion -> crossfade), a selection
  haptic per change, a reserved subtitle line so the hero never jumps, a
  VoiceOver day + session-count announcement, and 44pt hit targets.
…ment

Off-screen carousel pages weren't reachable by VoiceOver — a paged
horizontal ScrollView doesn't advance element-to-element for VO, so a VO
user was stuck on the first session. Expose the carousel as one adjustable
element: swipe up/down steps between sessions and scrolls to the selected
page, with a "N of M, <start> to <end>" value. Completes the carousel
accessibility deferred from the initial day-navigation pass.
SleepView read sleep via a plain `SleepService.sleepRange(...)` call and only
observed `CoachSummary` via @query, so after a background ring sync wrote new
SleepSession/block rows the tab kept showing stale sleep until the user changed
range or pulled to refresh. Observe `PulseDataChange.shared.token` (as Today and
Vitals already do) so the body re-runs and re-fetches on each synced batch.
@rgvxsthi
rgvxsthi force-pushed the feat/sleep-day-navigation branch from 7ac7f4e to 0b8f86b Compare July 12, 2026 23:55
# Conflicts:
#	PulseLoop/Views/SleepView.swift
@saksham2001
saksham2001 merged commit 8b86e5c into saksham2001:main Jul 16, 2026
2 checks passed
@rgvxsthi
rgvxsthi deleted the feat/sleep-day-navigation branch July 16, 2026 04:20
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