Skip to content

Make workout template comments editable#1731

Merged
IgnisDa merged 2 commits intomainfrom
IgnisDa/issue1728
Mar 22, 2026
Merged

Make workout template comments editable#1731
IgnisDa merged 2 commits intomainfrom
IgnisDa/issue1728

Conversation

@IgnisDa
Copy link
Copy Markdown
Owner

@IgnisDa IgnisDa commented Mar 22, 2026

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

    • Hide calories input when creating templates to prevent irrelevant fields.
  • Improvements

    • "Additional details" link is always visible and opens a consolidated modal.
    • Modal content and the free-text placeholder now adapt to whether a template is being created.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 22, 2026

Walkthrough

Renames and re-wires the additional-details modal state, always exposes the "More Information" link, omits the calories NumberInput when creating a template, and makes the Textarea placeholder conditional on props.isCreatingTemplate.

Changes

Cohort / File(s) Summary
Fitness action miscellaneous component
apps/frontend/app/components/routes/fitness.action/miscellaneous.tsx
Renamed modal state from isCaloriesBurntModalOpen/setIsCaloriesBurntModalOpen to isExtraInformationModalOpen/setIsExtraInformationModalOpen and wired opened/onClose. Always render the "More Information" Anchor. Render the caloriesBurnt NumberInput only when !props.isCreatingTemplate. Make Textarea placeholder vary by props.isCreatingTemplate.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly describes the main change: enabling comment editing for workout templates, which matches the primary objective of the PR.
Linked Issues check ✅ Passed The code changes enable editing of template comments by adding a modal and conditional rendering of the textarea based on template creation mode, fulfilling issue #1728's requirement.
Out of Scope Changes check ✅ Passed All changes are scoped to the miscellaneous modal component and directly support the objective of making template comments editable with no unrelated modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch IgnisDa/issue1728

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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 | 🟠 Major

Reorder hook declarations to match project ordering rule

The sequence of hook declarations is not in ascending line-length order (isExtraInformationModalOpen is declared before the shorter caloriesBurnt declaration).

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7da0e5d and 0c9fb31.

📒 Files selected for processing (1)
  • apps/frontend/app/components/routes/fitness.action/miscellaneous.tsx

@IgnisDa IgnisDa merged commit 28fab1b into main Mar 22, 2026
14 checks passed
@IgnisDa IgnisDa deleted the IgnisDa/issue1728 branch March 22, 2026 13:57
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.

Make possible to edit workout template comments

1 participant