Skip to content

Chore/build configuration #77

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

Merged
merged 5 commits into from
Apr 23, 2025
Merged

Chore/build configuration #77

merged 5 commits into from
Apr 23, 2025

Conversation

tractorss
Copy link
Contributor

@tractorss tractorss commented Apr 22, 2025

PR-Codex overview

This PR introduces enhancements to the DraggableList component, including new props and a custom drag preview feature. It also updates styles and configuration files, and replaces a CSS import. Additionally, a new SVG icon is added.

Detailed summary

  • Added DraggableList export in lib/index.ts.
  • Modified BreadcrumbProps to use React.ReactNode.
  • Changed CSS import path in README.md.
  • Added SVG icons for drag-and-drop and trash.
  • Created draggable-list.stories.tsx for Storybook.
  • Introduced DraggableList component with drag-and-drop functionality.
  • Updated vite.config.ts to include new input handling.
  • Updated package.json version and dependencies.
  • Removed vite.config.theme.tssrc/lib/index.ts.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Summary by CodeRabbit

  • New Features
    • Breadcrumb component now supports React nodes as item text, allowing for more flexible breadcrumb content.
    • Introduced a draggable list component with drag-and-drop reordering and item deletion.
  • Documentation
    • Updated usage instructions for importing the Tailwind theme CSS file.
  • Chores
    • Simplified and restructured build configuration and output paths.
    • Updated and refined package dependencies and build scripts.
    • Removed the separate theme build configuration for a more streamlined build process.

Verified

This commit was signed with the committer’s verified signature.
tractorss TurbanCoder

Verified

This commit was signed with the committer’s verified signature.
tractorss TurbanCoder
Copy link
Contributor

coderabbitai bot commented Apr 22, 2025

Walkthrough

This update restructures the build configuration and output paths for a UI components library. The package entry points and style paths in package.json are updated to reflect a new organization under the dist/assets directory, and the theme CSS path is changed accordingly. The Vite build process is modified to dynamically generate multiple entry points from source files, and the dedicated theme build configuration is removed. Additionally, the breadcrumb component's prop type is expanded to accept any React node for its text, and new development dependencies are added for build tooling and CSS handling. A new draggable list React component with drag-and-drop and delete functionality is introduced, along with corresponding Storybook stories demonstrating default and custom drag preview usage.

Changes

File(s) Change Summary
README.md Updated usage instructions to import the theme CSS from the new dist/assets/theme.css path instead of the old dist/theme/theme.css location.
package.json Changed main/module/style/theme entry points to new paths under dist and dist/assets. Simplified build scripts, added sideEffects for CSS, and updated devDependencies for build tooling. Removed some dependencies from the main list.
src/lib/breadcrumb.tsx Changed the text property in BreadcrumbProps.items from string to React.ReactNode to allow more flexible content.
vite.config.theme.ts Deleted the dedicated Vite theme build configuration file.
vite.config.ts Enhanced Vite config to generate multiple entry points using glob, updated output file naming, and added the libInjectCss plugin.
src/lib/draggable-list/index.tsx Added new DraggableList React component supporting drag-and-drop reorder and delete, with customizable drag preview and selection callbacks.
src/stories/draggable-list.stories.tsx Added Storybook stories for DraggableList component demonstrating default and custom drag preview usage.
src/lib/index.ts Exported the new DraggableList component from the library’s main index file.

Sequence Diagram(s)

Loading
sequenceDiagram
    participant User
    participant DraggableList
    participant ListData
    participant ReactAria
    participant ReactState

    User->>DraggableList: Interact with list (drag, drop, delete, select)
    DraggableList->>ListData: Manage list state (reorder, remove)
    DraggableList->>ReactAria: Handle drag-and-drop behavior
    DraggableList->>ReactState: Update selection state
    DraggableList->>User: Render updated list and drag preview

Poem

🐇 Hopping through code with a joyful cheer,
New lists drag and drop, the path is clear.
Breadcrumbs now sparkle with React’s bright glow,
Build scripts trimmed down so the outputs flow.
Themes moved with grace, no config to bind,
In this garden of code, new treasures we find!
✨🌿


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 52defab and 14d2014.

📒 Files selected for processing (1)
  • package.json (6 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • package.json

🪧 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 sequence diagram to generate a sequence diagram of the changes in this 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 or @coderabbitai title 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]
coderabbitai bot previously approved these changes Apr 22, 2025
alcercu
alcercu previously approved these changes Apr 22, 2025
Copy link
Contributor

@alcercu alcercu left a comment

Choose a reason for hiding this comment

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

lgtm

Verified

This commit was signed with the committer’s verified signature.
tractorss TurbanCoder
@tractorss tractorss dismissed stale reviews from alcercu and coderabbitai[bot] via f89d9df April 23, 2025 07:44
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: 4

🧹 Nitpick comments (3)
src/lib/draggable-list/index.tsx (3)

17-21: Consider using a more specific type for value property.

The value property in ListItem is typed as any, which reduces type safety. Consider using a more specific type or making it generic to maintain type safety throughout the component.

type ListItem = {
  id: string | number;
  name: string;
-  value: any;
+  value: unknown;
};

Or make it generic:

-type ListItem = {
+type ListItem<T = unknown> = {
  id: string | number;
  name: string;
-  value: any;
+  value: T;
};

98-104: Consider extracting complex conditional classNames.

The conditional className logic is complex and might be difficult to maintain. Consider extracting it to a separate function or constant for better readability.

className={({ isHovered, isDragging, isSelected }) =>
  cn(
    "h-11.25 w-95.5 cursor-pointer border-l-3 border-l-transparent",
    "flex items-center gap-4 px-4",
    "focus-visible:outline-klerosUIComponentsPrimaryBlue focus-visible:outline",
-   (isHovered || isSelected) && "bg-klerosUIComponentsMediumBlue",
-   isSelected && "border-l-klerosUIComponentsPrimaryBlue",
-   isDragging && "cursor-grabbing opacity-60",
+   {
+     "bg-klerosUIComponentsMediumBlue": isHovered || isSelected,
+     "border-l-klerosUIComponentsPrimaryBlue": isSelected,
+     "cursor-grabbing opacity-60": isDragging
+   }
  )
}

41-49: Add a confirmation mechanism before deleting items.

The current implementation immediately deletes items without confirmation, which could lead to accidental deletions. Consider adding a confirmation step or an undo mechanism.

You could implement a confirmation dialog or a temporary state that allows users to undo deletions before they're permanently applied.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between e840f9c and f89d9df.

⛔ Files ignored due to path filters (2)
  • src/assets/svgs/drag-and-drop.svg is excluded by !**/*.svg
  • src/assets/svgs/trash.svg is excluded by !**/*.svg
📒 Files selected for processing (2)
  • src/lib/draggable-list/index.tsx (1 hunks)
  • src/stories/draggable-list.stories.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/stories/draggable-list.stories.tsx
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/lib/draggable-list/index.tsx (1)
src/utils/index.ts (1)
  • cn (4-6)
🔇 Additional comments (1)
src/lib/draggable-list/index.tsx (1)

1-139: Overall, this is a well-structured component with good features.

The DraggableList component effectively implements drag-and-drop functionality with appropriate accessibility considerations through react-aria-components. The code is generally well-organized with clear type definitions and a clean implementation pattern.

Key strengths:

  • Good separation of concerns
  • Well-documented props interface
  • Proper use of accessibility components
  • Clean conditional rendering
  • Responsive UI elements (hover states, drag handles)

The suggestions above will help improve type safety, performance, and error handling.

Verified

This commit was signed with the committer’s verified signature.
tractorss TurbanCoder
alcercu
alcercu previously approved these changes Apr 23, 2025
Copy link
Contributor

@alcercu alcercu left a comment

Choose a reason for hiding this comment

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

lgtm

Verified

This commit was signed with the committer’s verified signature.
tractorss TurbanCoder
Copy link
Contributor

@alcercu alcercu left a comment

Choose a reason for hiding this comment

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

lgtm

@alcercu alcercu merged commit d0d97b7 into main Apr 23, 2025
5 checks passed
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.

None yet

2 participants