Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 32 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,30 @@ sources: `docs/postpartum-breastfeeding-research.md`.
switching off takes exactly that back.
- **No F*cking Health jokes here**: postpartum text is on the voice's safety list.

## The design files and the app move together, both ways

**Every change to the app's UI updates the design files in the same piece of work, and every
change agreed on the design files is built into the app.** The owner reviews and annotates the
app on a Claude Design canvas, so a canvas that drifts from the app sends feedback against
screens that no longer exist, and an app change missing from the canvas is invisible in review.

- **The canvas:** https://claude.ai/artifact/CUizVK8X1fJsNQ7kxUeiEg — one artboard per screen
(`project/<Screen>.dc.html`), rows grouped by user journey with "how you get here" notes, and a
`FlowMap.dc.html` artboard whose lanes and arrows follow the navigation. A new screen gets a
board, a slot in its journey's row, a note, and a card in the flow map; a removed or renamed
screen loses or renames all four. Links between boards (`<a href="X.dc.html">`) follow the
app's real navigation.
- **The design system:** https://claude.ai/artifact/P1nRuiJhuffYq9pnNbHe5q — tokens from
`ui/theme/PulseColors.kt`, the Bayer dither from `ui/theme/Dither.kt`, Ubuntu Mono, and the
web components the canvas mounts. A token, colour, type size or dither coverage changed in
`ui/theme/` is changed there too, and the canvas's copy (`project/ds/pulseloop/`) is refreshed.
- **Design → app:** an annotation or design edit the owner agrees to is implemented in Compose,
released through the normal flow, and only then reported as done.
- **Read before writing.** The owner edits the canvas by hand; read the boards you will change
from the canvas first and edit those, never republish an older local copy over them.
- If a session cannot reach the canvas, say so in the PR description instead of skipping it
silently.

## Where things live: intent first, then overview → detail

