Skip to content

fix: change text - #839

Closed
JulioSergioFS wants to merge 4 commits into
developmentfrom
change-text
Closed

fix: change text#839
JulioSergioFS wants to merge 4 commits into
developmentfrom
change-text

Conversation

@JulioSergioFS

@JulioSergioFS JulioSergioFS commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Bug Fixes

    • Clarified stash messaging and updated the pop action label to “Apply & remove”.
    • Prevented oversized read-only modal by improving centering, sizing, and internal scrolling.
  • UI Changes

    • Hide branch write actions and “create new branch” when workspace is read-only.
    • Remove file-level rename/delete/duplicate menu items in read-only projects.
    • Gate “Restore to This Version” to show the read-only modal when applicable.
  • Behavior

    • Create-element popover and editors now open and are interactive without forcing a read-only modal.

@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@JulioSergioFS, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 7 minutes and 9 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: b9d3bd5c-d056-4384-a357-30685dc0b90f

📥 Commits

Reviewing files that changed from the base of the PR and between 131e1cf and 164d932.

📒 Files selected for processing (3)
  • src/frontend/components/_features/[workspace]/branches/branch-switcher-popover.tsx
  • src/frontend/components/_molecules/project-tree/index.tsx
  • src/frontend/components/_organisms/modals/read-only-project-modal.tsx

Walkthrough

Updates change stash wording to "Apply & remove" for button labels and toasts; several workspace components remove modal-based read-only guards and instead hide or gate editing controls or adjust editor readOnly sourcing; read-only modal content styling is also refined.

Changes

Stash action messaging

Layer / File(s) Summary
Toast messages and button label for stash pop
src/frontend/components/_features/[workspace]/source-control/stash-section.tsx
Success and failure toast titles updated to describe the stash pop action as "apply & remove". Button label changed from "Pop" to "Apply & remove".

Read-only UI behavior changes

Layer / File(s) Summary
Branch actions gating
src/frontend/components/_features/[workspace]/branches/branch-switcher-popover.tsx
BranchSwitcherPopover reads workspace permissions (isReadOnly) and hides merge/delete per-branch actions and the create-branch control when read-only.
Create-element popover behavior
src/frontend/components/_features/[workspace]/create-element/element-card/index.tsx
ElementCard no longer opens the read-only modal on create/hover; popover open/hover always permitted (persistence still gated elsewhere).
Editor read-only handling (Graphical & Monaco)
src/frontend/components/_features/[workspace]/editor/graphical/index.tsx, src/frontend/components/_features/[workspace]/editor/monaco/index.tsx
GraphicalEditor drops the readOnly prop and overlay gating; MonacoEditor sets readOnly based solely on debugger visibility and removes project-level isReadOnly coupling.
Project tree context menu gating
src/frontend/components/_molecules/project-tree/index.tsx
ProjectTree leaf components return no popover options when isReadOnly, remove openModal guards, and avoid mounting popovers when there are no actions.
ReadOnlyProjectModal styling
src/frontend/components/_organisms/modals/read-only-project-modal.tsx
ModalContent centering and sizing updated to use translate-centering, h-auto, max-h and overflow-y-auto for internal scrolling.
Commit restore gating
src/frontend/components/_features/[workspace]/source-control/commit-details.tsx
Restore button now opens the read-only modal when workspace is read-only; otherwise it shows the restore confirmation modal.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

bug, enhancement

Suggested reviewers

  • JoaoGSP
  • MatheusDamascenoDev

Poem

