-
Notifications
You must be signed in to change notification settings - Fork 0
Refactor CopyLastDayButton: show only days with registered diet and add summary copy list #775
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…et, add summary list and copy action - Replace datepicker with a list of days with registered diet in CopyLastDayButton - Show summary and copy button for each available day - Add fallback message when no days are available to copy - Add date-fns dependency for date formatting - Update styles and docs for new behavior
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
…onents, use Accessor/Setter for modal state
…rate components for clarity
…nd improve error context propagation - Introduce WeightNotFoundForDayError and MacroTargetNotFoundForDayError in macroTarget.ts - Enhance errorMessageHandler to include all custom error properties in toast context
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Refactors the “copy last day” workflow by replacing the datepicker with a list of days that have diets, adding per-day summaries and copy actions, and providing a no-data fallback.
- Replaces the datepicker UI with a scrollable list of
PreviousDayCardentries. - Moves copy logic into
CopyLastDayModal/CopyLastDayButtonand adds loading state. - Updates
DayMacrosto use a memoized error-aware result and addsdate-fnsfor formatting.
Reviewed Changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/sections/day-diet/components/CopyLastDayButton.tsx | Removes datepicker, adds CopyLastDayModal integration |
| src/sections/day-diet/components/CopyLastDayModal.tsx | New modal listing only days with registered diets |
| src/sections/day-diet/components/PreviousDayCard.tsx | Displays formatted date and opens details modal |
| src/sections/day-diet/components/PreviousDayCardActions.tsx | Separates “view” and “copy” buttons with loading state |
| src/sections/day-diet/components/PreviousDayDetailsModal.tsx | New component showing daily summary |
| src/sections/day-diet/components/DayMacros.tsx | Refactors to createMemo with structured error result |
| src/modules/diet/macro-target/application/macroTarget.ts | Adds custom error classes for weight/macro-target |
| src/modules/toast/domain/errorMessageHandler.ts | Includes custom error properties in toast context |
| package.json | Adds date-fns dependency |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (2)
src/sections/day-diet/components/DayMacros.tsx:15
- [nitpick] The name 'macroSignals' suggests a reactive signal but this memo returns macro data; consider renaming to 'macroData' or 'macroResult' for clarity.
const macroSignals = createMemo(() => {
src/sections/day-diet/components/CopyLastDayModal.tsx:25
- Add unit tests for
CopyLastDayModalto verify the fallback message whenpreviousDaysis empty and correct rendering of cards when days are available.
<Show
…day found to copy
…usDayCard using MacroNutrientsView
This PR refactors the
CopyLastDayButtoncomponent to improve the user experience when copying a previous days diet:date-fnsdependency for date formatting.This change streamlines the copy workflow, making it easier for users to find and copy relevant days. No breaking changes are introduced.
closes #774