Skip to content

Conversation

@paanSinghCoder
Copy link
Contributor

@paanSinghCoder paanSinghCoder commented Feb 9, 2026

Summary

  • Moved the Audit Logs page from apps/admin/src/pages/audit-logs/list/ to lib/admin/views/audit-logs/ (using git mv to preserve history)
  • Exported AuditLogsView from @raystack/frontier/admin as a router-agnostic view component with optional appName and onExportCsv props
  • Created a thin AuditLogsPage wrapper in apps/admin that provides app-specific dependencies (CSV export via admin client)
  • Created TSX icon components in lib to replace Vite-specific .svg?react imports
  • Added react-router-dom resolve alias in vite.config.ts and as an optional peer dependency in the lib
  • Upgraded @raystack/apsara in lib to 0.56.2 for useDebouncedState and CodeBlock type support
  • Fixed CSS modules key convention (localsConvention: 'camelCase') in tsup config to preserve kebab-case class name access

Test plan

  • Verify Audit Logs table renders full width
  • Verify side panel opens as overlay on row click
  • Verify CSV export works
  • Verify search/filter/sort functionality
  • Verify lib build (pnpm build in web/lib)
  • Verify app build (pnpm build in web/apps/admin)
  • Verify no regressions on Roles, Invoices, Products pages

@vercel
Copy link

vercel bot commented Feb 9, 2026

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

Project Deployment Actions Updated (UTC)
frontier Ready Ready Preview, Comment Feb 11, 2026 10:20am

@paanSinghCoder paanSinghCoder changed the base branch from main to feat/export-products-page February 9, 2026 12:51
@coderabbitai
Copy link

coderabbitai bot commented Feb 9, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

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.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR restructures the admin application from a container-based architecture to a page-based routing pattern. It moves utility functions (pagination, query transformation, timestamps) to a centralized lib/admin package, adds new UI components (PageHeader, PageTitle, SheetHeader), introduces new icon assets, and converts legacy container components into prop-driven page components. Routes are updated to use the new pages, and import paths are migrated to use centralized exports from @raystack/frontier/admin.

Changes

Cohort / File(s) Summary
Removed Legacy Containers
web/apps/admin/src/containers/products.list/, web/apps/admin/src/containers/roles.list/
Deleted entire product and role list/detail container components and their dependent files, removing hook-based data retrieval and route-integrated components.
New Page Components
web/apps/admin/src/pages/products/ProductsPage.tsx, web/apps/admin/src/pages/products/ProductPricesPage.tsx, web/apps/admin/src/pages/roles/RolesPage.tsx, web/apps/admin/src/pages/audit-logs/AuditLogsPage.tsx, web/apps/admin/src/pages/invoices/InvoicesPage.tsx
Added new page-level wrapper components that integrate router navigation and wire route parameters to corresponding view components.
View Components Refactored
web/lib/admin/views/products/index.tsx, web/lib/admin/views/products/details.tsx, web/lib/admin/views/products/prices/index.tsx, web/lib/admin/views/roles/index.tsx, web/lib/admin/views/roles/details.tsx, web/lib/admin/views/audit-logs/index.tsx, web/lib/admin/views/invoices/index.tsx
Converted from hook-based data retrieval to prop-driven components; added onExportCsv callbacks and appName support; changed signatures to accept controlled props instead of internal state.
Routing Updates
web/apps/admin/src/routes.tsx
Replaced legacy container imports with new page component imports; restructured route definitions to use ProductsPage, ProductPricesPage, RolesPage, AuditLogsPage, and InvoicesPage.
New Utility Modules
web/lib/admin/utils/connect-pagination.ts, web/lib/admin/utils/transform-query.ts, web/lib/admin/utils/connect-timestamp.ts, web/lib/admin/utils/helper.ts
Added pagination helpers, DataTableQuery-to-RQLRequest transformation, timestamp utilities (timestampToDate, isNullTimestamp), and data reduction helpers (reduceByKey, isZeroUUID).
New UI Components
web/lib/admin/components/PageHeader.tsx, web/lib/admin/components/PageTitle.tsx, web/lib/admin/components/SheetHeader.tsx
Introduced reusable header components with breadcrumb support, document title management, and sheet close buttons.
New Icon Assets
web/lib/admin/assets/icons/CpuChipIcon.tsx, web/lib/admin/assets/icons/InvoicesIcon.tsx, web/lib/admin/assets/icons/JsonIcon.tsx, web/lib/admin/assets/icons/KeyIcon.tsx, web/lib/admin/assets/icons/MapIcon.tsx
Added five new SVG icon components for UI elements.
Import Path Migrations
web/apps/admin/src/pages/organizations/details/apis/index.tsx, web/apps/admin/src/pages/organizations/details/invoices/index.tsx, web/apps/admin/src/pages/organizations/details/members/index.tsx, web/apps/admin/src/pages/organizations/details/projects/index.tsx, web/apps/admin/src/pages/organizations/details/projects/members/index.tsx, web/apps/admin/src/pages/organizations/details/tokens/index.tsx, web/apps/admin/src/pages/organizations/list/index.tsx, web/apps/admin/src/pages/users/list/list.tsx
Updated imports of transformDataTableQueryToRQLRequest and pagination utilities from local utils to centralized @raystack/frontier/admin exports.
Audit Logs View Updates
web/lib/admin/views/audit-logs/navbar.tsx, web/lib/admin/views/audit-logs/index.tsx, web/lib/admin/views/audit-logs/actor-cell.tsx, web/lib/admin/views/audit-logs/columns.tsx, web/lib/admin/views/audit-logs/sidepanel-*
Refactored AuditLogsView to accept onExportCsv callback; updated CSS module names (list.module.css → audit-logs.module.css); migrated icon and utility imports to new paths.
Products View Updates
web/lib/admin/views/products/columns.tsx, web/lib/admin/views/products/header.tsx, web/lib/admin/views/products/exports.ts, web/lib/admin/views/products/prices/columns.tsx, web/lib/admin/views/products/prices/index.tsx
Updated getColumns signatures to accept navigation callbacks; added ProductsHeader component; created exports.ts for centralized re-exports; migrated Price/Link components to Amount with callback-driven navigation.
Roles View Updates
web/lib/admin/views/roles/columns.tsx, web/lib/admin/views/roles/details.tsx, web/lib/admin/views/roles/header.tsx, web/lib/admin/views/roles/index.tsx
Converted RoleDetails to prop-based (accepts role prop); refactored RolesView from hook/router-driven to prop-driven with selectedRoleId and callbacks; updated permissions rendering to vertical layout.
Invoices View Updates
web/lib/admin/views/invoices/index.tsx, web/lib/admin/views/invoices/columns.tsx, web/lib/admin/views/invoices/navbar.tsx
Renamed InvoicesList to InvoicesView with appName prop support; updated CSS module reference; migrated icon imports.
Dependency & Config Changes
web/apps/admin/package.json, web/apps/admin/vite.config.ts, web/apps/admin/.eslintrc.cjs, web/lib/package.json, web/lib/tsup.config.ts, web/tools/eslint-config/index.js, web/apps/admin/src/utils/helper.ts
Updated @raystack/frontier to workspace reference; added react-router-dom as optional peer dependency; added admin entry to lib exports; configured vite alias for react-router-dom; removed admin .eslintrc.cjs; updated tsup to build admin module; updated eslint extends configuration.

