Skip to content

Add per-source sleep stage comparison bars on recent sleep rows#24

Draft
gsbernstein wants to merge 3 commits into
masterfrom
cursor/sleep-source-comparison-bars-08f8
Draft

Add per-source sleep stage comparison bars on recent sleep rows#24
gsbernstein wants to merge 3 commits into
masterfrom
cursor/sleep-source-comparison-bars-08f8

Conversation

@gsbernstein

@gsbernstein gsbernstein commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Summary

Adds aligned, color-coded sleep stage timelines to each day row in Recent Sleep so you can quickly compare tracked data across HealthKit sources — including sources you've disabled in settings.

Changes

  • HealthKitManager: publishes allSleepSessions alongside the filtered sleepSessions, so comparison UI can show disabled sources without affecting sleep bank calculations.
  • SleepSourceComparisonView: new component with one horizontal bar per source, segments colored by sleep stage (deep, REM, core, etc.) and aligned to a shared time range for the night. Each row now shows total measured sleep (H:MM) on the right.
  • SleepDayGroup: shows the comparison bars at the bottom of each collapsed row when multiple sources have data for that night, or when a disabled source still has samples.
  • Disabled sources render dimmed (35% opacity) so they're visible but clearly excluded from totals.

UI behavior

  • Bars appear below the day header without expanding the row.
  • Source name labels sit to the left of each bar (72pt width, truncated).
  • Measured hours appear right-aligned beside each bar.
  • Comparison only appears when it's useful: 2+ sources with data, or any disabled source with data for that night.

Testing

Requires macOS/Xcode — build and run on simulator/device with sleep data from multiple HealthKit sources (e.g. Apple Watch + iPhone). Use Settings → Data Sources to toggle sources and verify dimmed bars still appear for disabled ones.

Open in Web Open in Cursor 

cursoragent and others added 3 commits July 10, 2026 05:27
Expose unfiltered allSleepSessions from HealthKitManager so the UI can
compare data across sources even when some are disabled in settings.

Add SleepSourceComparisonView with aligned, color-coded stage timelines —
one bar per source, dimmed when the source is excluded. Show the comparison
at the bottom of each collapsed day row when multiple sources contribute
data or a disabled source still has samples for that night.

Co-authored-by: Greg <gsbernstein@users.noreply.github.com>
Co-authored-by: Greg <gsbernstein@users.noreply.github.com>
Co-authored-by: Greg <gsbernstein@users.noreply.github.com>
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