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: add AnimatedGridLayout component #34825

Merged
merged 9 commits into from
Aug 14, 2024

Conversation

alex-golovanov
Copy link
Contributor

@alex-golovanov alex-golovanov commented Jul 9, 2024

Description

Added AnimatableGridLayout component, which is designed to be used for application layout. However, the component is generic and can be used for any purpose where layout needs smooth transitions.

Fixes #34537

Automation

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

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/10377477258
Commit: 1204335
Cypress dashboard.
Tags: @tag.IDE
Spec:


Tue, 13 Aug 2024 21:54:32 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Introduced a dynamic grid layout with animated transitions for child components using React Spring.
    • Added functionality to manage grid layout dimensions and child components with new types and interfaces.
  • Enhancements

    • Improved the AnimatedGridLayout component to support responsive grid layouts with adjustable rows and columns.
    • Added visibility resolution based on grid areas, rows, and columns for better layout management.
    • Introduced a custom React hook to access the previous render value for enhanced state management.

Copy link
Contributor

coderabbitai bot commented Jul 9, 2024

Walkthrough

This update enhances the AnimatedGridLayout component with a dynamic and animated grid layout. It introduces new interfaces, utility functions, and a LayoutArea component that manages child components' visibility and animations. These changes allow for a fully configurable IDE layout grid component with responsive, animated transitions based on specified dimensions.

Changes

File Path Summary
app/client/src/components/AnimatedGridLayout/AnimatedGridLayout.tsx Introduced GridLayoutProps, AnimatedGridLayout component, and added resolveAreasVisibility function.
app/client/src/components/AnimatedGridLayout/components/LayoutArea/LayoutArea.tsx Added LayoutArea component for managing visibility and layout of child components.
app/client/src/components/AnimatedGridLayout/components/LayoutArea/constants.ts Defined constants for display properties to manage CSS styles.
app/client/src/components/AnimatedGridLayout/constants.ts Introduced DEFAULT_ROWS and SPRING_ANIMATION_CONFIG constants for layout and animation settings.
app/client/src/components/AnimatedGridLayout/hooks/index.ts Exported usePrevious custom hook.
app/client/src/components/AnimatedGridLayout/utils/index.ts Exported resolveAreasVisibility function and associated types for managing area visibility.
app/client/src/components/AnimatedGridLayout/utils/resolveAreasVisibility.ts Added resolveAreasVisibility function to determine visibility based on grid configuration.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant AnimatedGridLayout
    participant LayoutArea
    participant Utils

    User->>AnimatedGridLayout: Provide grid props (rows, columns, areas)
    AnimatedGridLayout->>Utils: Call resolveAreasVisibility with props
    Utils-->>AnimatedGridLayout: Return visibility map
    AnimatedGridLayout->>LayoutArea: Pass visibility and animation props
    LayoutArea-->>User: Render animated child components
Loading

Assessment against linked issues

Objective Addressed Explanation
Create configurable IDE layout grid component (#34537)
Introduce dynamic grid layout with animations (#34537)
Provide utility functions for managing grid dimensions and visibility (#34537)
Ensure responsive behavior and adjustable rows and columns (#34537) While the grid layout supports dynamic dimensions, specific responsiveness features need checking.

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.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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

CodeRabbit Configuration 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 IDE Navigation Issues/feature requests related to IDE navigation, and context switching IDE Pod Issues that new developers face while exploring the IDE Task A simple Todo labels Jul 9, 2024
@github-actions github-actions bot added the Enhancement New feature or request label Jul 9, 2024
Copy link
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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 65bded9 and 06646d7.

Files selected for processing (15)
  • app/client/src/components/AnimatedGridLayout/AnimatedGridLayout.tsx (1 hunks)
  • app/client/src/components/AnimatedGridLayout/components/LayoutArea/LayoutArea.tsx (1 hunks)
  • app/client/src/components/AnimatedGridLayout/components/LayoutArea/constants.ts (1 hunks)
  • app/client/src/components/AnimatedGridLayout/components/LayoutArea/index.ts (1 hunks)
  • app/client/src/components/AnimatedGridLayout/components/index.ts (1 hunks)
  • app/client/src/components/AnimatedGridLayout/constants.ts (1 hunks)
  • app/client/src/components/AnimatedGridLayout/hooks/index.ts (1 hunks)
  • app/client/src/components/AnimatedGridLayout/hooks/usePrevious.ts (1 hunks)
  • app/client/src/components/AnimatedGridLayout/index.ts (1 hunks)
  • app/client/src/components/AnimatedGridLayout/utils/constants.ts (1 hunks)
  • app/client/src/components/AnimatedGridLayout/utils/index.ts (1 hunks)
  • app/client/src/components/AnimatedGridLayout/utils/normalizeMeasurement.test.ts (1 hunks)
  • app/client/src/components/AnimatedGridLayout/utils/normalizeMeasurement.ts (1 hunks)
  • app/client/src/components/AnimatedGridLayout/utils/resolveAreasVisibility.test.ts (1 hunks)
  • app/client/src/components/AnimatedGridLayout/utils/resolveAreasVisibility.ts (1 hunks)
Files skipped from review due to trivial changes (11)
  • app/client/src/components/AnimatedGridLayout/components/LayoutArea/constants.ts
  • app/client/src/components/AnimatedGridLayout/components/LayoutArea/index.ts
  • app/client/src/components/AnimatedGridLayout/components/index.ts
  • app/client/src/components/AnimatedGridLayout/constants.ts
  • app/client/src/components/AnimatedGridLayout/hooks/index.ts
  • app/client/src/components/AnimatedGridLayout/hooks/usePrevious.ts
  • app/client/src/components/AnimatedGridLayout/index.ts
  • app/client/src/components/AnimatedGridLayout/utils/constants.ts
  • app/client/src/components/AnimatedGridLayout/utils/index.ts
  • app/client/src/components/AnimatedGridLayout/utils/normalizeMeasurement.test.ts
  • app/client/src/components/AnimatedGridLayout/utils/normalizeMeasurement.ts
Additional comments not posted (6)
app/client/src/components/AnimatedGridLayout/components/LayoutArea/LayoutArea.tsx (2)

1-3: Ensure SPRING_CONFIG is defined.

The SPRING_CONFIG constant is imported but not defined in the provided code. Verify that it is correctly defined and imported.


11-35: LGTM!

The LayoutArea component's logic is correct and uses the useSpring hook appropriately.

app/client/src/components/AnimatedGridLayout/utils/resolveAreasVisibility.ts (1)

12-41: LGTM!

The resolveAreasVisibility function's logic is correct and efficiently determines the visibility of grid areas.

app/client/src/components/AnimatedGridLayout/AnimatedGridLayout.tsx (2)

5-5: Ensure usePrevious hook is defined.

The usePrevious hook is imported but not defined in the provided code. Verify that it is correctly defined and imported.


23-79: LGTM!

The AnimatedGridLayout component's logic is correct and uses the useSpring hooks appropriately.

app/client/src/components/AnimatedGridLayout/utils/resolveAreasVisibility.test.ts (1)

3-120: LGTM!

The test cases for the resolveAreasVisibility function are comprehensive and cover various scenarios effectively.

Copy link
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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 06646d7 and 062b738.

Files selected for processing (1)
  • app/client/src/components/AnimatedGridLayout/AnimatedGridLayout.tsx (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • app/client/src/components/AnimatedGridLayout/AnimatedGridLayout.tsx

Copy link
Collaborator

Choose a reason for hiding this comment

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

All this looks like a reused package. I suggest we move it to packages.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, sounds good, just need to figure out the most appropriate place/name for packages like this.

Copy link

This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected.

@github-actions github-actions bot added the Stale label Jul 18, 2024
Copy link
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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 062b738 and a3fae3b.

Files selected for processing (4)
  • app/client/src/components/AnimatedGridLayout/AnimatedGridLayout.tsx (1 hunks)
  • app/client/src/components/AnimatedGridLayout/components/LayoutArea/LayoutArea.tsx (1 hunks)
  • app/client/src/components/AnimatedGridLayout/components/LayoutArea/constants.ts (1 hunks)
  • app/client/src/components/AnimatedGridLayout/constants.ts (1 hunks)
Files skipped from review due to trivial changes (2)
  • app/client/src/components/AnimatedGridLayout/components/LayoutArea/constants.ts
  • app/client/src/components/AnimatedGridLayout/constants.ts
Additional comments not posted (9)
app/client/src/components/AnimatedGridLayout/components/LayoutArea/LayoutArea.tsx (4)

1-7: Imports and Prop Types Look Good

The imports and prop types are appropriate for the component.


9-11: Component Logic Looks Good

The logic for handling the hidden prop and setting the display style is correct.


13-20: Return Statement and Outer Div Styling Look Good

The return statement and outer div styling are appropriate for the component's functionality.


21-31: Nested Div Styling Looks Good

The nested div styling ensures proper layout and overflow handling.

app/client/src/components/AnimatedGridLayout/AnimatedGridLayout.tsx (5)

1-22: Imports and Type Definitions Look Good

The imports and type definitions are appropriate for the component.


24-44: Grid Template Areas and Rows Logic Looks Good

The logic for setting up grid template areas and rows, and using animations, is correct.


46-52: Grid Template Columns Logic Looks Good

The logic for setting up grid template columns and using animations is correct.


54-59: Area Visibility and Cloning Children Logic Looks Good

The logic for resolving area visibility and cloning children with updated props is correct.


61-76: Return Statement Looks Good

The return statement and the use of animated div with grid styling are appropriate.

@alex-golovanov alex-golovanov marked this pull request as draft July 25, 2024 17:10
@Nikhil-Nandagopal Nikhil-Nandagopal added the IDE Product Issues related to the IDE Product label Aug 5, 2024
hetunandu
hetunandu previously approved these changes Aug 13, 2024
@alex-golovanov alex-golovanov self-assigned this Aug 13, 2024
@alex-golovanov alex-golovanov marked this pull request as ready for review August 13, 2024 21:26
@alex-golovanov alex-golovanov added the ok-to-test Required label for CI label Aug 13, 2024
@hetunandu hetunandu merged commit b4a3f0c into release Aug 14, 2024
50 checks passed
@hetunandu hetunandu deleted the feat/34537-animated-grid-layout branch August 14, 2024 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request IDE Navigation Issues/feature requests related to IDE navigation, and context switching IDE Pod Issues that new developers face while exploring the IDE IDE Product Issues related to the IDE Product ok-to-test Required label for CI Task A simple Todo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task]: Create configurable IDE layout grid component
5 participants