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: Scrolling issues on deployment page #254

Closed
wants to merge 1 commit into from

Conversation

adityachoudhari26
Copy link
Contributor

@adityachoudhari26 adityachoudhari26 commented Dec 5, 2024

Summary by CodeRabbit

  • New Features

    • Enhanced visual appearance of the deployment table with custom scrollbar styles.
    • Improved responsiveness and clarity of the deployment releases display.
  • Bug Fixes

    • Adjusted layout and rendering logic for better flexibility and responsiveness in the deployment releases table.
  • Chores

    • Updated height calculation for the deployment table component to optimize layout.

Copy link
Contributor

coderabbitai bot commented Dec 5, 2024

Walkthrough

The pull request introduces modifications to three components related to deployment management in a web service application. The DeploymentTable component receives updated scrollbar styles for improved aesthetics. The DeploymentPageContent component enhances the layout and rendering logic of the releases table, introducing a variable to manage environment blocks and improving responsive design. Lastly, the SystemDeploymentsPage component adjusts the height calculation for a wrapping <div>, affecting the layout without altering existing logic.

Changes

File Change Summary
apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/TableDeployments.tsx Updated scrollbar styles for the DeploymentTable component's outer <div>.
apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/releases/DeploymentPageContent.tsx Introduced numEnvironmentBlocks for responsive layout adjustments; refined rendering logic for releases.
apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/page.tsx Modified height calculation for a wrapping <div> in the SystemDeploymentsPage component.

Possibly related PRs

Suggested reviewers

  • jsbroks

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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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: 2

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 028a860 and 7149c97.