**Read this before adding a card, a row or a screen.** The app is organised in two layers, and most
Expand All @@ -1119,9 +1143,14 @@ clutter came from ignoring one of them:
- **Where a thing lives follows what the user came to do.** Logging (meal, drink, dose, period,
tags, workout) is one job, so it has one door: the "Actions" button on every tab
(`LogSheet`, opened through `LaunchRequests.openLog`). Today's Meal/Drink chips open the same
sheet at a step; don't grow a second logging path on a new screen. Earlier days belong to the
same door: "For an earlier day" sends a meal to the Nutrition tab's day arrows, "Past workout"
opens the past-activity form.
sheet at a step; don't grow a second logging path on a new screen. The sheet is for **now**:
Ask the coach, then meal, drink and medicine as one row of icons (the same kind of entry, so
side by side), Period only for a profile whose sex is `"female"`, tags, and starting a workout.
- **A past entry is added on its own screen, never from the Actions sheet.** A past workout comes
from Activity's "Log Past Activity", a past meal from the Nutrition tab's day arrows, a past
period from Cycle. The owner asked for exactly this after the sheet briefly grew "For an earlier
day" and "Past workout" rows: the sheet stops being one short list the moment it grows a "past"
twin of each action.
- **The tabs are Today, Vitals, Activity, Sleep, Nutrition.** Nutrition took the Coach's tab
because seeing and back-filling meals was buried; the coach is the first row of the Actions
sheet and a pushed screen with its own back arrow. Don't put it back on the bar to "restore" it. Programs the user switched on
Expand Down
6 changes: 2 additions & 4 deletions app/src/main/assets/i18n/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,6 @@
"Folder: {0}": "Pasta: {0}",
"Follicular": "Folicular",
"Food the user logged themselves; totals are only as complete as the log.": "Alimentos que o usuário registrou; os totais são tão completos quanto o registro.",
"For an earlier day": "Para um dia anterior",
"For drinks, money and calories saved": "Para bebidas, dinheiro e calorias economizados",
"For my next meal ({0}) you suggested: ": "Para minha próxima refeição ({0}) você sugeriu: ",
"For {0}h asleep before your usual {1}": "Para {0}h de sono antes do seu horário habitual {1}",
Expand Down Expand Up @@ -886,6 +885,7 @@
"Medication or supplement": "Medicamento ou suplemento",
"Medication reminders": "Lembretes de medicamentos",
"Medications & supplements": "Medicamentos e suplementos",
"Medicine": "Remédio",
"Medicines while breastfeeding": "Medicamentos na amamentação",
"Meditation or relaxing": "Meditação ou relaxamento",
"Meds · {0} of {1}": "Remédios · {0} de {1}",
Expand Down Expand Up @@ -1041,7 +1041,6 @@
"On. PulseLoop syncs your ring about every 30 minutes, even while the phone is idle.": "Ativado. O PulseLoop sincroniza seu anel a cada 30 minutos, mesmo com o celular ocioso.",
"Once per dose, at its time, for what you add with + Log → Medication or supplement.": "Uma vez por dose, no horário, para o que você adicionar em + Registrar → Medicamento ou suplemento.",
"One tap for the usual ones": "Um toque para as de sempre",
"One you already did, with its time and length": "Um que você já fez, com horário e duração",
"Only needed if you started the server with --api-key. Leave blank otherwise.": "Só é necessário se você iniciou o servidor com --api-key. Caso contrário, deixe em branco.",
"Only new data from now on": "Apenas dados novos daqui em diante",
"Only providers that don't retain data": "Apenas provedores que não retêm dados",
Expand Down Expand Up @@ -1086,7 +1085,6 @@
"Pair your ring first.": "Pareie seu anel primeiro.",
"Pair your ring first: a check compares it against the other device.": "Pareie seu anel primeiro: a verificação o compara com o outro dispositivo.",
"Past checks": "Verificações anteriores",
"Past workout": "Treino passado",
"Patinho moído": "Patinho moído",
"Pause": "Pausar",
"Paused by the accuracy check": "Pausado pela verificação de precisão",
Expand All @@ -1107,7 +1105,6 @@
"Photo": "Foto",
"Photo, barcode or by hand": "Foto, código de barras ou à mão",
"Physiology": "Fisiologia",
"Pick the day in Nutrition, then add it there": "Escolha o dia em Nutrição e adicione lá",
"Pick the left and right PulseLoop metrics.": "Escolha as métricas do PulseLoop da esquerda e da direita.",
"Pick the number before the first drink. It's easier to keep a number you chose beforehand.": "Escolha o número antes da primeira dose. É mais fácil cumprir um número que você definiu antes.",
"Pick which PulseLoop metric this widget shows.": "Escolha qual métrica do PulseLoop este widget mostra.",
Expand Down Expand Up @@ -1406,6 +1403,7 @@
"Start with recommended targets. You can change these anytime.": "Comece com as metas recomendadas. Você pode alterá-las a qualquer momento.",
"Start: {0}": "Início: {0}",
"Started": "Iniciado",
"Started or ended today": "Começou ou terminou hoje",
"Started or ended today, or a past one": "Começou ou terminou hoje, ou uma anterior",
"Starts": "Início",
"Steady build": "Evolução constante",
Expand Down
8 changes: 0 additions & 8 deletions app/src/main/java/com/pulseloop/ui/PulseLoopApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -878,14 +878,6 @@ fun PulseLoopApp() {
onDismiss = ::close,
onCoach = { close(); navController.navigate("coach") { launchSingleTop = true } },
onMeal = { start -> close(); navController.navigate("nutrition/$start") },
onEarlierMeal = {
close()
navController.navigate("nutrition") {
popUpTo(navController.graph.startDestinationId)
launchSingleTop = true
}
},
onPastWorkout = { close(); navController.navigate("log_past_activity") },
onMoreDrinks = { close(); navController.navigate("drinks") },
onMeds = { close(); navController.navigate("meds") },
onPeriod = { close(); navController.navigate("cycle") },
Expand Down
42 changes: 31 additions & 11 deletions app/src/main/java/com/pulseloop/ui/screens/LogSheet.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import androidx.compose.material.icons.filled.Restaurant
import androidx.compose.material.icons.filled.WaterDrop
import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.AutoAwesome
import androidx.compose.material.icons.filled.History
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.ModalBottomSheet
Expand Down Expand Up @@ -55,8 +54,10 @@ enum class LogStep { MENU, MEAL, DRINK, TAGS }
* every tab. Logging is the most frequent thing people do in the app, and it used to live on six
* different screens; the coach moved here when Nutrition took its tab.
*
* An earlier day is part of the menu, not hidden in a screen: a meal goes to the Nutrition tab,
* whose day arrows choose the day it is saved to, and a past workout opens its own form.
* Everything here is for now. Adding something to an earlier day happens on that thing's own
* screen (the Nutrition tab's day arrows, Activity's "Log Past Activity", Cycle's past period),
* so the sheet stays one short list. Meal, drink and medicine share one row of icons because
* they are the same kind of entry; Period is offered only to a profile set to female.
*
* Meals, drinks and day tags are logged inside the sheet. Medications, periods and workouts open
* their own screens, whose first block is the action, because they need more than one tap.
Expand All @@ -69,15 +70,16 @@ fun LogSheet(
onDismiss: () -> Unit,
onCoach: () -> Unit,
onMeal: (start: String) -> Unit,
onEarlierMeal: () -> Unit,
onPastWorkout: () -> Unit,
onMoreDrinks: () -> Unit,
onMeds: () -> Unit,
onPeriod: () -> Unit,
onWorkout: () -> Unit,
onSeeEffects: () -> Unit,
) {
var step by remember(start) { mutableStateOf(start) }
// Unknown until the profile is read, and hidden meanwhile: a row that appears late is better
// than one that vanishes under the user's thumb.
val isFemale by produceState(false, db) { value = db.userProfileDao().get()?.sex == "female" }
ModalBottomSheet(
onDismissRequest = onDismiss,
sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true),
Expand All @@ -104,20 +106,20 @@ fun LogSheet(
LogStep.MENU -> {
Text(tr("Actions"), fontSize = 18.sp, fontWeight = FontWeight.Bold, color = PulseColors.textPrimary)
SheetOption(tr("Ask the coach"), tr("About your day, a plan, a meal idea"), Icons.Filled.AutoAwesome, onCoach)
SheetOption(tr("Meal"), tr("Photo, barcode or by hand"), Icons.Filled.Restaurant) { step = LogStep.MEAL }
SheetOption(tr("Drink"), tr("One tap for the usual ones"), Icons.Filled.LocalBar) { step = LogStep.DRINK }
SheetOption(tr("Medication or supplement"), tr("Mark today's doses"), Icons.Filled.Medication, onMeds)
SheetOption(tr("Period"), tr("Started or ended today, or a past one"), Icons.Filled.WaterDrop, onPeriod)
Row(Modifier.fillMaxWidth().height(IntrinsicSize.Min), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
IconAction(tr("Meal"), Icons.Filled.Restaurant, PulseColors.calories) { step = LogStep.MEAL }
IconAction(tr("Drink"), Icons.Filled.LocalBar, PulseColors.drinks) { step = LogStep.DRINK }
IconAction(tr("Medicine"), Icons.Filled.Medication, PulseColors.info, onMeds)
}
if (isFemale) SheetOption(tr("Period"), tr("Started or ended today"), Icons.Filled.WaterDrop, onPeriod)
SheetOption(tr("Tag your day"), tr("Alcohol, stress, a late meal…"), Icons.Filled.LocalOffer) { step = LogStep.TAGS }
SheetOption(tr("Workout"), tr("Start one now"), Icons.Filled.DirectionsRun, onWorkout)
SheetOption(tr("Past workout"), tr("One you already did, with its time and length"), Icons.Filled.History, onPastWorkout)
}
LogStep.MEAL -> {
Text(tr("Log a meal"), fontSize = 18.sp, fontWeight = FontWeight.Bold, color = PulseColors.textPrimary)
SheetOption(tr("Photo"), tr("Snap your plate; the AI estimates it"), Icons.Filled.CameraAlt) { onMeal("photo") }
SheetOption(tr("Barcode"), tr("Scan a packaged food"), Icons.Filled.QrCodeScanner) { onMeal("barcode") }
SheetOption(tr("Add by hand"), tr("Type the name and calories"), Icons.Filled.Add) { onMeal("add") }
SheetOption(tr("For an earlier day"), tr("Pick the day in Nutrition, then add it there"), Icons.Filled.History, onEarlierMeal)
}
LogStep.DRINK -> QuickDrinks(db, onMoreDrinks)
LogStep.TAGS -> JournalTagsCard(db, java.time.LocalDate.now(), tr("Tag your day"), allowYesterday = true) {
Expand All @@ -137,6 +139,24 @@ fun LogSheet(
}
}

/** One of the icon-and-word buttons that share the top row: the same kind of entry, side by side. */
@Composable
private fun RowScope.IconAction(label: String, icon: androidx.compose.ui.graphics.vector.ImageVector, tint: androidx.compose.ui.graphics.Color, onClick: () -> Unit) {
val shape = RoundedCornerShape(8.dp)
Column(
Modifier.weight(1f).fillMaxHeight().heightIn(min = 72.dp).clip(shape)
.background(PulseColors.card)
.border(1.dp, PulseColors.borderSubtle, shape)
.clickable(role = Role.Button, onClick = onClick)
.padding(horizontal = 4.dp, vertical = 12.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(6.dp, Alignment.CenterVertically),
) {
Icon(icon, null, tint = tint, modifier = Modifier.size(26.dp))
Text(label, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, color = PulseColors.textPrimary, textAlign = TextAlign.Center, maxLines = 1, overflow = TextOverflow.Ellipsis)
}
}

/** The four usual drinks, one tap each, with an undo; everything else is on the Drinks screen. */
@Composable
private fun QuickDrinks(db: PulseLoopDatabase, onMore: () -> Unit) {
Expand Down
Loading