Skip to content

Show all days in recent sleep list, including days without data#9

Merged
gsbernstein merged 8 commits into
masterfrom
cursor/show-empty-days-in-list-a957
Jun 6, 2026
Merged

Show all days in recent sleep list, including days without data#9
gsbernstein merged 8 commits into
masterfrom
cursor/show-empty-days-in-list-a957

Conversation

@gsbernstein

@gsbernstein gsbernstein commented Jun 4, 2026

Copy link
Copy Markdown
Owner

Summary

The Recent Sleep list previously only showed days that had HealthKit sleep sessions. Days with no tracked sleep were omitted entirely, making gaps in the history hard to see.

This change fills the list with every day in the 30-day history window (matching the HealthKit fetch range). Days without data now appear with:

  • "No sleep data" subtitle
  • Omit right side

Empty days are not expandable since there are no sessions to show.

Changes

  • Added Constants.sleepHistoryDays (30) shared by HealthKit fetch and the recent sleep list
  • RecentSleepSessionsCard generates a complete day range instead of iterating only over days with sessions
  • SleepDayGroup handles empty session arrays with appropriate empty-state UI
Open in Web Open in Cursor 

Fill the Recent Sleep list with every day in the 30-day history window
instead of only days that have HealthKit sessions. Empty days display
'No sleep data', 0:00 duration, and the full goal deficit.

Co-authored-by: Greg <gsbernstein@users.noreply.github.com>
@gsbernstein gsbernstein requested a review from Copilot June 6, 2026 15:34
@gsbernstein gsbernstein marked this pull request as ready for review June 6, 2026 15:34

Copilot AI 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.

Pull request overview

Updates the “Recent Sleep” UI to display a continuous day-by-day history (including days with no HealthKit sleep sessions), and centralizes the shared history window length used across fetching and display.

Changes:

  • Introduces Constants.sleepHistoryDays to share the history window length.
  • Builds the Recent Sleep list from a complete day range rather than only days with sessions.
  • Adds an empty-state presentation for days with no sessions and disables expansion for those rows.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
Bedtime/Bedtime/Views/RecentSleepSessionsCard.swift Generates a fixed day range for the recent list and fills missing days with empty session arrays.
Bedtime/Bedtime/Views/Components/SleepDayGroup.swift Adds “No sleep data” UI and prevents expanding rows with no sessions.
Bedtime/Bedtime/Models/HealthKitManager.swift Uses the shared constant for the HealthKit lookback window.
Bedtime/Bedtime/Constants.swift Adds sleepHistoryDays constant.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Bedtime/Bedtime/Views/Components/SleepDayGroup.swift Outdated
Comment thread Bedtime/Bedtime/Views/Components/SleepDayGroup.swift
Comment thread Bedtime/Bedtime/Views/RecentSleepSessionsCard.swift
gsbernstein and others added 6 commits June 6, 2026 08:42

Copilot AI 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.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Comment thread Bedtime/Bedtime/Views/Components/SleepDayGroup.swift
Comment thread Bedtime/Bedtime/Models/HealthKitManager.swift Outdated

Copilot AI 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.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Comment thread Bedtime/Bedtime/Views/Components/SleepDayGroup.swift
Comment thread Bedtime/Bedtime/Models/HealthKitManager.swift
@gsbernstein gsbernstein merged commit 9c47540 into master Jun 6, 2026
1 check passed
@gsbernstein gsbernstein deleted the cursor/show-empty-days-in-list-a957 branch June 6, 2026 17: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.

3 participants