Streak strip off-by-one fix + carry saved favorite names through logging#203
Merged
Conversation
The week strip only receives the streak length and inferred on-track past days as offsets 1..days. Because the backend streak count includes today when today is on track, this double-counts today and lights one extra past day that never met the threshold (e.g. yesterday glowing at a 1-day streak). Subtract today's own contribution from the streak before deciding how many past squares to light, so past days reflect the actual contiguous run.
Whenever a meal is pulled from a saved favorite, its name now flows into the meal name field instead of being dropped: - /log/meals/frequent returns a `name` per suggestion, resolved from the saved favorite (via favorite_id) or a meaningful raw_input. QuickTab shows it as the card title and a Re-log prepopulates the name field. - Budget checker (NutritionCalculatorCard) sets the meal name when a favorite is selected. - LogSheet search now surfaces matching favorites at the top of results; tapping one adds its items and fills the name. Name fields are only prepopulated when empty so typed input is never clobbered.
Extend the favorites-at-top-of-search treatment to the two remaining meal builders: the Today budget checker (NutritionCalculatorCard) and the meals-page Calculator tab (which reuses IngredientBuilder). Matching favorites appear above food results; tapping one drops in its items and prefills the meal name when empty. The meals-page Foods tab is intentionally left as a browse-only nutrition reference — it has no meal-building action for a favorite to feed.
Coordinate and enrich the rings/gauges card (Tier A+B) within the brand's restraint (BRAND-GUIDE §12 — no springs/shimmer/large entrances): - ActivityRings: fills animate on mount AND on data change (stroke-dashoffset now transitions, so logging a meal smoothly advances the arc instead of snapping), staggered outer→inner. Adds a lit progress-cap bead riding each arc's leading edge and per-ring colored drop-shadow glow. - MacroBar: new component for the calorie/protein gauges — animates width from empty on mount and transitions on change, matching the rings' curve/duration. Replaces the duplicated inline bars in both desktop and mobile layouts. - usePrefersReducedMotion hook + reduced-motion guards: motion collapses to the final state instantly when the user prefers reduced motion. - Motion tokens (--ease-ring, --duration-slow) centralized in index.css. No new dependencies (pure SVG/CSS + rAF).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two related Today-screen fixes on this branch.
1. Streak strip lit an extra past day
The Current Streak widget lit a day that was never on track (e.g. Friday glowing at a 1-day streak).
StreakStrip.tsxonly receivesdays(the streak length) and inferred past on-track squares asoffset <= days, but the backend streak count includes today when today is on track — so it double-counted today and lit one extra past day. Fix subtracts today's own contribution before lighting past squares.2. Saved favorite names now flow into the meal name field
Anytime a meal is pulled from a saved favorite, its name now follows it instead of being dropped:
GET /log/meals/frequentreturns anameper suggestion, resolved from the saved favorite (viafavorite_id) or a meaningfulraw_input(generic "Manual log" stays unnamed).QuickTabshows it as the card title (ingredient list demoted to a subtitle), and Re-log prepopulates the name field.NutritionCalculatorCardnow sets the meal name.Name fields are only prepopulated when empty, so typed input is never clobbered.
Testing
mypy luma --ignore-missing-importsclean;pytest183 passed (added 2 cases for the newnamefield on/log/meals/frequent)pnpm type-checkclean,pnpm lintexit 0,pnpm test97 passedNote on scope
The favorites-in-search treatment was added to the LogSheet search box (the primary one). I can extend the same merge to the budget checker's search field if you'd like — say the word.
https://claude.ai/code/session_0143KxF5kFKX9bAkdeUGJxYz