Conversation
WalkthroughRenames and re-wires the additional-details modal state, always exposes the "More Information" link, omits the calories Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/frontend/app/components/routes/fitness.action/miscellaneous.tsx (1)
53-58: 🛠️ Refactor suggestion | 🟠 MajorReorder hook declarations to match project ordering rule
The sequence of hook declarations is not in ascending line-length order (
isExtraInformationModalOpenis declared before the shortercaloriesBurntdeclaration).Proposed reorder
const [name, setName] = useDebouncedState(currentWorkout.name, 500); const [comment, setComment] = useDebouncedState(currentWorkout.comment, 500); -const [isExtraInformationModalOpen, setIsExtraInformationModalOpen] = - useState(false); const [caloriesBurnt, setCaloriesBurnt] = useDebouncedState( currentWorkout.caloriesBurnt, 500, ); +const [isExtraInformationModalOpen, setIsExtraInformationModalOpen] = + useState(false);As per coding guidelines, "When declaring multiple variables in sequence (particularly React hooks), order them by ascending line length."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/frontend/app/components/routes/fitness.action/miscellaneous.tsx` around lines 53 - 58, The two hook declarations are out of the project's ascending line-length ordering rule; move the shorter declaration for caloriesBurnt/setCaloriesBurnt (using useDebouncedState with currentWorkout.caloriesBurnt) before the longer isExtraInformationModalOpen/setIsExtraInformationModalOpen (useState) so hooks are declared in ascending line-length order, keeping the same hook calls and variable names (caloriesBurnt, setCaloriesBurnt, useDebouncedState, isExtraInformationModalOpen, setIsExtraInformationModalOpen, useState).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/frontend/app/components/routes/fitness.action/miscellaneous.tsx`:
- Around line 94-101: The calories field is hidden in template mode but its
value (currentWorkout.caloriesBurnt) still gets included in the submit payload;
update the payload mapping function (currentWorkoutToCreateWorkoutInput) to
conditionally omit or set caloriesBurnt to undefined when
props.isCreatingTemplate is true so templates never persist stale calories.
Locate where currentWorkout is transformed for submit
(currentWorkoutToCreateWorkoutInput) and add a branch that excludes or clears
the caloriesBurnt property when isCreatingTemplate/props.isCreatingTemplate is
truthy.
---
Outside diff comments:
In `@apps/frontend/app/components/routes/fitness.action/miscellaneous.tsx`:
- Around line 53-58: The two hook declarations are out of the project's
ascending line-length ordering rule; move the shorter declaration for
caloriesBurnt/setCaloriesBurnt (using useDebouncedState with
currentWorkout.caloriesBurnt) before the longer
isExtraInformationModalOpen/setIsExtraInformationModalOpen (useState) so hooks
are declared in ascending line-length order, keeping the same hook calls and
variable names (caloriesBurnt, setCaloriesBurnt, useDebouncedState,
isExtraInformationModalOpen, setIsExtraInformationModalOpen, useState).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 0de28b90-4b50-45c6-bb28-1224935c5a8c
📒 Files selected for processing (1)
apps/frontend/app/components/routes/fitness.action/miscellaneous.tsx
Enable direct editing of comments in workout templates, simplifying the user experience by removing the need to create a new workout to modify comments. This change addresses the issue of cumbersome comment management in workout templates.
Fixes #1728
Summary by CodeRabbit
Bug Fixes
Improvements