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: Anvil Drag Preview #33133

Merged
merged 18 commits into from
May 3, 2024
Merged

feat: Anvil Drag Preview #33133

merged 18 commits into from
May 3, 2024

Conversation

marks0351
Copy link
Contributor

@marks0351 marks0351 commented May 2, 2024

workerB

Description

Adding Drag preview

  • Creating a portal and using widget cards to depict a widget.
  • Add Widget count when multiple widgets are being dragged.

Fixes #32141
or
Fixes Issue URL

Warning

If no issue exists, please create an issue first, and check with the maintainers if the issue is valid.

Automation

/ok-to-test tags="@tag.All"

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/8940635667
Commit: 3dc5ec3
Cypress dashboard url: Click here!

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

riodeuno and others added 11 commits April 30, 2024 11:17
## Description
A selector that provides the state of the widget name component to show.
- "focus" -> Focused state
- "select" -> Selected state
- "none" -> Hidden

## Automation

/ok-to-test tags=""

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!CAUTION]  
> If you modify the content in this section, you are likely to disrupt
the CI result for your PR.

<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [x] No
Copy link
Contributor

coderabbitai bot commented May 2, 2024

Walkthrough

Walkthrough

The recent changes across the Anvil layout system focus on enhancing widget drag functionalities by introducing a new widgetType parameter. This improvement allows for more precise control and customization of drag behaviors and previews within the Anvil editor. Additionally, the drag preview component has been updated to offer more dynamic and context-aware visual feedback during widget manipulation.

Changes

File Path Change Summary
.../anvil/editor/AnvilEditorFlexComponent.tsx Modified useAnvilWidgetDrag to include widgetType parameter.
.../anvil/editor/canvas/AnvilEditorCanvas.tsx Added import and usage of AnvilDragPreview.
.../anvil/editor/canvasArenas/AnvilDragPreview.tsx Updated function signatures to handle new draggedWidgetCount and isNewWidget parameters.
.../anvil/editor/hooks/useAnvilWidgetDrag.ts Added widgetType parameter to useAnvilWidgetDrag function and necessary import.
.../anvil/utils/widgetUtils.ts Enhanced generateDragStateForAnvilLayout with widgetType parameter.
.../pages/Editor/widgetSidebar/WidgetCard.tsx Exported CardProps and WidgetCardComponent.
.../reducers/uiReducers/dragResizeReducer.ts Added widgetType property to DraggingGroupCenter interface.

Possibly related issues


Recent Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between c218de4 and 3dc5ec3.
Files selected for processing (1)
  • app/client/src/layoutSystems/anvil/editor/canvasArenas/hooks/useAnvilDnDEventCallbacks.ts (1 hunks)
Additional comments not posted (4)
app/client/src/layoutSystems/anvil/editor/canvasArenas/hooks/useAnvilDnDEventCallbacks.ts (4)

75-78: Ensure proper cleanup in resetCanvasState.

Verification successful

The provided script output shows multiple instances of the resetCanvasState function being used across different files and contexts within the codebase. This function appears to be a common utility for resetting the state of canvas elements in various editor components, such as FixedLayoutCanvasArenas, AutoLayoutCanvasArenas, and AnvilDnDEvents.

From the output, it's evident that resetCanvasState is consistently used to clear or reset the state of the canvas when certain events occur, such as mouse events (mouseup, mouseout, mouseleave) or after certain drag-and-drop operations. The function is also used to remove event listeners, which is a crucial step in preventing memory leaks and ensuring that the canvas state is correctly reset.

Given the consistent usage and the context provided by the script output, it seems that the resetCanvasState function is adequately handling the cleanup of canvas states across different parts of the application. There are no indications of missing cleanup operations or potential memory leaks related to this function from the script output.

Therefore, the review comment concerning the proper cleanup in resetCanvasState can be considered verified based on the current evidence.

Proper cleanup in `resetCanvasState` is verified across multiple components.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that all necessary cleanup operations are performed in `resetCanvasState`.

# Test: Search for any potential memory leaks or missing cleanup operations related to `resetCanvasState`. Expect: No issues found.
rg "resetCanvasState" --context 5

Length of output: 22571


75-78: Throttling is correctly implemented to enhance UI responsiveness.


75-78: Use of useRef for internal state management is appropriate and enhances performance.


75-78: The function is well-structured with clear separation of concerns among callbacks.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added Anvil Pod Issue related to Anvil project Anvil team issues related to the new layout system anvil Medium Issues that frustrate users due to poor UX labels May 2, 2024
riodeuno and others added 5 commits May 2, 2024 14:58
## Description
- The new widget selection UX.
- This PR adjusts the code and enables the UX for Anvil.
- Other things changed in this PR are as follows
- [x] Update widget selection handlers to make them simplified
- [x] Add `debugWidget` action for widget error debugging
- [x] Add appropriate border styles to widgets
- [x] Convert SVGs into react components
- [x] Remove extra props from AnvilWidgetNameComponent
- [x] Update and adjust CSS variable names and references

Fixes #33130 33130

## Automation

/ok-to-test tags="@tag.All"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!CAUTION]  
> If you modify the content in this section, you are likely to disrupt
the CI result for your PR.

<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [x] No
@marks0351
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

Copy link

github-actions bot commented May 3, 2024

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/8938696209.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 33133.
recreate: .

@marks0351 marks0351 added the ok-to-test Required label for CI label May 3, 2024
Copy link

github-actions bot commented May 3, 2024

Deploy-Preview-URL: https://ce-33133.dp.appsmith.com

@marks0351 marks0351 requested a review from riodeuno May 3, 2024 13:40
@marks0351 marks0351 changed the title Feat: Anvil Drag Preview feat: Anvil Drag Preview May 3, 2024
@github-actions github-actions bot added the Enhancement New feature or request label May 3, 2024
riodeuno
riodeuno previously approved these changes May 3, 2024
@marks0351 marks0351 added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels May 3, 2024
@marks0351 marks0351 requested a review from riodeuno May 3, 2024 14:36
@marks0351 marks0351 merged commit e15d397 into release May 3, 2024
83 checks passed
@marks0351 marks0351 deleted the feat/anvil-drag-preview branch May 3, 2024 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Anvil Pod Issue related to Anvil project Anvil team issues related to the new layout system anvil Enhancement New feature or request Medium Issues that frustrate users due to poor UX ok-to-test Required label for CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task]: Show Drag preview while Dragging a widget
2 participants