📒 Files selected for processing (3)
  • apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/TableDeployments.tsx (1 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/releases/DeploymentPageContent.tsx (3 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/page.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/TableDeployments.tsx
🔇 Additional comments (3)
apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/releases/DeploymentPageContent.tsx (3)

66-67: LGTM: Environment blocks limit improves layout stability

The introduction of numEnvironmentBlocks with a maximum of 3 helps prevent layout issues with many environments.


141-142: ⚠️ Potential issue

Consider accessibility implications of hidden scrollbars

The scrollbar-none class hides scrollbars which might affect accessibility. Users who rely on visible scrollbars for navigation might have difficulty understanding that the content is scrollable.

Consider using scrollbar-thin instead of scrollbar-none to maintain visual feedback while keeping the design clean:

-          <div className="scrollbar-none flex w-[calc(100vw-267px)] flex-col">
-            <Table className="scrollbar-none">
+          <div className="scrollbar-thin scrollbar-thumb-neutral-700 scrollbar-track-neutral-800 flex w-[calc(100vw-267px)] flex-col">
+            <Table className="scrollbar-thin scrollbar-thumb-neutral-700 scrollbar-track-neutral-800">

Line range hint 141-192: Verify responsive behavior across different screen sizes

The component uses complex viewport-based calculations and conditional rendering. Please ensure to test the following scenarios:

  1. Different screen sizes (especially mobile viewports)
  2. Different numbers of environment blocks
  3. Long release names that might cause overflow
  4. Browser zoom levels

@@ -28,7 +28,7 @@ export default async function SystemDeploymentsPage({
{deployments.length === 0 ? (
<DeploymentGettingStarted systemId={system.id} />
) : (
<div className="scrollbar-thin scrollbar-thumb-neutral-800 scrollbar-track-neutral-900 container mx-auto h-[calc(100vh-40px)] overflow-auto p-8">
<div className="scrollbar-thin scrollbar-thumb-neutral-800 scrollbar-track-neutral-900 container mx-auto h-[calc(100%-49px)] overflow-auto p-8">
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Height calculation change needs to be consistent across similar components

The codebase shows inconsistent usage of height calculations, with most components using viewport-based (100vh) calculations while only a few use percentage-based (100%). This change in the deployments page appears to be part of a gradual transition, but similar components still use viewport-based heights:

  • apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/environments/page.tsx uses h-[calc(100vh-53px)]
  • apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/layout.tsx uses h-[calc(100vh-53px-49px)]
  • apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/runbooks/[runbookId]/layout.tsx uses h-[calc(100vh-53px-49px)]

For consistent behavior across the application, similar components should follow the same height calculation approach. Consider updating related system components to use percentage-based calculations if this new approach proves more reliable.

🔗 Analysis chain

Verify scrollbar behavior across different viewport sizes

The change from viewport-based (100vh) to percentage-based (100%) height calculation could affect the scrolling behavior differently on various screen sizes. While this change likely fixes the immediate scrolling issues, we should ensure it works well across different viewport sizes and zoom levels.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for other viewport-dependent height calculations that might need similar updates
rg "h-\[calc\(100vh" --type tsx

Length of output: 61


Script:

#!/bin/bash
# Check for other viewport-dependent height calculations that might need similar updates
# Using ripgrep without file type restriction since tsx extension might not be recognized
rg "h-\[calc\(100vh"

# Also check for percentage-based height calculations for comparison
rg "h-\[calc\(100%"

Length of output: 4697

Comment on lines +183 to +192
<div
className={cn(
"flex h-[60px] items-center gap-2 overflow-auto px-4 backdrop-blur-sm",
numEnvironmentBlocks === 3 &&
"max-w-[calc(100vw-256px-737px)]",
numEnvironmentBlocks === 2 &&
"max-w-[calc(100vw-256px-491px)]",
numEnvironmentBlocks === 1 &&
"max-w-[calc(100vw-256px-246px)]",
)}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider extracting width calculations into constants

The max-width calculations use magic numbers that make maintenance difficult. Consider extracting these values into named constants for better maintainability:

+ const SIDEBAR_WIDTH = 256;
+ const ENVIRONMENT_BLOCK_WIDTH = 246;
+ 
  <div
    className={cn(
      "flex h-[60px] items-center gap-2 overflow-auto px-4 backdrop-blur-sm",
-     numEnvironmentBlocks === 3 && "max-w-[calc(100vw-256px-737px)]",
-     numEnvironmentBlocks === 2 && "max-w-[calc(100vw-256px-491px)]",
-     numEnvironmentBlocks === 1 && "max-w-[calc(100vw-256px-246px)]",
+     numEnvironmentBlocks === 3 && `max-w-[calc(100vw-${SIDEBAR_WIDTH}px-${ENVIRONMENT_BLOCK_WIDTH * 3}px)]`,
+     numEnvironmentBlocks === 2 && `max-w-[calc(100vw-${SIDEBAR_WIDTH}px-${ENVIRONMENT_BLOCK_WIDTH * 2}px)]`,
+     numEnvironmentBlocks === 1 && `max-w-[calc(100vw-${SIDEBAR_WIDTH}px-${ENVIRONMENT_BLOCK_WIDTH}px)]`,
    )}
  >

Also, consider adding a comment explaining how these width calculations were derived.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<div
className={cn(
"flex h-[60px] items-center gap-2 overflow-auto px-4 backdrop-blur-sm",
numEnvironmentBlocks === 3 &&
"max-w-[calc(100vw-256px-737px)]",
numEnvironmentBlocks === 2 &&
"max-w-[calc(100vw-256px-491px)]",
numEnvironmentBlocks === 1 &&
"max-w-[calc(100vw-256px-246px)]",
)}
const SIDEBAR_WIDTH = 256;
const ENVIRONMENT_BLOCK_WIDTH = 246;
<div
className={cn(
"flex h-[60px] items-center gap-2 overflow-auto px-4 backdrop-blur-sm",
numEnvironmentBlocks === 3 &&
`max-w-[calc(100vw-${SIDEBAR_WIDTH}px-${ENVIRONMENT_BLOCK_WIDTH * 3}px)]`,
numEnvironmentBlocks === 2 &&
`max-w-[calc(100vw-${SIDEBAR_WIDTH}px-${ENVIRONMENT_BLOCK_WIDTH * 2}px)]`,
numEnvironmentBlocks === 1 &&
`max-w-[calc(100vw-${SIDEBAR_WIDTH}px-${ENVIRONMENT_BLOCK_WIDTH}px)]`,
)}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant