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

fix: preview mode canvas cutoff #33960

Merged
merged 1 commit into from
Jun 6, 2024
Merged

fix: preview mode canvas cutoff #33960

merged 1 commit into from
Jun 6, 2024

Conversation

KelvinOm
Copy link
Collaborator

@KelvinOm KelvinOm commented Jun 4, 2024

Description

Fix canvas and resizer height with and without navigation.

Fixes #32301

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/9381694039
Commit: 5c630f5
Cypress dashboard url: Click here!

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • Enhancements
    • Improved layout responsiveness by using navigationHeight for dynamic styling in preview mode.
    • Simplified height calculations in the editor by replacing headerHeight with navigationHeight.

@github-actions github-actions bot added Anvil Pod Issue related to Anvil project Anvil team issues related to the new layout system anvil Bug Something isn't working Regressed Scenarios that were working before but have now regressed labels Jun 4, 2024
@KelvinOm KelvinOm added skip-changelog Adding this label to a PR prevents it from being listed in the changelog skip-docs skip-testPlan Does not require QA intervention or approval process skip-documentation To avoid commenting the reminder about the documentation update. and removed Bug Something isn't working Regressed Scenarios that were working before but have now regressed Anvil Pod Issue related to Anvil project Anvil team issues related to the new layout system anvil labels Jun 4, 2024
@github-actions github-actions bot added Bug Something isn't working and removed skip-changelog Adding this label to a PR prevents it from being listed in the changelog labels Jun 4, 2024
@KelvinOm KelvinOm added skip-changelog Adding this label to a PR prevents it from being listed in the changelog ok-to-test Required label for CI and removed Bug Something isn't working labels Jun 4, 2024
@github-actions github-actions bot added Bug Something isn't working Anvil Pod Issue related to Anvil project Anvil team issues related to the new layout system anvil Regressed Scenarios that were working before but have now regressed and removed skip-changelog Adding this label to a PR prevents it from being listed in the changelog labels Jun 4, 2024
@KelvinOm
Copy link
Collaborator Author

KelvinOm commented Jun 4, 2024

/build-deploy-preview skip-tests=true

Copy link

github-actions bot commented Jun 4, 2024

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

Copy link
Contributor

coderabbitai bot commented Jun 4, 2024

Walkthrough

The changes focus on fixing the issue where the canvas gets cut off in preview mode. This is achieved by introducing a navigationHeight parameter to control the top position and height of the MainContainerResizer and MainContainerWrapper components.

Changes

File Path Change Summary
app/client/src/layoutSystems/common/mainContainerResizer/MainContainerResizer.tsx Added navigationHeight parameter to function signature and used it for styling adjustments.
app/client/src/pages/Editor/WidgetsEditor/components/MainContainerWrapper.tsx Replaced headerHeight with navigationHeight for height calculation and removed shouldHaveTopMargin prop.

Sequence Diagram(s) (Beta)

sequenceDiagram
    participant User
    participant MainContainerWrapper
    participant MainContainerResizer

    User->>MainContainerWrapper: Load Canvas
    MainContainerWrapper->>MainContainerResizer: Pass navigationHeight
    MainContainerResizer->>MainContainerWrapper: Adjust top position and height
    User->>MainContainerWrapper: Switch to Preview Mode
    MainContainerWrapper->>MainContainerResizer: Adjust styling for Preview Mode
Loading

Assessment against linked issues

Objective (Issue #32301) Addressed Explanation
Canvas gets trimmed on preview mode
Scroll to the bottom and observe truncation

Poem

In code, we fixed a canvas plight,
No more cut off, it's now just right.
With navigationHeight to guide the way,
Our widgets shine, both night and day.
Preview mode now stands so tall,
No more trims, we fixed it all! 🌟


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 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.

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 22d201b and 5c630f5.

Files selected for processing (2)
  • app/client/src/layoutSystems/common/mainContainerResizer/MainContainerResizer.tsx (2 hunks)
  • app/client/src/pages/Editor/WidgetsEditor/components/MainContainerWrapper.tsx (3 hunks)
Additional context used
Biome
app/client/src/layoutSystems/common/mainContainerResizer/MainContainerResizer.tsx

[error] 79-79: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 95-95: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 99-99: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 111-111: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 99-116: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.


[error] 118-118: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 118-134: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.


[error] 136-136: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 140-140: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 136-143: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.


[error] 145-145: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)

any disables many type checking rules. Its use should be avoided.


[error] 146-146: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 149-150: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 74-74: This hook does not specify all of its dependencies: dispatch (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

This dependency is not specified in the hook dependency list.


[error] 74-74: This hook specifies more dependencies than necessary: isPreview, currentPageId (lint/correctness/useExhaustiveDependencies)

Outer scope values aren't valid dependencies because mutating them doesn't re-render the component.

Outer scope values aren't valid dependencies because mutating them doesn't re-render the component.

app/client/src/pages/Editor/WidgetsEditor/components/MainContainerWrapper.tsx

[error] 137-137: This hook does not specify all of its dependencies: dispatch (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

Either include it or remove the dependency array

Additional comments not posted (3)
app/client/src/layoutSystems/common/mainContainerResizer/MainContainerResizer.tsx (2)

63-69: The addition of navigationHeight as an optional parameter in the function signature is well-aligned with the PR objectives to handle canvas cutoff issues in preview mode.


173-174: The inline style adjustments based on isPreview and navigationHeight are appropriate for handling different canvas heights in preview mode. This should effectively resolve the canvas cutoff issue as described.

app/client/src/pages/Editor/WidgetsEditor/components/MainContainerWrapper.tsx (1)

207-207: The adjustment of the main container's height based on isPreviewMode and navigationHeight is correctly implemented to handle different display conditions in preview mode.

Copy link

github-actions bot commented Jun 4, 2024

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

@KelvinOm KelvinOm added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Jun 5, 2024
@KelvinOm KelvinOm merged commit 2d40060 into release Jun 6, 2024
85 checks passed
@KelvinOm KelvinOm deleted the fix/preview-mode-cutoff branch June 6, 2024 09:28
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 Bug Something isn't working ok-to-test Required label for CI Regressed Scenarios that were working before but have now regressed skip-docs skip-documentation To avoid commenting the reminder about the documentation update. skip-testPlan Does not require QA intervention or approval process
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Canvas gets cutoff on preview mode
3 participants