Skip to content

feat(1050): hightlight usage for food deletion#1196

Open
Sim-sat wants to merge 1 commit intoCodeWithCJ:mainfrom
Sim-sat:feat-1050
Open

feat(1050): hightlight usage for food deletion#1196
Sim-sat wants to merge 1 commit intoCodeWithCJ:mainfrom
Sim-sat:feat-1050

Conversation

@Sim-sat
Copy link
Copy Markdown
Contributor

@Sim-sat Sim-sat commented Apr 24, 2026

Description

What problem does this PR solve?
When deleting a food it's hard to know where it was used.

How did you implement the solution?
Return the foods that are used and make it possible to jump to the date in diary with the query parameter date. This feature could also be used for exercises or other stuff in the future.

Linked Issue: Closes #1050

How to Test

  1. Log food
  2. Delete food
  3. See deletion option and jump to the correct date in the diary and the food is highlighted

PR Type

  • Issue (bug fix)
  • New Feature
  • Refactor
  • Documentation

Checklist

All PRs:

  • [MANDATORY - ALL] Integrity & License: I certify this is my own work, free of malicious code, and I agree to the License terms.

New features only:

  • [MANDATORY for new feature] Alignment: I have raised a GitHub issue and it was reviewed/approved by maintainers or it was approved on Discord.

Frontend changes (SparkyFitnessFrontend/ or src/):

  • [MANDATORY for Frontend changes] Quality: I have run pnpm run validate and it passes.
  • [MANDATORY for Frontend changes] Translations: I have only updated the English (en) translation file.

Backend changes (SparkyFitnessServer/):

  • [MANDATORY for Backend changes] Code Quality: I have run typecheck, lint, and tests. New files use TypeScript, new endpoints have Zod schemas, and new endpoints include tests.
  • [MANDATORY for Backend changes] Database Security: I have updated rls_policies.sql for any new user-specific tables.

UI changes (components, screens, pages):

  • [MANDATORY for UI changes] Screenshots: I have attached Before/After screenshots below.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request enhances the food deletion workflow by providing a detailed, collapsible list of diary entries where a food item is used, including deep links to view specific entries. It also introduces URL-based date selection and item highlighting in the diary view. Feedback focuses on improving type safety with type guards in MealCard.tsx, using the Link component for better SPA navigation, restoring internationalization and pluralization for usage counts, and cleaning up server-side data mapping where unselected fields were being processed.

Comment thread SparkyFitnessFrontend/src/pages/Diary/MealCard.tsx Outdated
Comment thread SparkyFitnessFrontend/src/pages/Foods/Foods.tsx Outdated
Comment thread SparkyFitnessFrontend/src/pages/Foods/Foods.tsx
Comment thread SparkyFitnessServer/models/food.ts
@Sim-sat Sim-sat force-pushed the feat-1050 branch 2 times, most recently from 0707388 to c821103 Compare April 24, 2026 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: When deleting a food, if used, offer replacement and/or direct links to uses

1 participant