Skip to content

Android: Sleep screen — metric detail ModalBottomSheet#259

Closed
ujix wants to merge 3 commits into
NoopApp:mainfrom
ujix:android/sleep-metric-sheets
Closed

Android: Sleep screen — metric detail ModalBottomSheet#259
ujix wants to merge 3 commits into
NoopApp:mainfrom
ujix:android/sleep-metric-sheets

Conversation

@ujix

@ujix ujix commented Jun 13, 2026

Copy link
Copy Markdown

What this PR does

Executive summary: Tapping any metric tile in Sleep Night Detail now slides up a ModalBottomSheet with a full trend chart and range selector instead of pushing a new screen.

Details:

Sleep screen — metric detail

  • Updated: Tapping any metric tile (Performance, Efficiency, Latency, Disturbances, REM, Deep, Light, Awake) slides up a ModalBottomSheet — W / M / 3M / 6M / 1Y / ALL range selector, Y-axis labels, interactive LineChart, X-axis dates, min/avg/max footer
  • Updated: SparkTile accepts an optional onClick: (() -> Unit)? parameter; when provided the tile renders with a clickable modifier; when null it is non-interactive (backwards compatible)
  • Updated: AppRoot and MainActivity wired to surface the bottom sheet callback through the nav graph

Validation: :app:assembleFullDebug, testFullDebugUnitTest, and testDemoDebugUnitTest all green.

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Documentation
  • CI / tooling

How it was tested

Android 16. Real Samsung device. WHOOP 4.0. Tested: all 8 metric tiles open correct sheet, range selector switches data, chart drag shows values, sheet dismisses on swipe-down and back gesture, sheet does not open for non-clickable tiles.

Checklist

  • Swift package tests pass for any package I touched (swift test in Packages/<name>)
  • Android unit tests pass if I touched android/ (./gradlew testFullDebugUnitTest)
  • No new build warnings introduced
  • UI changes use only StrandDesign tokens — no hardcoded colors, fonts, or spacing
  • No hardcoded hex frame bytes; protocol facts live in the schema / decoders
  • Follows the conventions in docs/CONTRIBUTING.md
  • I did not commit generated output (Strand.xcodeproj/) or any secrets/keystores

Related issues

…ckerDialog

Redesigns NightNavHeader to match DayNavBar: left/right chevrons flanking
an accent-tinted center block showing the night label and date. The time
range moves to a separate row below. Tapping the block opens a
DatePickerDialog to jump to any recorded night by calendar date.

Also fixes nightOffset reset: moves it into LaunchedEffect(days) so it only
resets on a real sync/import, not on every optimistic sleeps update.
@NoopApp

NoopApp commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Nice work — the metric-detail ModalBottomSheet and the morning journal prompt are well put together, and the Material3 sheet lifecycle is clean. Same two fixes needed before it could stand alone:

  1. Hardcoded ARGB gray Paint (~line 616) → Palette.textTertiary (or a derived token).
  2. The date-picker trigger is missing a contentDescription.

This is the third rung of the Sleep stack and a subset of #260's surface, so same as #258: we're making one decision on #260 rather than merging the intermediate states. Holding open. Thanks for the thorough build-out.

… card

HoursVsNeededCard: score %, trend arrow, gradient progress bar, stacked
component bar (Healthy / Strain / Debt), slept/needed/debt footer.

SleepConsistencyCard: Canvas vertical bar chart (bed-time top, wake-time
bottom), dashed typical overlay lines, Y-axis time labels, X-axis day
labels. Score is count-based (nights where both bed and wake are within 45
min of the user's typical); the previous SD formula always returned 0 %.
@ujix ujix force-pushed the android/sleep-metric-sheets branch 2 times, most recently from bce2c87 to ee5f57c Compare June 13, 2026 15:14
Each SparkTile in MetricGrid now accepts an onClick lambda; tapping any
tile sets detailMetricKey and slides up a ModalBottomSheet scoped to
SleepScreen. SparkTile gains an onClick param — when set, the card
modifier gets .clickable so the whole tile is the touch target.
AppRoot adds SleepMetricDetail as a nav destination (kept for deep-link
compatibility). MainActivity adds KEY_LAST_JOURNAL_PROMPT to NoopPrefs.
@ujix

ujix commented Jun 13, 2026

Copy link
Copy Markdown
Author

Both issues addressed:

Branch updated and force-pushed.

@NoopApp

NoopApp commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Thanks — Palette.textTertiary.toArgb() plus the onClickLabel / contentDescription a11y additions are good, and moving SleepMetricDetailSheetContent to where it's actually called (out of #258's dead code) is the right call. Same note as #258: this is part of the Sleep stack we're deciding as one unit on #260, so keeping it open pending that decision. Appreciate the careful follow-through.

@NoopApp

NoopApp commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Folded into the Sleep update shipped in v2.9.0 (metric-detail sheets are included). Thanks @ujix! Closing — superseded by #260.

@NoopApp NoopApp closed this Jun 13, 2026
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