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: Responsiveness issue of ratelimit page #2710

Merged
merged 7 commits into from
Dec 10, 2024

Conversation

BadriVishalPadhy
Copy link
Contributor

@BadriVishalPadhy BadriVishalPadhy commented Dec 6, 2024

What does this PR do?

This fixes responsiveness problem in ratelimit page.

Fixes #2409

If there is not an issue for this, please create one first. This is used to tracking purposes and also helps use understand why this PR exists

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Chore (refactoring code, technical debt, workflow improvements)
  • [ x] Enhancement (small improvements)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How should this be tested?

  • Test A
  • Test B

Checklist

Required

  • [ x] Filled out the "How to test" section in this PR
  • [ x] Read Contributing Guide
  • [ x] Self-reviewed my own code
  • [ x] Commented on my code in hard-to-understand areas
  • [ x] Ran pnpm build
  • [ x] Ran pnpm fmt
  • [ x] Checked for warnings, there are none
  • [ x] Removed all console.logs
  • [ x] Merged the latest changes from main onto my branch with git pull origin main
  • [ x] My changes don't cause any responsiveness issues

Appreciated

  • [ x
Screen.Recording.2024-12-06.at.08.04.01.mov

] If a UI change was made: Added a screen recording or screenshots to this PR

  • Updated the Unkey Docs if changes were necessary

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced responsive design for the Ratelimit Namespace Page, improving visibility and layout on smaller screens.
  • Bug Fixes

    • Adjusted layout behavior of the Empty Placeholder component for better width management and overflow prevention.
  • Style

    • Corrected CSS class name in the Code component to ensure proper styling.

Copy link

changeset-bot bot commented Dec 6, 2024

⚠️ No Changeset found

Latest commit: f578e16

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Dec 6, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 10, 2024 8:39am
engineering ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 10, 2024 8:39am
play ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 10, 2024 8:39am
www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 10, 2024 8:39am

Copy link

vercel bot commented Dec 6, 2024

@BadriVishalPadhy is attempting to deploy a commit to the Unkey Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

coderabbitai bot commented Dec 6, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

The pull request introduces modifications to enhance the responsive design of the RatelimitNamespacePage, EmptyPlaceholder, and Code components. Changes include hiding the "Requests" header on smaller screens, adjusting the layout of the EmptyPlaceholder, and correcting a CSS class in the Code component. The core functionality and data handling logic of these components remain intact, ensuring that the overall user experience on the RateLimit page is improved without altering existing features.

Changes

File Path Change Summary
apps/dashboard/app/(app)/ratelimits/[namespaceId]/page.tsx Updated <h2> visibility for responsiveness; adjusted <Code> component styling for better display on smaller devices.
apps/dashboard/components/dashboard/empty-placeholder.tsx Changed inner <div> className to improve layout behavior and prevent overflow.
apps/dashboard/components/ui/code.tsx Corrected inlineflex to inline-flex in codeVariants constant for proper styling.

Assessment against linked issues

Objective Addressed Explanation
Address responsiveness issue on RateLimit page (2409)

Possibly related PRs

  • chore: ratelimit curl snippets changed to -H #2644: The changes in the main PR regarding the RatelimitNamespacePage component's styling and functionality are related to the modifications made in this PR, which also involves updates to the same component, specifically enhancing the curl command snippets and refining the handling of the interval parameter.
  • fix: Replaced clear button with reset filters button #2703: The changes in the main PR focus on improving the layout and responsiveness of the RatelimitNamespacePage, which aligns with the updates made in this PR that involve modifying the Filters component's layout and button functionality, enhancing user interaction and clarity.
  • fix: Ratelimit identifier component changes #2712: This PR involves changes to the Filters component, which is part of the same functionality as the RatelimitNamespacePage. The updates in both PRs aim to improve user interaction and state management within the rate limit components.

Suggested labels

Bug, Dashboard, 🕹️ oss.gg, :joystick: 150 points

Suggested reviewers

  • mcstepp
  • chronark
  • perkinsjr
  • ogzhanolguncu

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 0823c8d and f578e16.

📒 Files selected for processing (1)
  • apps/dashboard/components/ui/code.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/dashboard/components/ui/code.tsx

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 generate docstrings to generate docstrings for this PR. (Experiment)
  • @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.

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.

Copy link
Contributor

github-actions bot commented Dec 6, 2024

Thank you for following the naming conventions for pull request titles! 🙏

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

🧹 Outside diff range and nitpick comments (3)
apps/dashboard/components/ui/code.tsx (1)

7-7: Consider documenting padding requirements for consumers

The removal of default padding (px-2.5 py-2) from the base component shifts the responsibility to consumers. While this allows for more flexibility, it could lead to inconsistent padding across different usages.

Consider adding a comment in the code to document that padding should be handled by the consumer, or create usage examples in the component's documentation.

apps/dashboard/components/dashboard/empty-placeholder.tsx (1)

18-18: Simplify width classes

The combination of w-full and max-w-full is redundant as w-full already sets the width to 100%.

-      <div className="overflow-hidden w-full max-w-full flex flex-col items-center justify-center text-center">
+      <div className="overflow-hidden w-full flex flex-col items-center justify-center text-center">
apps/dashboard/app/(app)/ratelimits/[namespaceId]/page.tsx (1)

216-216: Simplify spacing classes and ensure consistent text size

The spacing and text size classes could be simplified for better maintainability.

-          <Code className="flex items-start  gap-0 sm:gap-8 p-4 my-8  text-xs  sm:text-xxs text-start overflow-x-auto max-w-full">
+          <Code className="flex items-start gap-0 sm:gap-8 p-4 my-8 text-xs sm:text-sm text-start overflow-x-auto max-w-full">

Note: Consider if text-xxs was intended as it's smaller than text-xs. Usually, text should be larger on bigger screens for better readability.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 9bd8be6 and 0823c8d.

📒 Files selected for processing (3)
  • apps/dashboard/app/(app)/ratelimits/[namespaceId]/page.tsx (2 hunks)
  • apps/dashboard/components/dashboard/empty-placeholder.tsx (1 hunks)
  • apps/dashboard/components/ui/code.tsx (1 hunks)
🔇 Additional comments (2)
apps/dashboard/app/(app)/ratelimits/[namespaceId]/page.tsx (2)

155-157: LGTM! Good responsive design practice

Hiding the "Requests" header on mobile screens (hidden sm:block) is a good practice for improving space utilization on smaller devices while maintaining the header on larger screens.


Line range hint 155-216: Verify responsive behavior across different devices

The responsive design changes look good, but please ensure testing across various devices and screen sizes to verify:

  1. The header visibility transition at the sm breakpoint
  2. Code snippet readability and overflow behavior
  3. Text size changes across breakpoints
✅ Verification successful

Responsive design implementation verified with no issues found

The code scan reveals that all responsive classes in the file follow Tailwind's best practices:

  • Header visibility uses hidden sm:block for proper breakpoint transition
  • Grid layout uses responsive classes (grid-cols-2 lg:grid-cols-4)
  • Text sizing is properly handled with responsive utilities (text-xs sm:text-xxs)
  • No problematic fixed-width classes that could break the layout
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for any hardcoded pixel values or non-responsive classes that might affect layout
rg -g '*.tsx' -g '*.css' 'px-\[.*?\]|w-\[.*?\]|h-\[.*?\]' apps/dashboard/

Length of output: 15630

@BadriVishalPadhy
Copy link
Contributor Author

@perkinsjr this wasn't required i guess

@chronark
Copy link
Collaborator

chronark commented Dec 9, 2024

cc @ogzhanolguncu

@BadriVishalPadhy
Copy link
Contributor Author

@ogzhanolguncu Do checkout . . .

@ogzhanolguncu
Copy link
Contributor

@ogzhanolguncu Do checkout . . .

Great work @BadriVishalPadhy. If you are willing fix one more issue on this page after this is resolved:
From this:
image
To this:
Screenshot 2024-12-10 at 11 35 17

Feel free to open a ticket and do this. Don't forget to move separators as well don't do it like the SS 😄

@ogzhanolguncu ogzhanolguncu added this pull request to the merge queue Dec 10, 2024
Merged via the queue into unkeyed:main with commit 2364e6b Dec 10, 2024
24 of 25 checks passed
@BadriVishalPadhy
Copy link
Contributor Author

@ogzhanolguncu

should it become vertically aligned in mobile view or in all views . . .

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

Successfully merging this pull request may close these issues.

[oss.gg hackathon][Bug]:Responsiveness issue on RateLimit page
4 participants