🐰 A rabbit taps the keys with cheer,
Labels shift — "Apply & remove" is here.
Menus tuck away where edits can't be made,
Editors listen to the debugger's parade.
Hops of joy for UI changes now displayed.

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (2 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning No pull request description was provided by the author, missing all required template sections including references, change description, and DOD checklist. Add a comprehensive pull request description following the template, including issue reference, detailed change summary, and completed DOD checklist.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'fix: change text' is vague and generic, providing no meaningful information about the changeset's purpose or scope. Use a descriptive title that reflects the main changes (e.g., 'fix: update read-only permissions handling across editor components' or similar).
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch change-text

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/frontend/components/_features/[workspace]/editor/graphical/index.tsx (1)

23-36: ⚡ Quick win

Remove readOnly from GraphicalEditorProps too.

GraphicalEditor now ignores this prop, but the type still advertises it. That lets old callers keep compiling while silently losing the read-only behavior, which makes missed cleanup easy to ship.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/frontend/components/_features/`[workspace]/editor/graphical/index.tsx
around lines 23 - 36, GraphicalEditorProps still declares a readOnly prop even
though GraphicalEditor ignores it; remove readOnly from the GraphicalEditorProps
type definition and any related defaulting/usage to prevent callers from relying
on a no-op prop. Locate the GraphicalEditorProps interface/type (used by the
GraphicalEditor functional component) and delete the readOnly field, update any
imports/usages that pass readOnly (or adjust call sites to stop supplying it),
and run type-checks to ensure no residual references to readOnly remain in
GraphicalEditor, SfcEditor, FbdEditor, or LadderEditor props.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/frontend/components/_molecules/project-tree/index.tsx`:
- Around line 741-765: The inline-rename entrypoint bypasses the read-only
check: ensure the double-click / inline rename trigger in ProjectTreeLeaf is
gated by checking !isReadOnly before calling setIsEditing or invoking the rename
flow (i.e., update the onDoubleClick/inline-edit trigger to early-return if
isReadOnly), and add a defensive short-circuit at the top of handleRenameFile to
immediately return when isReadOnly is true so any direct calls cannot proceed to
executeSaveProject; refer to ProjectTreeLeaf, popoverOptions, setIsEditing, and
handleRenameFile when making these changes.
- Around line 320-340: The popoverOptions check alone doesn't prevent
double-click rename in ProjectTreeExpandableLeaf: update the
double-click/inline-edit trigger so it respects isReadOnly (e.g., change the
onDoubleClick or the call to setIsEditing to only run when isReadOnly is false),
and also add a defensive guard at the top of handleRenameFile (return early if
isReadOnly) to ensure no rename path executes in read-only mode; reference
popoverOptions, setIsEditing, ProjectTreeExpandableLeaf, and handleRenameFile
when making these changes.

---

Nitpick comments:
In `@src/frontend/components/_features/`[workspace]/editor/graphical/index.tsx:
- Around line 23-36: GraphicalEditorProps still declares a readOnly prop even
though GraphicalEditor ignores it; remove readOnly from the GraphicalEditorProps
type definition and any related defaulting/usage to prevent callers from relying
on a no-op prop. Locate the GraphicalEditorProps interface/type (used by the
GraphicalEditor functional component) and delete the readOnly field, update any
imports/usages that pass readOnly (or adjust call sites to stop supplying it),
and run type-checks to ensure no residual references to readOnly remain in
GraphicalEditor, SfcEditor, FbdEditor, or LadderEditor props.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: c0d658c7-b82f-4c3d-849e-fac26e601301

📥 Commits

Reviewing files that changed from the base of the PR and between cebddef and 71f9dd9.

📒 Files selected for processing (6)
  • src/frontend/components/_features/[workspace]/branches/branch-switcher-popover.tsx
  • src/frontend/components/_features/[workspace]/create-element/element-card/index.tsx
  • src/frontend/components/_features/[workspace]/editor/graphical/index.tsx
  • src/frontend/components/_features/[workspace]/editor/monaco/index.tsx
  • src/frontend/components/_molecules/project-tree/index.tsx
  • src/frontend/components/_organisms/modals/read-only-project-modal.tsx

Comment on lines 320 to +340
const popoverOptions = useMemo(
() => {
const guard = (real: () => void) => () => {
if (isReadOnly) {
openModal('read-only-project')
return
}
real()
}
// Read-only ⇒ no file-level actions. Rename/Delete mutate the repo
// (rename auto-persists, delete removes the file), so they're removed
// entirely rather than funnelled to the fork modal.
if (isReadOnly) return []
return [
{
name: 'Rename',
onClick: guard(() => setIsEditing(true)),
onClick: () => setIsEditing(true),
icon: <PencilIcon className='h-4 w-4 stroke-brand dark:stroke-brand-light' />,
},
{
name: 'Delete',
onClick: guard(() => handleDeleteFile()),
onClick: () => handleDeleteFile(),
icon: <CloseIcon className='h-4 w-4 stroke-brand dark:stroke-brand-light' />,
},
]
},
// eslint-disable-next-line react-hooks/exhaustive-deps
[label, isReadOnly, openModal],
[label, isReadOnly],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Read-only rename is still reachable in ProjectTreeExpandableLeaf.

Returning [] here only removes the popover. Users can still double-click the label on Line 390 to enter inline rename mode, and handleRenameFile() still runs the rename path afterward. That leaves a write action available in the exact state this block says should have none.

Also applies to: 390-390

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/frontend/components/_molecules/project-tree/index.tsx` around lines 320 -
340, The popoverOptions check alone doesn't prevent double-click rename in
ProjectTreeExpandableLeaf: update the double-click/inline-edit trigger so it
respects isReadOnly (e.g., change the onDoubleClick or the call to setIsEditing
to only run when isReadOnly is false), and also add a defensive guard at the top
of handleRenameFile (return early if isReadOnly) to ensure no rename path
executes in read-only mode; reference popoverOptions, setIsEditing,
ProjectTreeExpandableLeaf, and handleRenameFile when making these changes.

Comment on lines 741 to 765
const popoverOptions = useMemo(() => {
// Read-only ⇒ every write action funnels into the fork modal. We
// still surface the menu items so the affordance is discoverable
// (the user can read what's there), but each click routes through
// the modal instead of the underlying handler.
const guard = (real: () => void) => () => {
if (isReadOnly) {
openModal('read-only-project')
return
}
real()
}
// Read-only ⇒ no file-level actions. Rename, Duplicate and Delete all
// mutate the repo (rename and duplicate auto-persist, delete removes the
// file), so the whole context menu is removed rather than funnelled to
// the fork modal. In-place editing of the file's contents stays allowed.
if (isReadOnly) return []
return [
{
name: 'Rename',
onClick: guard(() => setIsEditing(true)),
onClick: () => setIsEditing(true),
icon: <PencilIcon className='h-4 w-4 stroke-brand dark:stroke-brand-light' />,
},
{
name: 'Duplicate',
onClick: guard(() => void handleDuplicateFile()),
onClick: () => void handleDuplicateFile(),
icon: <DuplicateIcon className='h-4 w-4 stroke-brand dark:stroke-brand-light' />,
},
{
name: 'Delete',
onClick: guard(() => handleDeleteFile()),
onClick: () => handleDeleteFile(),
icon: <CloseIcon className='h-4 w-4 stroke-brand dark:stroke-brand-light' />,
},
]
}, [handleDeleteFile, handleDuplicateFile, setIsEditing, isReadOnly, openModal])
}, [handleDeleteFile, handleDuplicateFile, setIsEditing, isReadOnly])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Double-click still bypasses the read-only gating in ProjectTreeLeaf.

This hides the context menu, but Line 807 still enables inline rename. From there handleRenameFile() can rename the leaf and, for several leaf types, immediately call executeSaveProject(...). Please gate the inline rename entrypoint with !isReadOnly too, and ideally short-circuit the rename handler as a backstop.

Also applies to: 807-807

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/frontend/components/_molecules/project-tree/index.tsx` around lines 741 -
765, The inline-rename entrypoint bypasses the read-only check: ensure the
double-click / inline rename trigger in ProjectTreeLeaf is gated by checking
!isReadOnly before calling setIsEditing or invoking the rename flow (i.e.,
update the onDoubleClick/inline-edit trigger to early-return if isReadOnly), and
add a defensive short-circuit at the top of handleRenameFile to immediately
return when isReadOnly is true so any direct calls cannot proceed to
executeSaveProject; refer to ProjectTreeLeaf, popoverOptions, setIsEditing, and
handleRenameFile when making these changes.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/frontend/components/_features/[workspace]/source-control/commit-details.tsx (1)

19-26: ⚡ Quick win

Use selector-based store subscriptions instead of destructuring full store state.

At Line 19-Line 26, useOpenPLCStore() subscribes this component to the full store. Please switch to selector hooks for the exact slices used (project.meta.path, workspace.isReadOnly, modalActions.openModal, sharedWorkspaceActions.handleOpenProjectResponse) to follow repo rules and avoid unnecessary rerenders.

As per coding guidelines: "Use Zustand auto-generated selector hooks: useOpenPLCStore((s) => s.sliceName.property)"

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@src/frontend/components/_features/`[workspace]/source-control/commit-details.tsx
around lines 19 - 26, The component currently subscribes to the entire store via
useOpenPLCStore() which causes unnecessary rerenders; replace that destructuring
with selector-based subscriptions: call useOpenPLCStore((s) =>
s.project.meta.path) for storedProjectId, useOpenPLCStore((s) =>
s.workspace.isReadOnly) for isReadOnly, useOpenPLCStore((s) =>
s.modalActions.openModal) for openModal, and useOpenPLCStore((s) =>
s.sharedWorkspaceActions.handleOpenProjectResponse) for the
sharedWorkspaceActions handler, then update any local references to use those
selected values/functions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@src/frontend/components/_features/`[workspace]/source-control/commit-details.tsx:
- Around line 19-26: The component currently subscribes to the entire store via
useOpenPLCStore() which causes unnecessary rerenders; replace that destructuring
with selector-based subscriptions: call useOpenPLCStore((s) =>
s.project.meta.path) for storedProjectId, useOpenPLCStore((s) =>
s.workspace.isReadOnly) for isReadOnly, useOpenPLCStore((s) =>
s.modalActions.openModal) for openModal, and useOpenPLCStore((s) =>
s.sharedWorkspaceActions.handleOpenProjectResponse) for the
sharedWorkspaceActions handler, then update any local references to use those
selected values/functions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 70ecfe39-122b-4e68-be93-dad7a151e109

📥 Commits

Reviewing files that changed from the base of the PR and between 71f9dd9 and 131e1cf.

📒 Files selected for processing (1)
  • src/frontend/components/_features/[workspace]/source-control/commit-details.tsx

@thiagoralves
thiagoralves deleted the change-text branch June 5, 2026 17:32
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.

1 participant