From 7a29724f968aea565b65ba9725e1d42d37372962 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 16 Nov 2026 20:26:11 +0000 Subject: [PATCH] Sleep in the new look: one calm card surface, the night as the statement Behind Debug -> New look. Same structure (carousel, hypnogram, stages, records, ranges): every Sleep card shares sleepCard(), labels are sentence case (SleepLabel), the duration is CalmType.score, the hero loses its dither fade, and the tab gets the page colour, gutter, 720dp cap and CalmTypography. Four-skill audit in audits/, plan notes in docs/new-look-plan.md. Claude-Session: https://claude.ai/code/session_01P1t1aUqSUPd3whKXmgVm7w --- app/src/main/assets/i18n/pt-BR.json | 2 +- .../com/pulseloop/ui/screens/DebugScreen.kt | 2 +- .../com/pulseloop/ui/screens/SleepScreen.kt | 79 +++++++++++-------- audits/2026-11-16-new-look-sleep.md | 58 ++++++++++++++ docs/new-look-plan.md | 8 ++ 5 files changed, 115 insertions(+), 34 deletions(-) create mode 100644 audits/2026-11-16-new-look-sleep.md diff --git a/app/src/main/assets/i18n/pt-BR.json b/app/src/main/assets/i18n/pt-BR.json index fd8910e1..7d20a4f2 100644 --- a/app/src/main/assets/i18n/pt-BR.json +++ b/app/src/main/assets/i18n/pt-BR.json @@ -1557,7 +1557,7 @@ "Score {0} out of 100": "Pontuação {0} de 100", "Scores are PulseLoop estimates from ring data compared with the user's own baseline, not medical measurements.": "As pontuações são estimativas do PulseLoop a partir dos dados do anel comparados com a linha de base do próprio usuário, não medidas médicas.", "Screens in bed": "Telas na cama", - "Screens that have moved to it so far: Today, Vitals, Symptom Radar.": "Telas que já usam o novo visual: Hoje, Vitais, Radar de sintomas.", + "Screens that have moved to it so far: Today, Vitals, Sleep, Symptom Radar.": "Telas que já usam o novo visual: Hoje, Vitais, Sono, Radar de sintomas.", "Searching…": "Procurando…", "See Raw Packets above.": "Veja Pacotes brutos acima.", "See Ring Events above.": "Veja Eventos do anel acima.", diff --git a/app/src/main/java/com/pulseloop/ui/screens/DebugScreen.kt b/app/src/main/java/com/pulseloop/ui/screens/DebugScreen.kt index 1ebfa627..b12aef12 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/DebugScreen.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/DebugScreen.kt @@ -218,7 +218,7 @@ fun DebugScreen(viewModel: DiagnosticsViewModel, onBack: () -> Unit = {}) { ) { Column(Modifier.weight(1f)) { Text(tr("Try the new look"), style = MaterialTheme.typography.bodyMedium) - Text(tr("Screens that have moved to it so far: Today, Vitals, Symptom Radar."), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant) + Text(tr("Screens that have moved to it so far: Today, Vitals, Sleep, Symptom Radar."), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant) } Switch(checked = com.pulseloop.ui.calm.NewLook.on, onCheckedChange = null) } diff --git a/app/src/main/java/com/pulseloop/ui/screens/SleepScreen.kt b/app/src/main/java/com/pulseloop/ui/screens/SleepScreen.kt index e2cc1324..ad09a244 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/SleepScreen.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/SleepScreen.kt @@ -103,10 +103,15 @@ fun SleepScreen( sleepClock24h = android.text.format.DateFormat.is24HourFormat(androidx.compose.ui.platform.LocalContext.current) val state by (viewModel?.state?.collectAsState() ?: remember { mutableStateOf(SleepViewModel.SleepState()) }) + val calm = com.pulseloop.ui.calm.NewLook.on + // The new look (docs/new-look-plan.md, "Sleep"): page colour, gutter, 720dp cap, Inter. + com.pulseloop.ui.calm.CalmTypography(enabled = calm) { LazyColumn( - modifier = Modifier.fillMaxSize(), + modifier = if (calm) Modifier.fillMaxSize().background(com.pulseloop.ui.calm.CalmColors.page) + .wrapContentWidth().widthIn(max = 720.dp).fillMaxWidth() else Modifier.fillMaxSize(), contentPadding = PaddingValues( - start = 16.dp, end = 16.dp, + start = if (calm) com.pulseloop.ui.calm.CalmShape.gutter else 16.dp, + end = if (calm) com.pulseloop.ui.calm.CalmShape.gutter else 16.dp, top = 16.dp + topBarPadding, bottom = 16.dp + bottomBarPadding, ), verticalArrangement = Arrangement.spacedBy(16.dp), @@ -129,6 +134,27 @@ fun SleepScreen( } item { Spacer(Modifier.height(64.dp)) } } + } +} + +/** The card surface, in whichever look is on: one place, so every Sleep card matches. */ +@Composable +private fun Modifier.sleepCard(): Modifier { + val calm = com.pulseloop.ui.calm.NewLook.on + val shape = RoundedCornerShape(if (calm) com.pulseloop.ui.calm.CalmShape.radius else 8.dp) + return this.clip(shape) + .background(if (calm) com.pulseloop.ui.calm.CalmColors.card else PulseColors.card) + .border(1.dp, if (calm) com.pulseloop.ui.calm.CalmColors.border else PulseColors.borderSubtle, shape) +} + +/** A card's small label: tracked caps in the old look, a sentence-case name in the new one. */ +@Composable +private fun SleepLabel(text: String, modifier: Modifier = Modifier) { + if (com.pulseloop.ui.calm.NewLook.on) { + Text(text, style = com.pulseloop.ui.calm.CalmType.bodySmall, color = com.pulseloop.ui.calm.CalmColors.textSecondary, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = modifier) + } else { + Text(text.uppercase(), style = com.pulseloop.ui.theme.PulseType.eyebrow, color = PulseColors.textSecondary, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = modifier) + } } // ─────────────────────────── Day view ─────────────────────────── @@ -366,23 +392,24 @@ private fun SleepHeroCard( scoreLabel: String?, noData: Boolean = false, ) { - val shape = RoundedCornerShape(8.dp) + val calm = com.pulseloop.ui.calm.NewLook.on Row( Modifier .fillMaxWidth() - .clip(shape) - .background(PulseColors.card) - .ditherFade(PulseColors.sleep, 0.16f, 0f) - .border(1.dp, PulseColors.borderSubtle, shape) - .padding(24.dp), + .sleepCard() + // The dither is the old look's; the new one is a plain card. + .then(if (calm) Modifier else Modifier.ditherFade(PulseColors.sleep, 0.16f, 0f)) + .padding(if (calm) 20.dp else 24.dp), horizontalArrangement = Arrangement.spacedBy(12.dp), ) { Column(Modifier.weight(1f)) { - Text( - label.uppercase(), - style = com.pulseloop.ui.theme.PulseType.eyebrow, color = PulseColors.textSecondary, - ) - Text( + SleepLabel(label) + if (calm) Text( + value, + style = if (noData) com.pulseloop.ui.calm.CalmType.sectionTitle else com.pulseloop.ui.calm.CalmType.score, + color = com.pulseloop.ui.calm.CalmColors.text, + modifier = Modifier.padding(top = 4.dp), + ) else Text( value, fontSize = if (noData) 24.sp else 40.sp, fontWeight = FontWeight.SemiBold, @@ -422,23 +449,18 @@ private fun VisualizationCard( legend: Boolean, content: @Composable () -> Unit, ) { - val shape = RoundedCornerShape(8.dp) + val calm = com.pulseloop.ui.calm.NewLook.on Column( Modifier .fillMaxWidth() - .clip(shape) - .background(PulseColors.card) - .border(1.dp, PulseColors.borderSubtle, shape) - .padding(16.dp), + .sleepCard() + .padding(if (calm) 20.dp else 16.dp), verticalArrangement = Arrangement.spacedBy(16.dp), ) { Row(verticalAlignment = Alignment.Top) { Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(4.dp)) { - Text( - eyebrow.uppercase(), - style = com.pulseloop.ui.theme.PulseType.eyebrow, color = PulseColors.textSecondary, - ) - Text(title, fontSize = 16.sp, fontWeight = FontWeight.SemiBold, color = PulseColors.textPrimary) + SleepLabel(eyebrow) + Text(title, fontSize = 16.sp, fontWeight = FontWeight.SemiBold, color = if (calm) com.pulseloop.ui.calm.CalmColors.text else PulseColors.textPrimary) } if (legend) { // A wrapping legend capped at half the row (weight, fill = false): four translated @@ -808,21 +830,14 @@ private fun SleepStageSummaryCards(prefix: String = "", deep: String, light: Str @Composable private fun StageStat(label: String, value: String, color: Color, modifier: Modifier = Modifier) { - val shape = RoundedCornerShape(8.dp) Column( modifier - .clip(shape) - .background(PulseColors.card) - .border(1.dp, PulseColors.borderSubtle, shape) + .sleepCard() .padding(16.dp), ) { Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) { Box(Modifier.size(8.dp).clip(CircleShape).background(color)) - Text( - label.uppercase(), - style = com.pulseloop.ui.theme.PulseType.eyebrow, color = PulseColors.textSecondary, - maxLines = 1, overflow = TextOverflow.Ellipsis, - ) + SleepLabel(label) } Text( value, diff --git a/audits/2026-11-16-new-look-sleep.md b/audits/2026-11-16-new-look-sleep.md new file mode 100644 index 00000000..5c51b3c5 --- /dev/null +++ b/audits/2026-11-16-new-look-sleep.md @@ -0,0 +1,58 @@ +# Audit: Sleep in the new look (2.16.10) + +Date: 2026-11-16 · PR: see the PR linking this file · Auditor: Claude Code. impeccable was run with +the skill loaded (context with PRODUCT.md, `audit.native.md`, `critique.md`, `craft-floor.md`, +`android.md`); ux-user-flows, graphic-design-fundamentals and less-is-more were applied by hand. + +## Scope + +Sleep, behind Debug → New look. The structure stays (carousel, hypnogram, stages, records, +range views): Sleep is the tab opened for the why. Every Sleep card shares one surface +(`sleepCard()`: calm card, 12dp radius, hairline), labels are sentence case (`SleepLabel`), the +night's duration is `CalmType.score` (40sp Inter), the hero loses its dither fade, and the tab gets +the page colour, 20dp gutter, 720dp cap and `CalmTypography`. + +## ux-user-flows (§13 flow review checklist) + +No flow changes: same range selector, day navigation, carousel, record editing and detail. States +unchanged: loading renders nothing until the first rebuild, no-data hero, a split night's records. + +## impeccable + +| # | Dimension | Score | Key finding | +|---|---|---|---| +| 1 | Accessibility | 3 | Labels now full words, not tracked caps; device check owed. | +| 2 | Performance | 4 | No new work. | +| 3 | Appearance & theming | 3 | Cards converted; range selector, day header, records and balance cards still old (NL-4). | +| 4 | Platform conformance | 4 | Unchanged controls. | +| 5 | Adaptivity | 4 | 720dp cap added. | +| | **Total** | **18/20** | | + +Critique (design review only; native): 31/40. Strong: the duration as the statement, the stage +colours unchanged so the hypnogram reads as before. Weak: Consistency 2 (old pieces between new +cards, NL-4). No P0 or P1. + +## graphic-design-fundamentals (§13 checklist) + +Hierarchy: 40sp duration → hypnogram → stage cards. Contrast: calm tokens. Typography: Inter, +sizes on the scale. Colour: the stage colours carry the data; the hero's purple wash is gone, so +the night's colour lives in the chart only. Consistency with Today, Vitals and the radar: same +card. Production: no new assets. + +## less-is-more + +| Element | Question (1–5) | Kept / moved / merged / removed | +|---|---|---| +| Hero dither fade | 4 | Removed in the new look. | +| Caps eyebrows | 4 | Sentence case. | +| Hypnogram, stages, records | 1 | Kept. | + +Taps on common actions unchanged. + +## Evidence + +pt-BR: no new strings. No device here; on-device check owed. Canvas: Sleep board in the new look owed. + +## Verdict + +Merge (behind the switch). Carried forward: NL-4, canvas boards, on-device check. diff --git a/docs/new-look-plan.md b/docs/new-look-plan.md index 79a42544..921efda6 100644 --- a/docs/new-look-plan.md +++ b/docs/new-look-plan.md @@ -82,4 +82,12 @@ Rest Mode line, bedtime, food and tag cards, the accuracy-check banner and the C Still old-styled inside Vitals: the Measure button and its sheet, the ring gauges' own drawing, the My Health entry card and the Customize controls. +- **Sleep** (behind the switch in `SleepScreen`). Same structure: the night carousel, hypnogram, + stages, records and the range views stay, because they are the answer to "why". One card + surface for every Sleep card (`sleepCard()`), sentence-case labels (`SleepLabel`), the night's + duration in `CalmType.score`, no dither fade on the hero, and the page colour, gutter, 720dp cap + and `CalmTypography`. + +Still old-styled inside Sleep: the range selector, the day header, the records card, the sleep +balance card and the My Health entry card.