Skip to content

Update KpiCard and Table components#280

Merged
kylengn merged 10 commits intomainfrom
feat/update-table-kpi-card
Jan 2, 2026
Merged

Update KpiCard and Table components#280
kylengn merged 10 commits intomainfrom
feat/update-table-kpi-card

Conversation

@kylengn
Copy link
Contributor

@kylengn kylengn commented Dec 31, 2025

Summary by CodeRabbit

Release Notes

  • New Features

    • KPI cards now display loading states with skeleton placeholders
    • Table headers feature integrated search and action controls
    • Enhanced loading state visualization in data tables
  • Refactor

    • Expanded and reorganized dashboard component interfaces
  • Style

    • Refined table row bottom borders and corner rounding appearance

✏️ Tip: You can customize this high-level summary in your review settings.

@kylengn kylengn self-assigned this Dec 31, 2025
Copilot AI review requested due to automatic review settings December 31, 2025 11:18
@vercel
Copy link

vercel bot commented Dec 31, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
react-ui Ready Ready Preview, Comment Jan 2, 2026 11:44am

@coderabbitai
Copy link

coderabbitai bot commented Dec 31, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

This PR comprehensively refactors KPI cards and table components to use Card-based layouts, introduces loading skeleton support and a query-driven KPI group builder, removes search props from the table wrapper in favor of header actions, and propagates scoped container rendering through table pagination and column components. The public dashboard API surface expands significantly with new exports and types.

Changes

Cohort / File(s) Summary
KPI Card Refactoring
libs/react/ui/src/components/dashboard/components/kpi-card.tsx
Rewrites KpiCard and KpiCardsGroup using Card wrappers; extends KpiCardProps/KpiCardsGroupProps with ComponentProps<'div'>; adds isLoading boolean prop with Skeleton rendering; introduces new SelectorConfig type and KpiCardsGroupFromQuery generic component for selector-based card building with value extraction, formatting, and labeling.
Dashboard Index Exports
libs/react/ui/src/components/dashboard/index.ts
Expands public API with new KPI types (KpiCardProps, KpiCardsGroupFromQueryConfig, KpiCardsGroupFromQueryProps, SelectorConfig, KpiVariant), components (KpiCard, KpiCardsGroup, KpiCardsGroupFromQuery), sidebar, context, filters, toolbar, and table exports; removes AnalyticsPage and JobsPage.
Page Components
libs/react/ui/src/components/dashboard/pages/analytics-page.tsx, jobs-page.tsx
Moves search handling from inline search props to headerActions slot in TableWrapper; adds SearchInline and Button components in header; removes searchQuery/onSearchChange/onSearchClear props.
Table Wrapper & Layout
libs/react/ui/src/components/dashboard/table/table-wrapper.tsx
Refactors header from typography to Card-based layout with CardHeader/CardContent; removes search-related props (searchQuery, onSearchChange, onSearchClear, searchPlaceholder); adds isLoading and scopedContainer props for portal rendering.
Table Scoped Container Threading
libs/react/ui/src/components/table/data-table.tsx, table-column-header.tsx, table-pagination.tsx
Adds scopedContainer prop to thread through table components; updates DropdownMenuContent and SelectContent to render into scoped container via container prop; updates CardContent border-radius from rounded-b-8 to rounded-8.
Table Row Styling
libs/react/ui/src/components/table/table.tsx
Changes last TableRow class from "last:border-b-0 last:rounded-b-8" to "last:rounded-b-8", retaining bottom border while adding rounded corners.
Item Component
libs/react/ui/src/components/item/item.stories.tsx
Replaces inline HTML <kbd> element with typed Kbd component import in ImportPastJobsModal.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • EnzalRad
  • dvxam
  • noe-charmet

Poem

🐰 ✨ Cards now wrap the KPI light,
Skeletons dance while loading's right,
Queries build our groups with grace,
Tables find their scoped place!
Refactored, neat, the dashboard's bright! 🎨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title describes core changes (KpiCard and Table components) but misses the main addition (KpiCardsGroupFromQuery) and broader context including dashboard UI updates and public API expansion. Consider a more specific title like 'Add KpiCardsGroupFromQuery and refactor dashboard components' or 'Update KPI/table components with query-based card group and header actions' to better capture the primary changes.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a new generic KpiCardsGroupFromQuery component and refactors table components to support scoped container portals, along with various UI improvements to the dashboard table wrapper and related components.

  • Adds KpiCardsGroupFromQuery component for generating KPI cards from query-like data structures
  • Introduces scopedContainer prop to table components for controlling dropdown portal rendering
  • Refactors TableWrapper to use Card components and simplifies its API by removing built-in search functionality

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
libs/react/ui/src/components/table/table.tsx Removes last:border-b-0 class from table rows to fix border styling
libs/react/ui/src/components/table/table-pagination.tsx Adds scopedContainer prop for controlling select dropdown portal placement and adds border-b-0 to pagination row
libs/react/ui/src/components/table/table-column-header.tsx Adds scopedContainer prop for dropdown menu portal and wraps header text with Text component
libs/react/ui/src/components/table/data-table.tsx Adds scopedContainer prop and passes it through to child components, updates CardContent border radius
libs/react/ui/src/components/dashboard/table/table-wrapper.tsx Major refactor: removes built-in search functionality, migrates to Card components, and simplifies API by moving search/actions to headerActions prop
libs/react/ui/src/components/dashboard/pages/jobs-page.tsx Removes comments and moves SearchInline/Button components to headerActions prop of TableWrapper
libs/react/ui/src/components/dashboard/pages/analytics-page.tsx Removes comments and moves SearchInline/Button components to headerActions prop of TableWrapper
libs/react/ui/src/components/item/item.stories.tsx Replaces inline kbd element with Kbd component
libs/react/ui/src/components/dashboard/index.ts Adds exports for new KPI card types and removes inline comments
libs/react/ui/src/components/dashboard/components/kpi-card.tsx Adds new KpiCardsGroupFromQuery generic component, loading state support to KpiCard, and improves styling for mobile/desktop layouts

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@argos-ci
Copy link

argos-ci bot commented Dec 31, 2025

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) 👍 Changes approved 12 changed, 8 added Jan 2, 2026, 11:45 AM

Copy link

@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

🧹 Nitpick comments (2)
libs/react/ui/src/components/table/table-column-header.tsx (1)

110-110: Unused ref: headerRef is created but never used.

The headerRef is assigned to the outer div on line 123 but is never read or passed anywhere. If it was intended as a fallback container for the dropdown, it's not being used. Consider removing it to avoid confusion.

🔎 Proposed fix
 export function TableColumnHeader<TData, TValue>({
   column,
   title,
   className,
   scopedContainer,
 }: TableColumnHeaderProps<TData, TValue>) {
-  const headerRef = useRef<HTMLDivElement>(null);
-
   if (!column.getCanSort()) {

And on line 123:

-    <div ref={headerRef} className={cn('flex items-center space-x-2', className)}>
+    <div className={cn('flex items-center space-x-2', className)}>

If you no longer need useRef, also remove the import:

-import {useRef} from 'react';
libs/react/ui/src/components/table/table-pagination.tsx (1)

80-80: Unused ref: paginationRef is created but never used.

Similar to TableColumnHeader, the paginationRef is assigned to TableFooter but is never read or utilized. If it was intended as a fallback container, it's not being used since scopedContainer is passed directly to SelectContent.

🔎 Proposed fix
 }: TablePaginationProps<TData>) {
-  const paginationRef = useRef<HTMLTableSectionElement>(null);
   const currentPage = table.getState().pagination.pageIndex + 1;

And on line 88:

-    <TableFooter ref={paginationRef} className={className} {...props}>
+    <TableFooter className={className} {...props}>

If you no longer need useRef, also remove the import:

-import {useRef} from 'react';
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3a67c61 and 9bba9af.

📒 Files selected for processing (10)
  • libs/react/ui/src/components/dashboard/components/kpi-card.tsx
  • libs/react/ui/src/components/dashboard/index.ts
  • libs/react/ui/src/components/dashboard/pages/analytics-page.tsx
  • libs/react/ui/src/components/dashboard/pages/jobs-page.tsx
  • libs/react/ui/src/components/dashboard/table/table-wrapper.tsx
  • libs/react/ui/src/components/item/item.stories.tsx
  • libs/react/ui/src/components/table/data-table.tsx
  • libs/react/ui/src/components/table/table-column-header.tsx
  • libs/react/ui/src/components/table/table-pagination.tsx
  • libs/react/ui/src/components/table/table.tsx
🧰 Additional context used
📓 Path-based instructions (1)
**/*

⚙️ CodeRabbit configuration file

We handle errors at the edge of our applications in most cases. Do not recommend to add error handling around every single function. We prefer them to bubble up and be handled at upper layers.

Files:

  • libs/react/ui/src/components/item/item.stories.tsx
  • libs/react/ui/src/components/table/table-pagination.tsx
  • libs/react/ui/src/components/table/table-column-header.tsx
  • libs/react/ui/src/components/table/table.tsx
  • libs/react/ui/src/components/dashboard/pages/analytics-page.tsx
  • libs/react/ui/src/components/dashboard/pages/jobs-page.tsx
  • libs/react/ui/src/components/table/data-table.tsx
  • libs/react/ui/src/components/dashboard/table/table-wrapper.tsx
  • libs/react/ui/src/components/dashboard/components/kpi-card.tsx
  • libs/react/ui/src/components/dashboard/index.ts
🧬 Code graph analysis (7)
libs/react/ui/src/components/item/item.stories.tsx (1)
libs/react/ui/src/components/kbd/kbd.tsx (1)
  • Kbd (6-20)
libs/react/ui/src/components/table/table-pagination.tsx (2)
libs/react/ui/src/components/table/table.tsx (2)
  • TableFooter (95-95)
  • TableRow (95-95)
libs/react/ui/src/components/select/select.tsx (1)
  • SelectContent (212-212)
libs/react/ui/src/components/table/table-column-header.tsx (3)
libs/react/ui/src/components/typography/text.tsx (1)
  • Text (27-50)
libs/react/ui/src/components/dropdown-menu/dropdown-menu.tsx (3)
  • DropdownMenu (388-388)
  • DropdownMenuTrigger (389-389)
  • DropdownMenuContent (391-391)
libs/react/ui/src/components/button/button.tsx (1)
  • Button (50-91)
libs/react/ui/src/components/dashboard/pages/jobs-page.tsx (7)
libs/react/ui/src/components/dashboard/index.ts (1)
  • TableWrapper (38-38)
libs/react/ui/src/components/dashboard/table/table-wrapper.tsx (1)
  • TableWrapper (106-154)
libs/react/ui/src/components/dashboard/table/index.ts (1)
  • TableWrapper (6-6)
libs/react/ui/src/components/table/table.stories.columns.tsx (1)
  • jobColumns (196-196)
libs/react/ui/src/components/search/search-inline.tsx (1)
  • SearchInline (14-108)
libs/react/ui/src/components/button/button.tsx (1)
  • Button (50-91)
libs/react/ui/src/components/icon/icon.tsx (1)
  • Icon (86-90)
libs/react/ui/src/components/table/data-table.tsx (1)
libs/react/ui/src/components/card/card.tsx (1)
  • CardContent (68-74)
libs/react/ui/src/components/dashboard/table/table-wrapper.tsx (2)
libs/react/ui/src/components/card/card.tsx (4)
  • CardHeader (23-29)
  • CardTitle (33-39)
  • CardAction (58-64)
  • CardContent (68-74)
libs/react/ui/src/components/table/data-table.tsx (1)
  • DataTable (115-309)
libs/react/ui/src/components/dashboard/components/kpi-card.tsx (2)
libs/react/ui/src/components/typography/text.tsx (1)
  • Text (27-50)
libs/react/ui/src/components/skeleton/skeleton.tsx (1)
  • Skeleton (6-14)
🔇 Additional comments (19)
libs/react/ui/src/components/item/item.stories.tsx (1)

6-6: LGTM!

Good refactor to use the Kbd component instead of a raw <kbd> element. This ensures consistent styling across the codebase and leverages the component's built-in design tokens.

Also applies to: 108-108

libs/react/ui/src/components/table/table.tsx (1)

37-50: LGTM!

The styling change retains the bottom border on the last row while preserving the rounded corners. This aligns with the Card-based layout updates across table components.

libs/react/ui/src/components/table/table-column-header.tsx (1)

112-146: Good implementation of scoped container support.

The scopedContainer prop is correctly passed to DropdownMenuContent, and the Text component usage provides consistent typography. The fallback to undefined when scopedContainer is null is appropriate.

libs/react/ui/src/components/dashboard/components/kpi-card.tsx (3)

24-49: LGTM!

The KpiCard component is well-structured with proper loading state handling using Skeleton. The Card wrapper and typography usage are consistent with the design system.


55-90: Good responsive implementation.

The mobile-first approach with scroll-snap for swipeable cards and hidden scrollbars provides a solid UX. The responsive breakpoints for desktop flex layout are appropriate.


92-142: Well-documented generic interface.

The SelectorConfig and KpiCardsGroupFromQueryConfig interfaces are flexible and well-documented, allowing for various query-like structures to drive KPI card rendering.

libs/react/ui/src/components/table/data-table.tsx (2)

106-112: LGTM!

The scopedContainer prop is well-documented and correctly added to the component signature.

Also applies to: 127-127


297-304: Proper prop threading.

The scopedContainer is correctly passed down to TablePagination, enabling scoped portal rendering for the pagination dropdown.

libs/react/ui/src/components/dashboard/pages/jobs-page.tsx (2)

1-3: LGTM!

Clean imports for the new header action components.


41-54: Good refactor to header-driven search.

The headerActions pattern centralizes search and column controls in the table header, improving consistency with other pages. The SearchInline is properly bound to the existing searchQuery state, and the icon button has appropriate accessibility attributes.

libs/react/ui/src/components/dashboard/pages/analytics-page.tsx (2)

1-3: LGTM!

Consistent imports with jobs-page.tsx for header action components.


143-159: Consistent header actions pattern.

The implementation mirrors jobs-page.tsx, maintaining consistency across dashboard pages. The search and column insertion controls are appropriately placed in the table header.

libs/react/ui/src/components/table/table-pagination.tsx (2)

57-69: LGTM on scoped container implementation.

The scopedContainer prop is well-documented and correctly passed to SelectContent. The fallback to undefined when null is appropriate.

Also applies to: 77-77, 119-119


89-89: Border styling update.

Adding border-b-0 to the pagination row prevents double borders when nested within Card-based layouts.

libs/react/ui/src/components/dashboard/table/table-wrapper.tsx (3)

8-8: LGTM!

Card component imports are correctly added to support the new Card-based layout.


63-76: LGTM!

Well-documented new props. The scopedContainer prop is particularly useful for scoped CSS styling in embedded dashboard scenarios.


125-134: Clean Card-based layout implementation.

The responsive header with flex-col md:flex-row and the conditional rendering of headerActions within CardAction are well structured.

libs/react/ui/src/components/dashboard/index.ts (2)

4-12: LGTM!

The expanded KPI-related type exports and the new KpiCardsGroupFromQuery component export are well-organized. Separating type exports from value exports follows good TypeScript practices.


36-38: Summary inconsistency: AnalyticsPage and JobsPage are still exported.

The AI-generated summary claims these exports were removed, but they're present in the final code at line 36. The code takes precedence—this is simply a summary inaccuracy.

@kylengn kylengn changed the title Add new KpiCardsGroupFromQuery and update table components Update KpiCard and Table components Jan 2, 2026
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this one have a story ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@noe-charmet added a story for it here fe2e5cf

@kylengn kylengn merged commit 4e6f0f3 into main Jan 2, 2026
5 checks passed
@kylengn kylengn deleted the feat/update-table-kpi-card branch January 2, 2026 12:01
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.

2 participants