assistant-ui icon indicating copy to clipboard operation
assistant-ui copied to clipboard

feat: implement Thread viewport with radix-ui scroll-area primitives

Open PieterT2000 opened this issue 10 months ago β€’ 9 comments

Addresses #1125


[!IMPORTANT] Implement Thread viewport using Radix UI scroll-area primitives, adding new components and updating existing ones.

  • Components:
    • Implement ScrollArea and ScrollBar components in scroll-area.tsx using @radix-ui/react-scroll-area.
    • Update ThreadPrimitiveRoot in ThreadRoot.tsx to use ScrollAreaPrimitive.Root and include ScrollBar.
    • Update ThreadPrimitiveViewport in ThreadViewport.tsx to use ScrollAreaPrimitive.Viewport.
  • Dependencies:
    • Add @radix-ui/react-scroll-area version 1.2.1 to package.json in both apps/registry and packages/react.
  • Misc:
    • Remove Scrollbar.mdx documentation file.

This description was created by Ellipsis for 448efd6906a824c59abbf00c9d0c7313a26c1131. It will automatically update as commits are pushed.

PieterT2000 avatar Feb 08 '25 20:02 PieterT2000

@PieterT2000 is attempting to deploy a commit to the assistant-ui Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Feb 08 '25 20:02 vercel[bot]

LGTM :+1:

πŸ“ Documentation updates detected! You can review documentation updates here

                        Promptless's comment below: 

The PR implements a significant change to the Thread component's scrollbar functionality, making it a built-in feature using Radix UI's scroll-area primitives. I've made the following documentation updates:

  1. Updated the Thread.mdx documentation to reflect that the Root component now uses Radix UI's ScrollArea.Root by default
  2. Updated the Viewport component documentation to indicate it uses ScrollArea.Viewport
  3. Added information about the built-in custom scrollbar functionality
  4. Fixed a typo in "Contains" (was "Containts")

The old Scrollbar.mdx documentation file has been removed as part of the PR since the functionality is now built into the core components. No additional documentation updates are needed since the feature is now handled automatically by the Thread component.

Let me summarize the changes for the user.

I've updated the documentation to reflect the new built-in scrollbar functionality in the Thread component. The main changes are:

  1. Updated the Thread primitive documentation to show that it now includes built-in custom scrollbar functionality using Radix UI's scroll-area primitives.
  2. Removed the separate Scrollbar.mdx documentation since this functionality is now built into the core Thread component.
  3. Updated the component descriptions to reflect that Root and Viewport components now use Radix UI's ScrollArea components by default.

These changes align with the PR's implementation of Thread viewport with Radix UI scroll-area primitives, making the custom scrollbar functionality a built-in feature rather than requiring manual setup.

promptless[bot] avatar Feb 08 '25 20:02 promptless[bot]

Walkthrough

The pull request removes the documentation file for implementing a custom scrollbar and introduces new scroll area components. A new file is added that defines ScrollArea and ScrollBar components using primitives from the @radix-ui/react-scroll-area library. The ThreadRoot and ThreadViewport components are updated to replace previous div implementations with these scroll area primitives, with corresponding updates to type definitions. In addition, a new ScrollBar component is added to another part of the codebase to manage scrollbar styling and functionality. The dependency on @radix-ui/react-scroll-area is updated in multiple package.json files to version 1.2.1, and the registry of components now includes an entry for "scroll-area". No changes were made to declarations of exported or public entities apart from the necessary updates to component references and type definitions.

[!WARNING] There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

πŸ”§ ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

apps/registry/components/ui/scroll-area.tsx

Oops! Something went wrong! :(

ESLint: 9.20.0

ESLint couldn't find an eslint.config.(js|mjs|cjs) file.

From ESLint v9.0.0, the default configuration file is now eslint.config.js. If you are using a .eslintrc.* file, please follow the migration guide to update your configuration file to the new format:

https://eslint.org/docs/latest/use/configure/migration-guide

If you still have problems after following the migration guide, please stop by https://eslint.org/chat/help to chat with the team.

packages/react/src/primitives/thread/ThreadViewport.tsx

Oops! Something went wrong! :(

ESLint: 9.20.0

ESLint couldn't find an eslint.config.(js|mjs|cjs) file.

From ESLint v9.0.0, the default configuration file is now eslint.config.js. If you are using a .eslintrc.* file, please follow the migration guide to update your configuration file to the new format:

https://eslint.org/docs/latest/use/configure/migration-guide

If you still have problems after following the migration guide, please stop by https://eslint.org/chat/help to chat with the team.

apps/registry/src/registry.ts

Oops! Something went wrong! :(

ESLint: 9.20.0

ESLint couldn't find an eslint.config.(js|mjs|cjs) file.

From ESLint v9.0.0, the default configuration file is now eslint.config.js. If you are using a .eslintrc.* file, please follow the migration guide to update your configuration file to the new format:

https://eslint.org/docs/latest/use/configure/migration-guide

If you still have problems after following the migration guide, please stop by https://eslint.org/chat/help to chat with the team.

  • 2 others
✨ Finishing Touches
  • [ ] πŸ“ Generate Docstrings (Beta)

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. (Beta)
  • @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.

coderabbitai[bot] avatar Feb 08 '25 20:02 coderabbitai[bot]

@trag-bot didn't find any issues in the code! βœ…βœ¨

trag-bot[bot] avatar Feb 08 '25 20:02 trag-bot[bot]

Pull request summary

  • Added documentation for integrating a custom scrollbar using @radix-ui/react-scroll-area.
  • Updated the registry to include the new scroll-area dependency.
  • Specified the @radix-ui/react-scroll-area version in the package.json file.
  • Modified ThreadPrimitiveRoot to use ScrollAreaPrimitive.Root instead of a primitive div.
  • Updated ThreadPrimitiveViewport to utilize ScrollAreaPrimitive.Viewport for better scroll handling.
  • Created a new ScrollBar component that wraps ScrollAreaPrimitive.ScrollAreaScrollbar.
  • Adjusted CSS styles for the custom scrollbar to ensure proper layout and appearance.
  • Updated the lock file to reflect the new dependencies and versions.
  • Ensured compatibility with existing components by maintaining the structure of Thread.Root and Thread.Viewport.
  • Enhanced the overall integration of the scrollbar component within the existing UI framework.

trag-bot[bot] avatar Feb 08 '25 20:02 trag-bot[bot]

Thank you so much, this is an amazing contribution - I need to do some testing on this before releasing it - will get back to you around Monday!

Yonom avatar Feb 09 '25 01:02 Yonom

Thanks! By the way, there don't seem to be any unit/integration tests yet. Is that a decision due to the library's rapidly evolving nature, or is it still being considered? The library is still <1.0.0, so users should expect things to break, but I would be happy to contribute in that area anyway.

PieterT2000 avatar Feb 10 '25 06:02 PieterT2000

@Yonom any updates on when this will be merged? Or is this already implemented with this: https://www.assistant-ui.com/docs/ui/Scrollbar

maxcodefaster avatar Mar 25 '25 08:03 maxcodefaster

@PieterT2000 sorry for the delay! we are looking to merge this soon, can you update and resolve conflicts? thanks for your contribution!

AVGVSTVS96 avatar Jun 02 '25 23:06 AVGVSTVS96

Sure, no problem!

PieterT2000 avatar Jun 03 '25 07:06 PieterT2000

We are going to revamp the scroll behavior in an upcoming release. Closing this issue for now

Yonom avatar Nov 17 '25 19:11 Yonom