Skip to content

Conversation

@kube
Copy link
Collaborator

@kube kube commented Jan 22, 2026

🌟 What is the purpose of this PR?

Fixes read-only tooltips that don't always show during simulation mode. Components now receive a tooltip property directly instead of being wrapped in a <DisabledTooltip> component, ensuring tooltips display correctly on disabled elements.

🔗 Related links

🔍 What does this change?

  • Removed <DisabledTooltip> wrapper component and inlined tooltip logic
  • Created CodeEditor component wrapping Monaco Editor with tooltip support
  • Added tooltip prop to Switch component with proper event forwarding via ark.span
  • Added disabled and tooltip props to SegmentGroup component using ArkTooltip.Trigger with asChild
  • Disabled delete buttons in PlaceProperties and TransitionProperties during simulation
  • Added tooltip to Dynamics switch when no type is selected
  • Disabled Visualizer toggle during simulation
  • Updated useIsReadOnly hook to include "Complete" simulation state
  • Prevented Delete/Backspace keyboard deletion in read-only mode
  • Used useIsReadOnly hook consistently in SDCPN canvas view
  • Disabled add/delete buttons in sidebar lists (Types, Differential Equations, Parameters) during read-only mode

Pre-Merge Checklist 🚀

🚢 Has this modified a publishable library?

This PR:

  • modifies an npm-publishable library and I have added a changeset file(s)

📜 Does this require a change to the docs?

The changes in this PR:

  • are internal and do not require a docs change

🕸️ Does this require a change to the Turbo Graph?

The changes in this PR:

  • do not affect the execution graph

🛡 What tests cover this?

  • Manual testing of tooltip behavior during simulation mode

❓ How to test this?

  1. Checkout the branch
  2. Open Petrinaut and load a simulation
  3. Start or complete a simulation
  4. Verify that:
    • All disabled controls show the read-only tooltip on hover
    • Delete buttons are disabled with tooltips
    • Keyboard Delete/Backspace doesn't delete elements
    • Add buttons in sidebar are disabled
    • Canvas is not editable

@vercel
Copy link

vercel bot commented Jan 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Review Updated (UTC)
ds-theme Ignored Ignored Preview Jan 24, 2026 0:39am
hashdotdesign Ignored Ignored Preview Jan 24, 2026 0:39am
hashdotdesign-tokens Ignored Ignored Preview Jan 24, 2026 0:39am

@github-actions github-actions bot added area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team labels Jan 22, 2026
Copy link
Collaborator Author

kube commented Jan 22, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

kube and others added 7 commits January 22, 2026 13:13
- Create CodeEditor component wrapping Monaco Editor with tooltip support
- Add tooltip prop to Switch component
- Update Tooltip component to optionally render based on content
- Refactor property panels to use inline tooltip pattern:
  `<Tooltip content={isReadOnly ? UI_MESSAGES.READ_ONLY_MODE : undefined}>`
- Delete disabled-tooltip.tsx as it's no longer needed

This ensures tooltips show reliably on disabled elements by having
the Tooltip wrapper handle hover events instead of relying on disabled
elements.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The ArkSwitch.Root is a label element that doesn't forward all props
needed by Tooltip. Wrap the switch in an ark.span container when a
tooltip is provided to ensure event handlers are properly forwarded.

Also refactored styles to use Panda CSS data attribute patterns
(_disabled, _enabled) instead of inline conditional cursor styles.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add disabled prop that passes through to ArkSegmentGroup.Root
- Add tooltip prop with ark.span wrapper for proper event forwarding
- Add disabled styling (opacity, cursor: not-allowed)
- Update transition-properties.tsx to use new props directly
  instead of external wrapper and Tooltip

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…wrapper

Instead of wrapping with ark.span (which breaks dimensions), use Ark UI's
ID composition pattern: the Tooltip and SegmentGroup container share an ID
via `ids={{ trigger: triggerId }}`, allowing the tooltip to attach without
wrapper elements.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The display:contents CSS property makes the wrapper element invisible
to layout (its children are laid out as if they were direct children
of the grandparent) while still allowing it to forward tooltip events.