Sequence Diagram(s)

sequenceDiagram
    participant Router as React Router
    participant Page as ProductsPage
    participant View as ProductsView
    participant API as FrontierServiceQueries
    
    Router->>Page: Render with :productId param
    Page->>Page: useParams() → productId<br/>useNavigate() → navigate
    Page->>View: Render with navigation callbacks
    View->>API: useQuery(listProducts)
    API-->>View: Product list data
    View->>View: Build product map by ID
    View->>View: Render DataTable with products
    Router->>View: User clicks product row
    View->>Page: onRowClick(id)
    Page->>Page: navigate(`/products/${id}`)
    Router->>Page: Update route, re-render
    Page->>View: Pass onNavigateToPrices callback
    Router->>View: User clicks "View Prices"
    View->>Page: onNavigateToPrices(productId)
    Page->>Page: navigate(`/products/${productId}/prices`)
    Router->>Page: Route to ProductPricesPage
Loading
sequenceDiagram
    participant Page as AuditLogsPage
    participant View as AuditLogsView
    participant Navbar as Navbar
    participant Admin as AdminClient
    participant Helper as exportCsvFromStream
    
    Page->>Page: Create adminClient with binary export
    Page->>Page: Define onExportCsv callback (memoized)
    Page->>View: Render with onExportCsv prop
    View->>Navbar: Pass onExportCsv handler
    Navbar->>Navbar: Query state updated
    Router->>Navbar: User clicks "Export CSV"
    Navbar->>Page: Call onExportCsv(query)
    Page->>Admin: adminClient.exportAuditRecords(mappedQuery)
    Admin-->>Helper: Stream response
    Helper->>Helper: Accumulate chunks as Blob
    Helper-->>Browser: Trigger download as CSV file
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 13.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Feat/export audit logs page' clearly summarizes the main change—exporting the audit logs page as a reusable view component.
Description check ✅ Passed The PR description comprehensively covers all required sections: a detailed summary of changes, technical details, and a complete test plan with checkboxes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/export-audit-logs-page

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

@paanSinghCoder paanSinghCoder self-assigned this Feb 9, 2026
@paanSinghCoder paanSinghCoder added the Do not merge Label to indicate that the PR is not ready to be merged even though might be (or not) approvals. label Feb 9, 2026
@coveralls
Copy link

coveralls commented Feb 9, 2026

Pull Request Test Coverage Report for Build 21901112133

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 38.24%

Totals Coverage Status
Change from base Build 21901106209: 0.0%
Covered Lines: 16107
Relevant Lines: 42121

💛 - Coveralls

@paanSinghCoder paanSinghCoder changed the title Feat/export audit logs page feat: export Audit logs page as a component and consume it in apps/admin Feb 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Do not merge Label to indicate that the PR is not ready to be merged even though might be (or not) approvals.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants