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(docs): added ts example for infinite pagination #2718

Open
wants to merge 2 commits into
base: canary
Choose a base branch
from

Conversation

kuri-sun
Copy link
Member

@kuri-sun kuri-sun commented Apr 15, 2024

Closes #2517

📝 Description

Added TS code example to Infinite Pagination in Table component.

⛳️ Current behavior (updates)

Only JS code example.

🚀 New behavior

Added TS example, following Async Filter example.

💣 Is this a breaking change (Yes/No):

No

📝 Additional Information

Summary by CodeRabbit

  • New Features

    • Enhanced the table component with infinite pagination, improving user experience with dynamic data loading.
    • Introduced a PackageManagers component for displaying installation commands.
  • Documentation

    • Updated various CodeDemo component settings across documentation to improve clarity and consistency in code examples.
  • Bug Fixes

    • Changed the default behavior of CodeDemo components to show the "Open in CodeSandbox" button by default unless explicitly disabled.

@kuri-sun kuri-sun added the 🐛 Type: Bug Something isn't working label Apr 15, 2024
@kuri-sun kuri-sun self-assigned this Apr 15, 2024
Copy link

linear bot commented Apr 15, 2024

ENG-506 [BUG] - Table

Copy link

changeset-bot bot commented Apr 15, 2024

⚠️ No Changeset found

Latest commit: ffcb957

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 Apr 15, 2024

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

Name Status Preview Comments Updated (UTC)
nextui-docs-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 15, 2024 1:13pm
nextui-storybook-v2 ✅ Ready (Inspect) Visit Preview Apr 15, 2024 1:13pm

Copy link
Contributor

coderabbitai bot commented Apr 15, 2024

Walkthrough

This update primarily involves enhancements and fixes across various documentation components in a Next.js and React project. Key changes include setting default properties for CodeDemo components, improving type safety in table component examples with infinite pagination, and disabling the "Open in CodeSandbox" option for several components to streamline user experience.

Changes

File Path Change Summary
.../code-demo/code-demo.tsx Default showOpenInCodeSandbox set to true.
.../table/infinite-pagination.ts Added infinite pagination with typing for data items using interfaces.
.../components/autocomplete.mdx, .../avatar.mdx, .../button.mdx, .../image.mdx, .../link.mdx, .../table.mdx showOpenInCodeSandbox set to false in CodeDemo components. Added imports and components in table.mdx.

Assessment against linked issues

Objective Addressed Explanation
Define an interface for items in infinite pagination [#2517]
Ensure type safety in asynchronous table loading [#2517]

Recent Review Details

Configuration used: .coderabbit.yaml

Commits Files that changed from the base of the PR and between abf532b and ffcb957.
Files selected for processing (8)
  • apps/docs/components/docs/components/code-demo/code-demo.tsx (2 hunks)
  • apps/docs/content/components/table/infinite-pagination.ts (1 hunks)
  • apps/docs/content/docs/components/autocomplete.mdx (3 hunks)
  • apps/docs/content/docs/components/avatar.mdx (2 hunks)
  • apps/docs/content/docs/components/button.mdx (1 hunks)
  • apps/docs/content/docs/components/image.mdx (1 hunks)
  • apps/docs/content/docs/components/link.mdx (1 hunks)
  • apps/docs/content/docs/components/table.mdx (1 hunks)
Additional comments not posted (13)
apps/docs/components/docs/components/code-demo/code-demo.tsx (1)

62-62: Ensure that setting showOpenInCodeSandbox to true by default aligns with the intended user experience across all documentation pages.

Verification successful

The search results indicate that the showOpenInCodeSandbox property is explicitly set to false in several documentation pages (e.g., table.mdx, button.mdx, image.mdx, etc.). This suggests that there are specific instances where the functionality to show "Open in CodeSandbox" is intentionally disabled, likely due to the nature of the demos or the user experience design on those pages.

Given that the default value of showOpenInCodeSandbox is now set to true in the CodeDemo component, it is important to note that this default will not affect the pages where it has been explicitly set to false. The explicit settings will override the default. However, for any new usage of the CodeDemo component where showOpenInCodeSandbox is not explicitly set, the sandbox option will be available by default.

This change aligns with the intended user experience, assuming that the default behavior (showing the CodeSandbox option) is desirable in most cases, except where explicitly disabled. Therefore, the change to set showOpenInCodeSandbox to true by default appears to be correctly implemented and should not conflict with existing configurations.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Search for any conditional usage of `showOpenInCodeSandbox` that might conflict with the new default setting.
rg --type tsx 'showOpenInCodeSandbox'

Length of output: 65



Script:

#!/bin/bash
# Search for any conditional usage of `showOpenInCodeSandbox` that might conflict with the new default setting.
rg 'showOpenInCodeSandbox'

Length of output: 1940

apps/docs/content/components/table/infinite-pagination.ts (1)

74-79: The TypeScript interface SWCharacter is well-defined. Ensure that all fields are necessary and correctly typed according to the data expected from the API.

apps/docs/content/docs/components/image.mdx (1)

68-68: Setting showOpenInCodeSandbox to false for the Next.js Image example is appropriate if the intention is to focus on inline demonstration rather than external sandbox testing. Confirm this aligns with the documentation strategy.

apps/docs/content/docs/components/avatar.mdx (2)

79-79: Disabling "Open in CodeSandbox" aligns with the PR's objective to focus on inline code demonstrations.


124-124: Consistent approach in disabling "Open in CodeSandbox" for the AvatarGroup custom implementation.

apps/docs/content/docs/components/link.mdx (1)

92-92: Disabling "Open in CodeSandbox" aligns with the PR's objective to streamline user experience.

apps/docs/content/docs/components/button.mdx (1)

91-91: Change aligns with PR objectives to enhance user experience by focusing on inline demonstrations.

apps/docs/content/docs/components/table.mdx (3)

277-283: Added PackageManagers component for installation commands.


286-289: Added imports for useInfiniteScroll and useAsyncList.


300-301: Modified CodeDemo component properties: Enabled preview and disabled CodeSandbox option.

apps/docs/content/docs/components/autocomplete.mdx (3)

208-208: Disabling "Open in CodeSandbox" for the "Fully Controlled" example aligns with the streamlined user experience objective.


258-258: Disabling "Open in CodeSandbox" for the "Asynchronous Filtering" example is consistent with the changes made in other sections.


285-285: Disabling "Open in CodeSandbox" for the "Asynchronous Loading" example maintains consistency across the documentation.


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.

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

@kuri-sun kuri-sun changed the title Bug table eng 506 fix(docs): added ts example for infinite pagination Apr 15, 2024
@wingkwong wingkwong changed the base branch from main to canary April 28, 2024 14:50
@kuri-sun kuri-sun assigned jrgarciadev and unassigned kuri-sun Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Type: Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] - Table
2 participants