diff --git a/app/src/main/assets/i18n/pt-BR.json b/app/src/main/assets/i18n/pt-BR.json index 9429564e..f0a3cd9c 100644 --- a/app/src/main/assets/i18n/pt-BR.json +++ b/app/src/main/assets/i18n/pt-BR.json @@ -1139,6 +1139,7 @@ "New look": "Novo visual", "Next": "Próximo", "Next day": "Próximo dia", + "Next meal idea · {0}": "Ideia para a próxima refeição · {0}", "Next period around {0} (in {1} day{2}), from your usual {3}-day cycle.": "Próxima menstruação por volta de {0} (em {1} dia{2}), com base no seu ciclo habitual de {3} dias.", "Next: end date": "Próximo: data de término", "Night covered by the ring": "Noite registrada pelo anel", @@ -1559,7 +1560,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, Sleep, Activity, Symptom Radar.": "Telas que já usam o novo visual: Hoje, Vitais, Sono, Atividade, Radar de sintomas.", + "Screens that have moved to it so far: Today, Vitals, Sleep, Activity, Nutrition, My Health, Readiness, Symptom Radar.": "Telas que já usam o novo visual: Hoje, Vitais, Sono, Atividade, Nutrição, Minha saúde, Prontidão, Radar de sintomas.", "Searching…": "Procurando…", "See Raw Packets above.": "Veja Pacotes brutos acima.", "See Ring Events above.": "Veja Eventos do anel acima.", @@ -2231,6 +2232,7 @@ "{0} inactive {1} since {2}:00": "{0} {1} sem se mexer desde as {2}:00", "{0} is paired": "{0} foi pareada", "{0} is retiring this model on {1}.": "{0} vai descontinuar este modelo em {1}.", + "{0} kcal": "{0} kcal", "{0} kcal · P {1} · C {2} · F {3}": "{0} kcal · P {1} · C {2} · G {3}", "{0} lab markers to review": "{0} marcadores de exame para revisar", "{0} left this week": "Restam {0} esta semana", diff --git a/app/src/main/java/com/pulseloop/ui/calm/Look.kt b/app/src/main/java/com/pulseloop/ui/calm/Look.kt new file mode 100644 index 00000000..ed57023a --- /dev/null +++ b/app/src/main/java/com/pulseloop/ui/calm/Look.kt @@ -0,0 +1,38 @@ +package com.pulseloop.ui.calm + +import androidx.compose.foundation.background +import androidx.compose.foundation.border +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.dp +import com.pulseloop.ui.theme.PulseColors + +/** + * The surface and text roles of whichever look is on, for pieces shared by converted and + * unconverted screens (a section, a fact row, the My Health entry card). Reading [NewLook.on] + * here, not at each call site, keeps the two looks from drifting apart inside one component. + * Delete with the old look: every getter then returns its Calm value. + */ +object Look { + val calm: Boolean get() = NewLook.on + val page: Color get() = if (calm) CalmColors.page else PulseColors.background + val card: Color get() = if (calm) CalmColors.card else PulseColors.card + val border: Color get() = if (calm) CalmColors.border else PulseColors.borderSubtle + val text: Color get() = if (calm) CalmColors.text else PulseColors.textPrimary + val textSecondary: Color get() = if (calm) CalmColors.textSecondary else PulseColors.textSecondary + val textMuted: Color get() = if (calm) CalmColors.textMuted else PulseColors.textMuted + val radius: Dp get() = if (calm) CalmShape.radius else 8.dp +} + +/** + * A card in whichever look is on: the radius, the surface and its hairline. [oldBorder] keeps an + * old-look card that never had a hairline exactly as it was; the new look always draws one. + */ +fun Modifier.lookCard(oldBorder: Boolean = true): Modifier { + val shape = RoundedCornerShape(Look.radius) + val base = this.clip(shape).background(Look.card) + return if (Look.calm || oldBorder) base.border(1.dp, Look.border, shape) else base +} 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 a64bbec9..ddace356 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, Sleep, Activity, Symptom Radar."), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant) + Text(tr("Screens that have moved to it so far: Today, Vitals, Sleep, Activity, Nutrition, My Health, Readiness, 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/MyHealthUi.kt b/app/src/main/java/com/pulseloop/ui/screens/MyHealthUi.kt index b0b14e46..1dcaefd3 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/MyHealthUi.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/MyHealthUi.kt @@ -1,5 +1,6 @@ package com.pulseloop.ui.screens +import com.pulseloop.ui.calm.lookCard import com.pulseloop.ui.i18n.trf import com.pulseloop.ui.components.PulseButtonStyle import com.pulseloop.ui.components.PulseButton @@ -103,7 +104,8 @@ internal fun Section( var open by androidx.compose.runtime.saveable.rememberSaveable(title) { mutableStateOf(summary == null) } val collapsible = summary != null Column( - Modifier.fillMaxWidth().clip(RoundedCornerShape(8.dp)).background(PulseColors.card).padding(16.dp), + Modifier.fillMaxWidth().then(Modifier.lookCard(oldBorder = false)) + .padding(if (com.pulseloop.ui.calm.Look.calm) 20.dp else 16.dp), verticalArrangement = Arrangement.spacedBy(8.dp), content = { if (collapsible) { @@ -114,8 +116,8 @@ internal fun Section( verticalAlignment = Alignment.CenterVertically, ) { Column(Modifier.weight(1f)) { - Text(title, style = com.pulseloop.ui.theme.PulseType.title, color = PulseColors.textPrimary) - if (!open) Text(summary!!, fontSize = 12.sp, color = PulseColors.textMuted, maxLines = 2, overflow = TextOverflow.Ellipsis) + Text(title, style = if (com.pulseloop.ui.calm.Look.calm) com.pulseloop.ui.calm.CalmType.title else com.pulseloop.ui.theme.PulseType.title, color = com.pulseloop.ui.calm.Look.text) + if (!open) Text(summary!!, fontSize = if (com.pulseloop.ui.calm.Look.calm) 14.sp else 12.sp, color = com.pulseloop.ui.calm.Look.textMuted, maxLines = 2, overflow = TextOverflow.Ellipsis) } val turn by androidx.compose.animation.core.animateFloatAsState( if (open) 180f else 0f, @@ -138,7 +140,9 @@ internal fun Section( Column(verticalArrangement = Arrangement.spacedBy(8.dp)) { content() } } } else { - Text(title.uppercase(), style = com.pulseloop.ui.theme.PulseType.eyebrow, color = PulseColors.textSecondary) + // In the new look the section's name is its heading, in sentence case. + if (com.pulseloop.ui.calm.Look.calm) Text(title, style = com.pulseloop.ui.calm.CalmType.title, color = com.pulseloop.ui.calm.Look.text) + else Text(title.uppercase(), style = com.pulseloop.ui.theme.PulseType.eyebrow, color = PulseColors.textSecondary) content() } }, @@ -146,11 +150,11 @@ internal fun Section( } @Composable -internal fun Fact(label: String, value: String, note: String? = null, color: Color = PulseColors.textPrimary) { +internal fun Fact(label: String, value: String, note: String? = null, color: Color = com.pulseloop.ui.calm.Look.text) { Row(Modifier.fillMaxWidth(), verticalAlignment = Alignment.Top) { Column(Modifier.weight(1f)) { - Text(label, fontSize = 14.sp, color = PulseColors.textSecondary) - note?.let { Text(it, fontSize = 12.sp, color = PulseColors.textMuted) } + Text(label, fontSize = 14.sp, color = com.pulseloop.ui.calm.Look.textSecondary) + note?.let { Text(it, fontSize = 12.sp, color = com.pulseloop.ui.calm.Look.textMuted) } } // Bounded: a translated value ("Moderada · 3h 20m") must not squeeze the label column. Text(value, fontSize = 16.sp, fontWeight = FontWeight.Bold, color = color, textAlign = TextAlign.End, modifier = Modifier.widthIn(max = 160.dp)) @@ -201,12 +205,12 @@ fun MyHealthScreen(onBack: () -> Unit, onBreathe: () -> Unit, onWhatChanged: () } var restUntil by remember { mutableStateOf(RestMode.until(context)) } - Column(Modifier.fillMaxSize().background(PulseColors.background)) { + val calm = com.pulseloop.ui.calm.NewLook.on + // The new look (docs/new-look-plan.md, "My Health"): calm bar, page, gutter, 720dp cap, Inter. + com.pulseloop.ui.calm.CalmTypography(enabled = calm) { + Column(Modifier.fillMaxSize().background(com.pulseloop.ui.calm.Look.page)) { val shareScope = rememberCoroutineScope() - com.pulseloop.ui.components.PulseTopBar( - title = tr("My Health"), - onBack = onBack, - actions = { + val shareAction: @Composable RowScope.() -> Unit = { IconButton( onClick = { shareScope.launch { @@ -222,13 +226,14 @@ fun MyHealthScreen(onBack: () -> Unit, onBreathe: () -> Unit, onWhatChanged: () } } }, - ) { Icon(androidx.compose.material.icons.Icons.Filled.Share, tr("Share my week"), tint = PulseColors.textSecondary) } - }, - ) + ) { Icon(androidx.compose.material.icons.Icons.Filled.Share, tr("Share my week"), tint = com.pulseloop.ui.calm.Look.textSecondary) } + } + if (calm) com.pulseloop.ui.calm.CalmTopBar(tr("My Health"), onBack, shareAction) + else com.pulseloop.ui.components.PulseTopBar(title = tr("My Health"), onBack = onBack, actions = shareAction) // Lazy: each section composes as it scrolls in, instead of every chart and DB read at once. androidx.compose.foundation.lazy.LazyColumn( - Modifier.fillMaxSize(), - contentPadding = PaddingValues(horizontal = 16.dp, vertical = 8.dp), + if (calm) Modifier.fillMaxSize().wrapContentWidth().widthIn(max = 720.dp).fillMaxWidth() else Modifier.fillMaxSize(), + contentPadding = PaddingValues(horizontal = if (calm) com.pulseloop.ui.calm.CalmShape.gutter else 16.dp, vertical = 8.dp), verticalArrangement = Arrangement.spacedBy(12.dp), ) { val s = snap @@ -263,7 +268,7 @@ fun MyHealthScreen(onBack: () -> Unit, onBreathe: () -> Unit, onWhatChanged: () s.areas.forEach { a -> Row(verticalAlignment = Alignment.CenterVertically) { Column(Modifier.weight(1f)) { - Text(a.title, style = com.pulseloop.ui.theme.PulseType.title, color = PulseColors.textPrimary) + Text(a.title, style = if (com.pulseloop.ui.calm.Look.calm) com.pulseloop.ui.calm.CalmType.title else com.pulseloop.ui.theme.PulseType.title, color = com.pulseloop.ui.calm.Look.text) Text(a.detail, fontSize = 12.sp, color = PulseColors.textSecondary) } Text(a.rating.label, fontSize = 14.sp, fontWeight = FontWeight.Bold, color = ratingColor(a.rating), textAlign = TextAlign.End, maxLines = 2, modifier = Modifier.widthIn(max = 120.dp)) @@ -281,13 +286,14 @@ fun MyHealthScreen(onBack: () -> Unit, onBreathe: () -> Unit, onWhatChanged: () item { Text( tr("Estimates from your ring compared with your own recent normal, not medical measurements."), - fontSize = 14.sp, color = PulseColors.textSecondary, + fontSize = 14.sp, color = com.pulseloop.ui.calm.Look.textSecondary, ) } item { Spacer(Modifier.height(24.dp)) } } } } + } } /** A row that opens a deeper My Health screen. */ @@ -301,14 +307,16 @@ private fun RadarEntryRow(r: SymptomRadar.Result?, restUntil: java.time.LocalDat else -> r.level.label } + if (restUntil != null) " · " + tr("Rest Mode on") else "" Row( - Modifier.fillMaxWidth().heightIn(min = 56.dp).clickable(role = androidx.compose.ui.semantics.Role.Button, onClick = onOpen).padding(vertical = 8.dp), + Modifier.fillMaxWidth().heightIn(min = 56.dp).lookCard() + .clickable(role = androidx.compose.ui.semantics.Role.Button, onClick = onOpen).padding(20.dp), verticalAlignment = Alignment.CenterVertically, ) { Column(Modifier.weight(1f)) { - Text(tr("Symptom Radar"), fontSize = 16.sp, fontWeight = FontWeight.Bold, color = PulseColors.textPrimary) - Text(line, fontSize = 14.sp, color = PulseColors.textSecondary) + // Only shown in the new look (MyHealthScreen), so it speaks it. + Text(tr("Symptom Radar"), style = com.pulseloop.ui.calm.CalmType.title, color = com.pulseloop.ui.calm.CalmColors.text) + Text(line, style = com.pulseloop.ui.calm.CalmType.bodySmall, color = com.pulseloop.ui.calm.CalmColors.textSecondary) } - com.pulseloop.ui.components.Chevron() + com.pulseloop.ui.components.Chevron(tint = com.pulseloop.ui.calm.CalmColors.textSecondary) } } @@ -638,15 +646,15 @@ private const val INHALE_MS = 4_000L @Composable fun MyHealthEntryCard(title: String, subtitle: String, onClick: () -> Unit) { Row( - Modifier.fillMaxWidth().clip(RoundedCornerShape(8.dp)).background(PulseColors.card) - .clickable(role = Role.Button, onClick = onClick).padding(16.dp), + Modifier.fillMaxWidth().then(Modifier.lookCard(oldBorder = false)) + .clickable(role = Role.Button, onClick = onClick).padding(if (com.pulseloop.ui.calm.Look.calm) 20.dp else 16.dp), verticalAlignment = Alignment.CenterVertically, ) { Column(Modifier.weight(1f)) { - Text(title, fontSize = 16.sp, fontWeight = FontWeight.Bold, color = PulseColors.textPrimary) - Text(subtitle, fontSize = 12.sp, color = PulseColors.textMuted) + Text(title, fontSize = 16.sp, fontWeight = if (com.pulseloop.ui.calm.Look.calm) FontWeight.SemiBold else FontWeight.Bold, color = com.pulseloop.ui.calm.Look.text) + Text(subtitle, fontSize = if (com.pulseloop.ui.calm.Look.calm) 14.sp else 12.sp, color = com.pulseloop.ui.calm.Look.textMuted) } - com.pulseloop.ui.components.Chevron() + com.pulseloop.ui.components.Chevron(tint = com.pulseloop.ui.calm.Look.textMuted) } } diff --git a/app/src/main/java/com/pulseloop/ui/screens/NutritionScreen.kt b/app/src/main/java/com/pulseloop/ui/screens/NutritionScreen.kt index dc3b7818..386511bf 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/NutritionScreen.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/NutritionScreen.kt @@ -1,5 +1,6 @@ package com.pulseloop.ui.screens +import com.pulseloop.ui.calm.lookCard import com.pulseloop.ui.i18n.trf import com.pulseloop.ui.components.PulseButtonStyle import com.pulseloop.ui.components.PulseButton @@ -123,20 +124,28 @@ fun NutritionScreen( } } + val calm = com.pulseloop.ui.calm.NewLook.on + // The new look (docs/new-look-plan.md, "Nutrition"): calm bar, page, gutter, 720dp cap, Inter. + com.pulseloop.ui.calm.CalmTypography(enabled = calm) { Scaffold( - containerColor = PulseColors.background, + containerColor = com.pulseloop.ui.calm.Look.page, // Insets are already applied by the route wrapper (see SettingsSubScreen). contentWindowInsets = WindowInsets(0, 0, 0, 0), topBar = { - if (!asTab) com.pulseloop.ui.components.PulseTopBar(title = tr("Nutrition"), onBack = onBack) + if (!asTab) { + if (calm) com.pulseloop.ui.calm.CalmTopBar(tr("Nutrition"), onBack) + else com.pulseloop.ui.components.PulseTopBar(title = tr("Nutrition"), onBack = onBack) + } }, ) { padding -> LazyColumn( - Modifier.fillMaxSize().padding(padding), + Modifier.fillMaxSize().padding(padding) + .then(if (calm) Modifier.wrapContentWidth().widthIn(max = 720.dp).fillMaxWidth() else Modifier), verticalArrangement = Arrangement.spacedBy(12.dp), // As a tab, the last card scrolls clear of the Actions button. contentPadding = PaddingValues( - start = 16.dp, top = 16.dp + topBarPadding, end = 16.dp, + start = if (calm) com.pulseloop.ui.calm.CalmShape.gutter else 16.dp, top = 16.dp + topBarPadding, + end = if (calm) com.pulseloop.ui.calm.CalmShape.gutter else 16.dp, bottom = if (asTab) 16.dp + bottomBarPadding else 16.dp, ), ) { @@ -158,13 +167,14 @@ fun NutritionScreen( val hasCalorieGoal = goal?.intakeCalories != null val goalCal = goal?.intakeCalories ?: 2000.0 val pct = if (goalCal > 0) (totalCal / goalCal).coerceAtMost(1.0) else 0.0 - Card(Modifier.fillMaxWidth(), shape = RoundedCornerShape(8.dp), colors = CardDefaults.cardColors(containerColor = PulseColors.card)) { + Box(Modifier.fillMaxWidth().lookCard(oldBorder = false)) { // Invisible rather than absent while loading, so the card keeps its height. Column( - Modifier.padding(16.dp).then(if (dayLoaded && goalLoaded) Modifier else Modifier.alpha(0f)), + Modifier.padding(if (calm) 20.dp else 16.dp).then(if (dayLoaded && goalLoaded) Modifier else Modifier.alpha(0f)), horizontalAlignment = Alignment.CenterHorizontally, ) { - Text("${totalCal.roundToInt()} kcal", fontSize = 32.sp, fontWeight = FontWeight.Bold) + if (calm) Text(trf("{0} kcal", totalCal.roundToInt()), style = com.pulseloop.ui.calm.CalmType.score, color = com.pulseloop.ui.calm.CalmColors.text) + else Text("${totalCal.roundToInt()} kcal", fontSize = 32.sp, fontWeight = FontWeight.Bold) Text( if (hasCalorieGoal) trf("of {0}", goalCal.roundToInt()) else trf("No goal set · {0} is a typical day", goalCal.roundToInt()), @@ -176,7 +186,7 @@ fun NutritionScreen( progress = { pct.toFloat() }, modifier = Modifier.fillMaxWidth().height(8.dp), color = PulseColors.calories, - trackColor = PulseColors.cardSoft, + trackColor = if (calm) com.pulseloop.ui.calm.CalmColors.cardRaised else PulseColors.cardSoft, ) Spacer(Modifier.height(8.dp)) Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp)) { @@ -272,17 +282,20 @@ fun NutritionScreen( val typeMeals = meals.filter { it.mealTypeRaw == type } if (typeMeals.isNotEmpty()) { item { - Text(tr(type.replaceFirstChar { it.uppercase() }), fontWeight = FontWeight.SemiBold, fontSize = 14.sp, color = PulseColors.textSecondary) + if (calm) Text(tr(type.replaceFirstChar { it.uppercase() }), style = com.pulseloop.ui.calm.CalmType.title, color = com.pulseloop.ui.calm.CalmColors.text, modifier = Modifier.padding(top = 8.dp)) + else Text(tr(type.replaceFirstChar { it.uppercase() }), fontWeight = FontWeight.SemiBold, fontSize = 14.sp, color = PulseColors.textSecondary) } items(typeMeals, key = { it.id }) { meal -> - Card(Modifier.fillMaxWidth(), shape = RoundedCornerShape(8.dp), colors = CardDefaults.cardColors(containerColor = PulseColors.card)) { - Row(Modifier.padding(12.dp), verticalAlignment = Alignment.CenterVertically) { + Box(Modifier.fillMaxWidth().lookCard(oldBorder = false)) { + Row(Modifier.padding(start = if (calm) 16.dp else 12.dp, top = 12.dp, bottom = 12.dp, end = 4.dp), verticalAlignment = Alignment.CenterVertically) { Column(Modifier.weight(1f)) { - Text(meal.name, fontWeight = FontWeight.Medium) - Text("${meal.calories.roundToInt()} kcal · P${meal.proteinG.roundToInt()} C${meal.carbsG.roundToInt()} F${meal.fatG.roundToInt()}", fontSize = 12.sp, color = PulseColors.textMuted) + Text(meal.name, fontWeight = FontWeight.Medium, color = com.pulseloop.ui.calm.Look.text) + Text("${meal.calories.roundToInt()} kcal · P${meal.proteinG.roundToInt()} C${meal.carbsG.roundToInt()} F${meal.fatG.roundToInt()}", fontSize = if (calm) 14.sp else 12.sp, color = com.pulseloop.ui.calm.Look.textMuted) } IconButton(onClick = { mealToDelete = meal }) { - Icon(Icons.Filled.Delete, trf("Delete {0}", meal.name), tint = PulseColors.danger, modifier = Modifier.size(20.dp)) + // Quiet in the new look: a red bin on every meal shouted about a rare action. The + // confirm dialog keeps the red. + Icon(Icons.Filled.Delete, trf("Delete {0}", meal.name), tint = if (calm) com.pulseloop.ui.calm.CalmColors.textMuted else PulseColors.danger, modifier = Modifier.size(20.dp)) } } } @@ -292,6 +305,7 @@ fun NutritionScreen( } } + } mealToDelete?.let { meal -> AlertDialog( @@ -735,15 +749,13 @@ private fun NextMealCard( onLog: () -> Unit, onDiscuss: (() -> Unit)?, ) { - Card( - Modifier.fillMaxWidth(), - shape = RoundedCornerShape(8.dp), - colors = CardDefaults.cardColors(containerColor = PulseColors.card), - // Mint is for what's tapped: the card itself isn't, so its frame is the quiet one. - border = androidx.compose.foundation.BorderStroke(1.dp, PulseColors.borderSubtle), - ) { - Column(Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) { - Text(trf("NEXT MEAL IDEA · {0}", idea.slot.uppercase()), style = com.pulseloop.ui.theme.PulseType.eyebrow, color = PulseColors.textSecondary) + val calm = com.pulseloop.ui.calm.NewLook.on + // Mint is for what's tapped: the card itself isn't, so its frame is the quiet one. + Box(Modifier.fillMaxWidth().lookCard()) { + Column(Modifier.padding(if (calm) 20.dp else 16.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) { + // The new look names the card as its heading, in sentence case; the slot follows it. + if (calm) Text(trf("Next meal idea · {0}", tr(idea.slot.replaceFirstChar { it.uppercase() })), style = com.pulseloop.ui.calm.CalmType.title, color = com.pulseloop.ui.calm.CalmColors.text) + else Text(trf("NEXT MEAL IDEA · {0}", idea.slot.uppercase()), style = com.pulseloop.ui.theme.PulseType.eyebrow, color = PulseColors.textSecondary) if (idea.items.isEmpty()) { Text(idea.note ?: "", fontSize = 14.sp, color = PulseColors.textPrimary) } else { diff --git a/app/src/main/java/com/pulseloop/ui/screens/ReadinessUi.kt b/app/src/main/java/com/pulseloop/ui/screens/ReadinessUi.kt index 3a7f964c..2c6c0c76 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/ReadinessUi.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/ReadinessUi.kt @@ -1,5 +1,6 @@ package com.pulseloop.ui.screens +import com.pulseloop.ui.calm.lookCard import com.pulseloop.ui.i18n.trf import com.pulseloop.ui.i18n.tr @@ -249,11 +250,17 @@ fun ReadinessScreen(db: PulseLoopDatabase, onBack: () -> Unit) { val load = rememberReadinessLoad(db, Unit) val result = load.value - Column(Modifier.fillMaxSize()) { - com.pulseloop.ui.components.PulseTopBar(tr("Readiness"), onBack) + val calm = com.pulseloop.ui.calm.NewLook.on + // The new look (docs/new-look-plan.md, "Readiness"): calm bar, page, gutter, 720dp cap, Inter. + com.pulseloop.ui.calm.CalmTypography(enabled = calm) { + Column(Modifier.fillMaxSize().then(if (calm) Modifier.background(com.pulseloop.ui.calm.CalmColors.page) else Modifier)) { + if (calm) com.pulseloop.ui.calm.CalmTopBar(tr("Readiness"), onBack) + else com.pulseloop.ui.components.PulseTopBar(tr("Readiness"), onBack) Column( - Modifier.fillMaxSize().verticalScroll(rememberScrollState()).padding(horizontal = 16.dp, vertical = 8.dp), + Modifier.fillMaxSize().verticalScroll(rememberScrollState()) + .then(if (calm) Modifier.wrapContentWidth().widthIn(max = 720.dp).fillMaxWidth() else Modifier) + .padding(horizontal = if (calm) com.pulseloop.ui.calm.CalmShape.gutter else 16.dp, vertical = 8.dp), verticalArrangement = Arrangement.spacedBy(16.dp), ) { val score = result as? Readiness.Result.Score @@ -266,7 +273,7 @@ fun ReadinessScreen(db: PulseLoopDatabase, onBack: () -> Unit) { centerText = score?.value?.toString() ?: if (load.loaded) "—" else "", ) score?.let { - Text(it.band.label, fontSize = 16.sp, fontWeight = FontWeight.SemiBold, color = bandColor(it.band)) + Text(it.band.label, style = if (calm) com.pulseloop.ui.calm.CalmType.sectionTitle else androidx.compose.ui.text.TextStyle(fontSize = 16.sp, fontWeight = FontWeight.SemiBold), color = bandColor(it.band)) } if (com.pulseloop.service.Postpartum.active()) { Text( @@ -288,8 +295,10 @@ fun ReadinessScreen(db: PulseLoopDatabase, onBack: () -> Unit) { score?.let { ReadinessCopy.coverageNote(it) }?.let { note -> Text( note, fontSize = 14.sp, color = PulseColors.warning, - modifier = Modifier.fillMaxWidth().clip(RoundedCornerShape(4.dp)) - .dither(PulseColors.warning, 0.12f).padding(12.dp), + // The new look's note is a plain raised block; the dither is the old look's. + modifier = Modifier.fillMaxWidth().clip(RoundedCornerShape(if (calm) com.pulseloop.ui.calm.CalmShape.radius else 4.dp)) + .then(if (calm) Modifier.background(com.pulseloop.ui.calm.CalmColors.cardRaised) else Modifier.dither(PulseColors.warning, 0.12f)) + .padding(if (calm) 16.dp else 12.dp), ) } @@ -297,28 +306,29 @@ fun ReadinessScreen(db: PulseLoopDatabase, onBack: () -> Unit) { ContributorsCard(score.contributors.map { it.asScoreContributor() }) if (score.missing.isNotEmpty()) { Text( - tr("Not enough data yet: ") + score.missing.joinToString { it.title.lowercase() } + ".", - fontSize = 12.sp, color = PulseColors.textMuted, + tr("Not enough data yet: ") + score.missing.joinToString { t -> t.title.let { if (it.length > 1 && it[0].isUpperCase() && it[1].isUpperCase()) it else it.lowercase() } } + ".", + fontSize = if (calm) 14.sp else 12.sp, color = com.pulseloop.ui.calm.Look.textMuted, ) } } if (result is Readiness.Result.Withheld) { Column( - Modifier.fillMaxWidth().clip(RoundedCornerShape(8.dp)).background(PulseColors.card).padding(16.dp), + Modifier.fillMaxWidth().lookCard(oldBorder = false).padding(16.dp), verticalArrangement = Arrangement.spacedBy(8.dp), ) { - Text(tr("Why there's no score today"), fontSize = 14.sp, fontWeight = FontWeight.SemiBold, color = PulseColors.textMuted) + Text(tr("Why there's no score today"), fontSize = 14.sp, fontWeight = FontWeight.SemiBold, color = com.pulseloop.ui.calm.Look.textMuted) result.reasons.forEach { Text("• $it", fontSize = 14.sp, color = PulseColors.textSecondary) } } } DataBehindScore(db, result) - Text(ReadinessCopy.DERIVED_FOOTER, fontSize = 12.sp, color = PulseColors.textMuted) + Text(ReadinessCopy.DERIVED_FOOTER, fontSize = 12.sp, color = com.pulseloop.ui.calm.Look.textMuted) Spacer(Modifier.height(24.dp)) } } + } } /** "Contributors" heading and a card of tappable rows; shared by Readiness, Sleep and Activity. */ @@ -327,12 +337,14 @@ fun ContributorsCard(contributors: List, title: String = tr("C if (contributors.isEmpty()) return var expanded by remember(contributors) { mutableStateOf(null) } Column(verticalArrangement = Arrangement.spacedBy(8.dp)) { - Text(title, fontSize = 14.sp, fontWeight = FontWeight.SemiBold, color = PulseColors.textMuted) - Column(Modifier.fillMaxWidth().clip(RoundedCornerShape(8.dp)).background(PulseColors.card)) { + val calm = com.pulseloop.ui.calm.Look.calm + if (calm) Text(title, style = com.pulseloop.ui.calm.CalmType.sectionTitle, color = com.pulseloop.ui.calm.Look.text, modifier = Modifier.padding(top = 16.dp, bottom = 4.dp)) + else Text(title, fontSize = 14.sp, fontWeight = FontWeight.SemiBold, color = PulseColors.textMuted) + Column(Modifier.fillMaxWidth().lookCard(oldBorder = false)) { contributors.forEachIndexed { i, c -> ContributorRow(c, expanded == c.title) { expanded = if (expanded == c.title) null else c.title } if (i < contributors.lastIndex) { - Box(Modifier.fillMaxWidth().height(1.dp).background(PulseColors.borderSubtle)) + Box(Modifier.fillMaxWidth().padding(horizontal = if (calm) 16.dp else 0.dp).height(1.dp).background(com.pulseloop.ui.calm.Look.border)) } } } @@ -349,13 +361,13 @@ private fun ContributorRow(c: ScoreContributor, expanded: Boolean, onTap: () -> verticalArrangement = Arrangement.spacedBy(8.dp), ) { Row(Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically) { - Text(c.title, fontSize = 16.sp, fontWeight = FontWeight.Medium, color = PulseColors.textPrimary, modifier = Modifier.weight(1f)) + Text(c.title, fontSize = 16.sp, fontWeight = FontWeight.Medium, color = com.pulseloop.ui.calm.Look.text, modifier = Modifier.weight(1f)) Text(c.band.label, fontSize = 14.sp, fontWeight = FontWeight.SemiBold, color = bandColor(c.band)) } ProgressBar(c.score / 100f, bandColor(c.band)) - Text(c.detail, fontSize = 12.sp, color = PulseColors.textSecondary) + Text(c.detail, fontSize = 12.sp, color = com.pulseloop.ui.calm.Look.textSecondary) if (expanded) { - Text(c.explanation, fontSize = 14.sp, color = PulseColors.textSecondary, modifier = Modifier.padding(top = 4.dp)) + Text(c.explanation, fontSize = 14.sp, color = com.pulseloop.ui.calm.Look.textSecondary, modifier = Modifier.padding(top = 4.dp)) } } } @@ -439,14 +451,14 @@ private fun DataBehindScore(db: PulseLoopDatabase, result: Readiness.Result?) { value = runCatching { com.pulseloop.service.ReadinessRepository.loadInputs(db) }.getOrNull() } Column( - Modifier.fillMaxWidth().clip(RoundedCornerShape(8.dp)).background(PulseColors.card) + Modifier.fillMaxWidth().lookCard(oldBorder = false) .clickable(role = Role.Button, onClickLabel = if (open) tr("Hide") else tr("Show")) { open = !open } .semantics { stateDescription = if (open) tr("Expanded") else tr("Collapsed") } .padding(16.dp), verticalArrangement = Arrangement.spacedBy(8.dp), ) { Row(Modifier.heightIn(min = 24.dp), verticalAlignment = Alignment.CenterVertically) { - Text(tr("Data behind this score"), fontSize = 14.sp, fontWeight = FontWeight.Medium, color = PulseColors.textPrimary, modifier = Modifier.weight(1f)) + Text(tr("Data behind this score"), fontSize = 14.sp, fontWeight = FontWeight.Medium, color = com.pulseloop.ui.calm.Look.text, modifier = Modifier.weight(1f)) Text(if (open) tr("Hide") else tr("Show"), fontSize = 14.sp, color = PulseColors.accent) } if (open) { diff --git a/audits/2026-11-16-new-look-nutrition-myhealth-readiness.md b/audits/2026-11-16-new-look-nutrition-myhealth-readiness.md new file mode 100644 index 00000000..888a2c28 --- /dev/null +++ b/audits/2026-11-16-new-look-nutrition-myhealth-readiness.md @@ -0,0 +1,69 @@ +# Audit: Nutrition, My Health and Readiness in the new look (2.16.14) + +Date: 2026-11-16 · PR: see the PR linking this file · Auditor: Claude Code, with impeccable loaded +for this pass (`impeccable context` with PRODUCT.md, `audit.native.md`, `critique-rubric.md`, +`craft-floor.md`, `polish.md`, `android.md`). Native: design review only, detector not applicable. +No emulator here: findings from source; the on-device check is owed. ux-user-flows, +graphic-design-fundamentals and less-is-more applied by hand from their SKILL.md files. + +## Scope + +All behind Debug → New look; the current look is unchanged (every shared change keeps the old +look's values, `lookCard(oldBorder = false)` where an old card had no hairline). + +- **Shared, so several screens move at once:** `Look` (surface and text roles of whichever look is + on) and `lookCard()`. My Health's `Section` (calm card, sentence-case heading instead of a caps + eyebrow), `Fact`, the My Health entry card (also at the end of Vitals, Sleep and Activity: one + NL-4 item closed), and `ContributorsCard` (Readiness, Sleep, Activity: a section title and a calm + card with inset dividers). +- **Readiness:** calm top bar, page, gutter, 720dp cap, Inter; the band word in `sectionTitle`; + the coverage note a plain raised block instead of a dithered one; the no-score and + data-behind cards on the calm surface. +- **My Health:** calm top bar (share kept), page, gutter, cap, Inter; health-area titles in Inter; + the Symptom Radar row a calm card. +- **Nutrition:** calm bar (pushed) or none (tab), page, gutter, cap, Inter; the day's total in + `CalmType.score`; meal type headings; meal rows on the calm surface; the next-meal card led by + "Next meal idea · Lunch" instead of a caps kicker. + +## impeccable + +### Findings and fixes +| Screen | Sev | Finding | Fix | +|---|---|---|---| +| Readiness | P1 | "Not enough data yet: hrv balance": acronyms lower-cased | Acronyms kept | +| Nutrition | P1 | "NEXT MEAL IDEA · LUNCH" kicker over the card's content | Heading in sentence case | +| Nutrition | P2 | A red bin on every meal row shouted about a rare action (quieter) | Muted in the new look; the confirm dialog keeps the red | +| My Health | P2 | Section names were caps eyebrows above their own content | Sentence-case headings | +| Readiness | P2 | The coverage note's dither was the old look's | Plain raised block | +| All | P2 | Still old-styled: Nutrition's Log meal button and macro bars, My Health's trend charts, breathing sheet and habits, the Readiness ring's drawing (NL-4) | Carried forward | +| Readiness | P3 | The score is centred while Today leads left-aligned | Kept: a detail screen's hero; revisit when the default flips | + +### Scores after the fixes +| Screen | Audit (A11y · Perf · Theme · Conform · Adapt) | Critique /40 | Cognitive load failures | +|---|---|---|---| +| Readiness | 3 · 4 · 3 · 4 · 4 = 18/20 | 32 | 0 | +| My Health | 3 · 4 · 3 · 4 · 4 = 18/20 | 30 (many sections; folded ones help) | 1 (sections compete below the fold) | +| Nutrition | 3 · 4 · 3 · 4 · 4 = 18/20 | 32 | 0 | + +No P0 or P1 left. + +## ux-user-flows +No flow changes: same entries, logging paths (Log meal, photo, describe, next-meal idea), deletes +with confirm, Rest Mode, Share my week, contributor rows that expand. States unchanged (loading +holds height, empty day says so). + +## graphic-design-fundamentals +Hierarchy: one statement per screen (readiness score, the day's kcal). Contrast: calm tokens. +Typography: Inter, sizes on the scale. Colour: band colours with their words; red only for the +destructive confirmation. Consistency: one card surface, shared by all converted tabs. + +## less-is-more +Removed in the new look: caps eyebrows and kickers, a dithered note, red bins. Nothing added. +Taps on common actions unchanged (log a meal 1, open readiness 1, open a section 1). + +## Evidence +pt-BR: "{0} kcal", "Next meal idea · {0}" added; caption updated. Canvas boards owed (tools not +connected). No device here. + +## Verdict +Merge (behind the switch). Carried forward: NL-4 remainder, canvas boards, on-device check. diff --git a/docs/new-look-plan.md b/docs/new-look-plan.md index 13bb5644..884609c9 100644 --- a/docs/new-look-plan.md +++ b/docs/new-look-plan.md @@ -98,4 +98,10 @@ balance card and the My Health entry card. Every converted screen gets an impeccable pass (audit, critique, polish) before it ships; Vitals and Sleep had theirs redone in `audits/2026-11-16-impeccable-pass-vitals-sleep-activity.md`. +- **Nutrition, My Health, Readiness** (behind the switch). Shared pieces moved first, through + `Look` / `lookCard()` (calm/Look.kt): My Health's `Section` and `Fact`, the My Health entry card + (also on Vitals, Sleep and Activity) and `ContributorsCard` (Readiness, Sleep, Activity). Then + each screen's bar, page, gutter, cap and Inter, the readiness band word, the day's kcal as the + statement, and sentence-case headings where caps kickers were. Audit: + `audits/2026-11-16-new-look-nutrition-myhealth-readiness.md`.