Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Update node name and description UX editing #5920

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

Cristhianzl
Copy link
Member

@Cristhianzl Cristhianzl commented Jan 24, 2025

This pull request introduces a new feature that allows users to edit the name and description of nodes directly within the UI. The most important changes include updates to the NodeDescription and NodeName components, the addition of new hooks, and various UI adjustments.

New Features:

New Hooks:

UI Adjustments:

Styling Updates:

image

image

NEW GRAB REGION:

image

…nce when dragging the node

✨ (NodeName/index.tsx): add nodrag class to prevent text selection when dragging the node
✨ (NodeStatus/index.tsx): add nodrag class to prevent text selection when dragging the node
✨ (GenericNode/index.tsx): add nopan, nodelete, nodrag, noflow classes to improve node dragging behavior
…er user experience

📝 (NodeName/index.tsx): Update cursor style to 'auto' for better user experience
📝 (NodeOutputfield/index.tsx): Add cursor style 'pointer' to improve interactivity
…on when selected and editNameDescription is true

✨ (NodeName/index.tsx): Add support for editing node name when selected and editNameDescription is true
🔧 (GenericNode/index.tsx): Introduce useAlternate hook to handle toggling editNameDescription state
📝 (use-alternate.tsx): Add custom hook useAlternate to handle toggling boolean state
🔧 (style/index.css): Add new CSS variable --zinc-foreground for styling purposes
🔧 (tailwind.config.mjs): Add new tailwind color variable "zinc-foreground" for styling purposes
… call and update useEffect dependencies for better performance

📝 (NodeDescription/index.tsx): Update className for Textarea component to improve styling and readability
📝 (NodeDescription/index.tsx): Update className for generic-node-desc-text to improve styling and cursor behavior
📝 (NodeName/index.tsx): Remove unnecessary setInputName call and update useEffect dependencies for better performance
📝 (NodeName/index.tsx): Update className for span element to improve cursor behavior and styling
📝 (GenericNode/index.tsx): Add useRef for node element and implement useChangeOnUnfocus hook for better handling of focus events
📝 (GenericNode/index.tsx): Update className for pencil icon based on editNameDescription state for better visual feedback
📝 (GenericNode/index.tsx): Add editNameDescription to dependencies of useCallback to prevent unnecessary re-renders
📝 (GenericNode/index.tsx): Add editNameDescription to dependencies of useEffect to handle changes in editNameDescription state
📝 (use-change-on-unfocus.tsx): Implement custom hook useChangeOnUnfocus for handling focus events and state changes
@Cristhianzl Cristhianzl self-assigned this Jan 24, 2025
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels Jan 24, 2025
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Jan 24, 2025
Copy link
Contributor

@anovazzi1 anovazzi1 left a comment

Choose a reason for hiding this comment

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

would suggest we have a cancel option as well
image
also we need to fix the note component to work as usual after this change, the note component is totally broken.
Also user should be able to confirm and cancel editions using the enter and scape keys from the keyboard.

@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Jan 27, 2025
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Jan 27, 2025
@anovazzi1
Copy link
Contributor

notice that we have a scroll logic on node description, we need to take care to keep it working with the new logic

…tion and handle events like blur, key down, and double click for sticky notes

📝 (NoteNode/index.tsx): Introduce useAlternate hook to toggle edit mode for node description in NoteNode component
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Jan 27, 2025
…translate-x styles based on showNode state for improved UI responsiveness
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Jan 27, 2025
…nFn to improve code readability and maintainability

📝 (NodeName/index.tsx): Refactor handleBlur and handleKeyDown functions for better code organization and readability
📝 (GenericNode/index.tsx): Update toggleEditNameDescription prop to setEditNameDescription for consistency and clarity
📝 (use-change-on-unfocus.tsx): Remove unnecessary handleEscape function and handleBlur event listener for better code simplicity and performance
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Jan 27, 2025
…rder-primary' instead of 'focus-border-black' for consistency and clarity

📝 (GenericNode/index.tsx): Add data-testid attribute to save and edit name description buttons for testing purposes
📝 (edit-name-description-node.spec.ts): Add test to verify user can edit name and description of a node in the UI
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Jan 27, 2025
@Cristhianzl Cristhianzl requested a review from anovazzi1 January 27, 2025 18:40
Copy link
Contributor

@anovazzi1 anovazzi1 left a comment

Choose a reason for hiding this comment

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

lgtm

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 28, 2025
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Jan 29, 2025
Copy link

@simonfraserduncan simonfraserduncan left a comment

Choose a reason for hiding this comment

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

The design spec has the info button appearing closer to the component. At a 100% view, it should be 8px to the right, and 8px from the top. This looks too spaced out in comparison. Checkout this design for closer detail: https://www.figma.com/design/W4zLJ5kNwZzMf7XBjbo1PG/LF-Components?node-id=232-103&m=dev

Looks like it's missing a state for when you make updates to either the name or description. See this frame for details: https://www.figma.com/design/W4zLJ5kNwZzMf7XBjbo1PG/LF-Components?node-id=232-213&m=dev

You can also see that one in context of a prototype here: https://www.figma.com/proto/W4zLJ5kNwZzMf7XBjbo1PG/LF-Components?page-id=208%3A1938&node-id=232-123&viewport=242%2C154%2C0.47&t=5trmEXYri07oa5sP-1&scaling=min-zoom&content-scaling=fixed&starting-point-node-id=232%3A123&show-proto-sidebar=1

The animation is missing vs the prototype, but I think it is fine to leave that out. I think that could get to be a lot on every component on the canvas.

@github-actions github-actions bot removed the lgtm This PR has been approved by a maintainer label Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants