Skip to content

Conversation

@marcuscastelo
Copy link
Owner

This PR refactors the CopyLastDayButton component to improve the user experience when copying a previous days diet:

  • Replaces the datepicker with a list that displays only days with a registered diet.
  • Each available day now shows a summary and a dedicated copy action.
  • Adds a fallback message when no days are available to copy.
  • Adds the date-fns dependency for date formatting.
  • Updates styles and documentation to reflect the new behavior.

This change streamlines the copy workflow, making it easier for users to find and copy relevant days. No breaking changes are introduced.

closes #774

…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
Copilot AI review requested due to automatic review settings June 13, 2025 00:02
@vercel
Copy link

vercel bot commented Jun 13, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
marucs-diet ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 13, 2025 1:39am

@github-actions github-actions bot added complexity-low Low implementation complexity feature Request or implement a new feature ui UI/UX related issue or improvement labels Jun 13, 2025

This comment was marked as outdated.

…nd improve error context propagation

- Introduce WeightNotFoundForDayError and MacroTargetNotFoundForDayError in macroTarget.ts
- Enhance errorMessageHandler to include all custom error properties in toast context
Copy link
Contributor

Copilot AI left a 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 PreviousDayCard entries.
  • Moves copy logic into CopyLastDayModal/CopyLastDayButton and adds loading state.
  • Updates DayMacros to use a memoized error-aware result and adds date-fns for 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 CopyLastDayModal to verify the fallback message when previousDays is empty and correct rendering of cards when days are available.
<Show

@marcuscastelo marcuscastelo merged commit 82e9c7f into rc/v0.12.0 Jun 13, 2025
7 checks passed
@marcuscastelo marcuscastelo deleted the marcuscastelo/issue774 branch June 13, 2025 01:39
@marcuscastelo marcuscastelo mentioned this pull request Jun 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

complexity-low Low implementation complexity feature Request or implement a new feature ui UI/UX related issue or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Filter datepicker in 'copy previous day' button to show only days with available diet

2 participants