This fixes both the tooltip functionality and the layout.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Use ArkTooltip.Trigger with asChild to merge event handlers directly
with the ark.div container element. This avoids wrapper elements
while properly forwarding tooltip trigger events.

The key is that ArkTooltip.Trigger's asChild prop merges its props
(including event handlers) with the child ark.div, which can properly
receive them.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The delete buttons for places and transitions are now disabled when
in read-only mode (during simulation), showing the read-only tooltip.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
kube and others added 4 commits January 22, 2026 16:24
Shows a tooltip explaining that a token type must be selected
to enable dynamics on the place.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The editor should remain read-only not just during running/paused
simulations, but also when a simulation has completed.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
kube and others added 2 commits January 23, 2026 01:03
Consolidates read-only state logic by using the shared hook instead
of duplicating the simulation state checks locally.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Uses useIsReadOnly hook consistently across types, differential equations,
and parameters lists. Both add and delete buttons are now disabled with
tooltips when in read-only mode.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@kube kube marked this pull request as ready for review January 23, 2026 00:36
@cursor
Copy link

cursor bot commented Jan 23, 2026

PR Summary

Standardizes tooltip and read-only behavior throughout Petrinaut and prevents edits during simulation.

  • Adds CodeEditor wrapper around Monaco with tooltip support and read-only styling
  • Replaces DisabledTooltip usage with inline Tooltip props across inputs, selects, switches, and lists; deletes DisabledTooltip
  • Enhances Switch and SegmentGroup with disabled/tooltip props and proper tooltip triggers
  • Extends useIsReadOnly to include Complete state; applies it consistently (properties panels, sidebar lists, SDCPN canvas)
  • Disables destructive actions (delete buttons, add buttons) and shows tooltips in read-only mode; blocks Delete/Backspace canvas deletions
  • Adds UI_MESSAGES.DYNAMICS_REQUIRES_TYPE and read-only tooltips for dynamics/visualizer toggles

Written by Cursor Bugbot for commit 0b6a30c. This will update automatically on new commits. Configure here.

cursor[bot]

This comment was marked as outdated.

@augmentcode
Copy link

augmentcode bot commented Jan 23, 2026

🤖 Augment PR Summary

Summary: This PR improves read-only UX during Petrinaut simulation by ensuring disabled/readonly controls can still display explanatory tooltips.

Changes:

  • Removed the <DisabledTooltip> wrapper pattern and made Tooltip accept optional content.
  • Introduced a CodeEditor wrapper around Monaco with tooltip support for read-only explanations.
  • Extended Switch with a tooltip prop and event-forwarding via ark.span to support tooltips on disabled states.
  • Extended SegmentGroup with disabled/tooltip props using ArkTooltip.Trigger (asChild) for disabled-state explanations.
  • Added a new UI message for “dynamics requires type” and applied it to the Dynamics switch when no type is selected.
  • Disabled delete/add actions across places, transitions, and sidebar lists while in read-only mode, and added tooltips explaining why.
  • Updated useIsReadOnly to treat the simulation Complete state as read-only.
  • Prevented Delete/Backspace keyboard deletion when the canvas is read-only.

Technical Notes: Read-only state is now centralized via useIsReadOnly and reused across editor panels, lists, and the SDCPN canvas.

🤖 Was this summary useful? React with 👍 or 👎

Copy link

@augmentcode augmentcode bot left a comment

Choose a reason for hiding this comment

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

Review completed. 1 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

<div>
<div className={fieldLabelStyle}>Name</div>
<DisabledTooltip disabled={isDisabled}>
<Tooltip content={isDisabled ? UI_MESSAGES.READ_ONLY_MODE : undefined}>
Copy link

Choose a reason for hiding this comment

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

Tooltip uses ArkTooltip.Trigger asChild, so if the child is a native disabled control (<input disabled>, <button disabled>, etc.) it won’t receive pointer events and the tooltip typically won’t appear. Several of the new read-only tooltips are attached to disabled native controls, so the original “tooltip on readonly hover” issue may persist in those spots.

Other Locations
  • libs/@hashintel/petrinaut/src/views/Editor/panels/PropertiesPanel/differential-equation-properties.tsx:312
  • libs/@hashintel/petrinaut/src/views/Editor/panels/PropertiesPanel/differential-equation-properties.tsx:333
  • libs/@hashintel/petrinaut/src/views/Editor/panels/PropertiesPanel/place-properties.tsx:402
  • libs/@hashintel/petrinaut/src/views/Editor/panels/PropertiesPanel/transition-properties.tsx:322
  • libs/@hashintel/petrinaut/src/views/Editor/panels/PropertiesPanel/type-properties.tsx:407
  • libs/@hashintel/petrinaut/src/views/Editor/subviews/differential-equations-list.tsx:157
  • libs/@hashintel/petrinaut/src/views/Editor/subviews/parameters-list.tsx:247
  • libs/@hashintel/petrinaut/src/views/Editor/subviews/types-list.tsx:210

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

kube and others added 3 commits January 23, 2026 10:30
Move cursor style to container and remove tooltip overlay that was
blocking mouse interactions including scroll wheel events.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Move ArkTooltip.Trigger to wrap the entire SegmentGroup.Root instead
of being nested inside it. This ensures proper component hierarchy
and context distribution.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add a wrapper span around the tooltip trigger children to ensure
tooltips work on disabled native elements (like buttons). Disabled
elements don't receive pointer events, but the wrapper span does.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Using inline-flex caused block-level children like CodeEditor to lose
their width. Using flex ensures the wrapper takes full width while
still properly wrapping both block and inline elements.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
kube and others added 2 commits January 23, 2026 10:50
Ensure the flex wrapper takes full width of its parent container
so block-level children like CodeEditor don't collapse.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Block-level div elements properly contain block-level children like
CodeEditor. The span element wasn't correctly handling the width
inheritance for Monaco Editor containers.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The previous fix using flex with width: 100% was breaking the dimensions
of input elements. This change uses inline-flex instead, which preserves
the natural dimensions of input elements while still enabling tooltips
on disabled elements.

The inline-flex display mode ensures that:
1. Input elements maintain their intended width
2. Tooltips still work on disabled elements
3. The wrapper doesn't force unwanted width constraints
4. Alignment is preserved with align-items: center

Fixes issue with Tooltip wrapper breaking dimensions of inputs.
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

const triggerWrapperStyle = css({
display: "inline-flex",
alignItems: "center",
});
Copy link

Choose a reason for hiding this comment

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

Tooltip wrapper breaks full-width layout of inputs

Medium Severity

The new triggerWrapperStyle uses display: "inline-flex" which doesn't stretch to fill parent width. When Tooltip wraps elements styled with width: 100% (like inputs in parameter-properties.tsx, differential-equation-properties.tsx, type-properties.tsx), those elements won't be full-width anymore because an inline-flex container sizes to content rather than stretching. This causes visible layout shrinking in read-only mode compared to edit mode where no wrapper is applied.

Fix in Cursor Fix in Web

false: {},
},
},
});
Copy link

Choose a reason for hiding this comment

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

CodeEditor missing flex properties for vertical fill

Medium Severity

The new CodeEditor component's containerStyle is missing flex: 1 and minHeight: 0 properties that were present in the old editorContainerStyle in differential-equation-properties.tsx. When CodeEditor is used with height="100%" inside a flex column container (like codeContainerStyle), it won't properly fill the remaining vertical space because height: 100% doesn't work correctly in flex containers without proper flex properties. The differential equations code editor will render with collapsed or incorrect height.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team

Development

Successfully merging this pull request may close these issues.

2 participants