Skip to content

[Dashboard] Add detailed usage breakdown and billing preview #7290

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

Conversation

jnsdls
Copy link
Member

@jnsdls jnsdls commented Jun 5, 2025

Add Usage Breakdown Page for Team Billing

This PR adds a new usage breakdown page that provides detailed information about a team's current billing period usage. The implementation includes:

  • A new API endpoint to fetch billed usage data from the server
  • A detailed usage breakdown UI that shows:
    • Total estimated cost for the current billing period
    • Categorized usage with line items showing quantity, unit price, and amount
    • Proper formatting for currency values
  • Navigation links between billing settings, invoice history, and usage pages
  • An informational alert explaining that billing thresholds and discounts aren't reflected in the estimate

The PR also updates the billing info component to include a link to the new usage breakdown page, making it easier for users to understand their current charges.

Summary by CodeRabbit

  • New Features

    • Introduced a detailed usage breakdown section for teams, displaying categorized billed usage with line items, quantities, and subtotals.
    • Added summary cards showing the billing period and total estimated usage cost.
    • Added quick navigation buttons to billing settings and invoice history from the usage page.
    • Added a new page for account abstraction usage with a sponsored transactions table and subscription checks.
  • Refactor

    • Simplified the usage page by consolidating usage data fetching and removing multiple API calls in favor of a single billed usage preview.
    • Updated date formatting across the dashboard to use a unified date formatting function for consistency.
    • Enhanced billing info display with improved titles and links for usage details.
    • Streamlined import statements for date formatting utilities across multiple components.
  • Bug Fixes

    • Improved error handling to display user-friendly messages if required subscription data is missing.
  • Style

    • Enhanced layout and UI elements for better readability and navigation.
  • Removed

    • Deprecated the previous usage analytics dashboard and related components.
    • Removed legacy RPC usage fetching functionality.

PR-Codex overview

This PR primarily focuses on refactoring date formatting across various components by replacing formatDate with format from date-fns. It also introduces new components for displaying usage category details and updates the layout of the usage page to include billing settings and invoice history links.

Detailed summary

  • Deleted Usage.tsx and UsageCard.tsx.
  • Replaced formatDate with format in multiple components.
  • Added UsageCategoryDetails component to display usage category details.
  • Updated usage page layout to include buttons for billing settings and invoice history.
  • Enhanced PlanInfoCardUI to show subscription details with a link to view usage breakdown.
  • Introduced formatPrice helper for currency formatting.

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

Copy link

vercel bot commented Jun 5, 2025

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

Name Status Preview Comments Updated (UTC)
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 6, 2025 7:12am
4 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Skipped (Inspect) Jun 6, 2025 7:12am
login ⬜️ Skipped (Inspect) Jun 6, 2025 7:12am
thirdweb_playground ⬜️ Skipped (Inspect) Jun 6, 2025 7:12am
wallet-ui ⬜️ Skipped (Inspect) Jun 6, 2025 7:12am

@vercel vercel bot temporarily deployed to Preview – thirdweb_playground June 5, 2025 21:52 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 June 5, 2025 21:52 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui June 5, 2025 21:52 Inactive
@vercel vercel bot temporarily deployed to Preview – login June 5, 2025 21:52 Inactive
Copy link

changeset-bot bot commented Jun 5, 2025

⚠️ No Changeset found

Latest commit: f7fde11

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
Contributor

coderabbitai bot commented Jun 5, 2025

Walkthrough

The changes introduce a new billing preview API module and a React component for displaying usage category details. Several files related to usage analytics and RPC usage fetching are removed. The team usage page is refactored to use the new billing preview data, with a simplified control flow and updated UI components for usage breakdown and summary. Minor UI enhancements and prop signature updates are also made in the billing settings and layout components. Additionally, multiple files replace formatDate imports from date-fns with format and update usages accordingly. A new account abstraction usage page component is added with authentication and subscription checks.

Changes

File(s) Change Summary
apps/dashboard/src/@/api/usage/billing-preview.ts Added a new module for fetching billed usage data and defining related types.
apps/dashboard/src/@/api/usage/rpc.ts Removed RPC usage data type and fetching function.
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/_components/usage-category-details.tsx Added a new component for rendering detailed usage category breakdown and a helper for formatting prices.
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/billing/components/PlanInfoCard.tsx Updated component signatures to accept teamSlug, enhanced title prop for usage subscription overview, minor text changes.
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/layout.tsx Enhanced usage page layout with navigation buttons to billing and invoice history, added sidebar link.
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/overview/components/Usage.tsx Removed the main usage analytics React component and related utility functions.
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/overview/components/UsageCard.tsx Removed the usage card UI component and its progress bar subcomponent.
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/page.tsx Refactored the usage page to fetch and display billed usage summary and details; removed old analytics logic.
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/account-abstraction/page.tsx Added new async React page component for account abstraction usage with authentication and subscription checks.
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/page.tsx Exported previously local async function AsyncTotalSponsoredCard.
apps/dashboard/src/@/components/blocks/charts/area-chart.tsx Replaced import and usage of formatDate with format from date-fns.
apps/dashboard/src/@/components/blocks/charts/bar-chart.tsx Replaced import and usage of formatDate with format from date-fns.
apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/account-permissions/components/account-signer.tsx Changed import of formatDistance to import from main date-fns package.
apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/analytics/ContractAnalyticsPage.tsx Replaced import and usage of formatDate with format from date-fns.
apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/overview/components/Analytics.tsx Replaced import and usage of formatDate with format from date-fns.
apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/PriceChart.tsx Replaced import and usage of formatDate with format from date-fns.
apps/dashboard/src/app/(app)/(dashboard)/published-contract/[publisher]/[contract_id]/[version]/opengraph-image.tsx Changed import of format to import from main date-fns package.
apps/dashboard/src/app/(app)/(dashboard)/published-contract/[publisher]/[contract_id]/opengraph-image.tsx Changed import of format to import from main date-fns package.
apps/dashboard/src/app/(app)/account/wallets/LinkWalletUI.tsx Replaced import and usage of formatDate with format from date-fns.
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/analytics/components/EcosystemWalletUsersChartCard.tsx Replaced import and usage of formatDate with format from date-fns.
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/projects/TeamProjectsPage.tsx Replaced import and usage of formatDate with format from date-fns.
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/members/ManageInvitesSection.tsx Replaced import and usage of formatDate with format from date-fns.
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/rpc/components/count-graph.tsx Replaced import and usage of formatDate with format from date-fns.
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/rpc/components/rate-graph.tsx Replaced import and usage of formatDate with format from date-fns.
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/storage/your-files.tsx Consolidated imports of format and formatDistance from date-fns.
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/components/EngineCloudChartCard/EngineCloudBarChartCardUI.tsx Replaced import and usage of formatDate with format from date-fns.
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/components/RpcMethodBarChartCard/RpcMethodBarChartCardUI.tsx Replaced import and usage of formatDate with format from date-fns.
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/cloud/analytics/tx-chart/tx-chart-ui.tsx Replaced import and usage of formatDate with format from date-fns.
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/cloud/analytics/tx-table/tx-table-ui.tsx Consolidated imports of formatDistanceToNowStrict and format from date-fns.
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/cloud/server-wallets/wallet-table/wallet-table-ui.client.tsx Consolidated imports of formatDistanceToNowStrict and format from date-fns.
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/alerts/components/ManageEngineAlerts.tsx Replaced import and usage of formatDate with format from date-fns.
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/overview/components/transactions-table.tsx Consolidated imports and replaced usage of formatDate with format from date-fns.
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/nebula/components/analytics/nebula-analytics-ui.tsx Replaced import and usage of formatDate with format from date-fns.
apps/dashboard/src/components/contract-components/published-contract/index.tsx Changed import of format to import from main date-fns package.
apps/dashboard/src/components/embedded-wallets/Analytics/InAppWalletUsersChartCard.tsx Replaced import and usage of formatDate with format from date-fns.
apps/dashboard/src/components/embedded-wallets/Users/index.tsx Changed import of format to import from main date-fns package.
apps/dashboard/src/components/settings/AuthorizedWallets/AuthorizedWalletsTable.tsx Changed import of format to import from main date-fns package.
apps/dashboard/src/components/smart-wallets/AccountAbstractionAnalytics/SponsoredTransactionsChartCard.tsx Replaced import and usage of formatDate with format from date-fns.
apps/dashboard/src/components/smart-wallets/AccountAbstractionAnalytics/TotalSponsoredChartCard.tsx Replaced import and usage of formatDate with format from date-fns.
apps/dashboard/src/utils/date-utils.ts Consolidated imports of format and isValid from date-fns.

Sequence Diagram(s)

sequenceDiagram
    participant Page
    participant BillingPreviewAPI
    participant PlanInfoCard
    participant UsageCategoryDetails

    Page->>BillingPreviewAPI: getBilledUsage(teamSlug)
    BillingPreviewAPI-->>Page: UsageApiResponse (usage categories)
    Page->>PlanInfoCard: Fetch team subscriptions
    Page->>UsageCategoryDetails: For each UsageCategory in UsageApiResponse
    UsageCategoryDetails-->>Page: Render category details
Loading
sequenceDiagram
    participant PlanInfoCard
    participant BillingInfo
    participant SubscriptionOverview

    PlanInfoCard->>BillingInfo: Pass teamSlug and subscriptions
    BillingInfo->>SubscriptionOverview: Pass subscription and title (string or React node)
    SubscriptionOverview-->>BillingInfo: Render title (conditional on type)
Loading
sequenceDiagram
    participant AccountAbstractionPage as AccountAbstractionPage
    participant TeamDataAPI as TeamDataAPI
    participant Auth as Auth
    participant SubscriptionsAPI as SubscriptionsAPI
    participant ProjectsAPI as ProjectsAPI
    participant ThirdwebClient as ThirdwebClient
    participant SponsoredTransactionsTable as SponsoredTransactionsTable

    AccountAbstractionPage->>TeamDataAPI: fetch team by slug
    AccountAbstractionPage->>Auth: get auth token
    alt Not authenticated
        Auth-->>AccountAbstractionPage: redirect to login
    else Team not found
        TeamDataAPI-->>AccountAbstractionPage: redirect to /team
    else
        AccountAbstractionPage->>SubscriptionsAPI: fetch team subscriptions
        AccountAbstractionPage->>ProjectsAPI: fetch team projects
        alt No usage subscription
            AccountAbstractionPage-->>User: render upgrade prompt
        else
            AccountAbstractionPage->>ThirdwebClient: initialize with JWT and team ID
            AccountAbstractionPage->>SponsoredTransactionsTable: render with props
        end
    end
Loading
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.
  • @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 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.

@jnsdls jnsdls marked this pull request as ready for review June 5, 2025 21:52
@jnsdls jnsdls requested review from a team as code owners June 5, 2025 21:52
@github-actions github-actions bot added the Dashboard Involves changes to the Dashboard. label Jun 5, 2025
Copy link
Member Author

jnsdls commented Jun 5, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link

codecov bot commented Jun 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 55.58%. Comparing base (c95c0dc) to head (f7fde11).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7290   +/-   ##
=======================================
  Coverage   55.58%   55.58%           
=======================================
  Files         909      909           
  Lines       58670    58670           
  Branches     4158     4158           
=======================================
  Hits        32609    32609           
  Misses      25954    25954           
  Partials      107      107           
Flag Coverage Δ
packages 55.58% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

🔭 Outside diff range comments (1)
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/layout.tsx (1)

5-11: 🛠️ Refactor suggestion

params should not be typed as a Promise in a Next-app Router layout
params is synchronously provided by the framework; declaring it as Promise forces an unneeded await, hurts type-safety, and can break IDE IntelliSense.

-export default async function Layout(props: {
-  children: React.ReactNode;
-  params: Promise<{
-    team_slug: string;
-  }>;
-}) {
-  const params = await props.params;
+export default function Layout(props: {
+  children: React.ReactNode;
+  params: {
+    team_slug: string;
+  };
+}) {
+  const params = props.params;
🧹 Nitpick comments (4)
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/layout.tsx (1)

15-30: Minor accessibility & semantics tweak for the action buttons
Using Button with asChild keeps visual styling but the final element is still an <a>. Consider adding aria-label (or descriptive link text) so screen-reader users can understand the destinations without needing surrounding context.

apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/billing/components/PlanInfoCard.tsx (1)

299-309: Ensure the composite “Usage” title remains semantically correct
h5 is rendered conditionally inside a flex container that already sits in an h5 context when the prop is a string. Wrapping a link inside the heading avoids duplicate heading levels and improves semantics:

-<div className="flex items-center">
-  <h5 className="mr-1 font-medium text-base">Usage</h5>{" "}
-  <span className="text-muted-foreground text-sm">
-    -{" "}
-    <Link
-      className="hover:underline"
-      href={`/team/${teamSlug}/~/usage`}
-    >
-      View Breakdown
-    </Link>
-  </span>
-</div>
+<h5 className="font-medium text-base">
+  Usage{" "}
+  <span className="text-muted-foreground text-sm">
+    –{" "}
+    <Link className="hover:underline" href={`/team/${teamSlug}/~/usage`}>
+      View&nbsp;Breakdown
+    </Link>
+  </span>
+</h5>
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/page.tsx (1)

50-71: Repeated “Something went wrong” blocks indicate copy-paste; extract helper or compress logic
You can guard once and render a common error component to keep the page concise.

apps/dashboard/src/app/(app)/team/[team_slug]/(team)/_components/usage-category-details.tsx (1)

63-65: Consider improving the key generation strategy.

Using ${item.description}_${index} for React keys could cause issues if descriptions are not unique, as the same description would generate duplicate keys.

Consider using a more robust key if available:

-                  key={`${item.description}_${index}`}
+                  key={item.id || `${item.description}_${index}`}

Or if there's no unique identifier, consider using a hash of the item properties.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c77b4d8 and 4027a3f.

📒 Files selected for processing (8)
  • apps/dashboard/src/@/api/usage/billing-preview.ts (1 hunks)
  • apps/dashboard/src/@/api/usage/rpc.ts (0 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/_components/usage-category-details.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/billing/components/PlanInfoCard.tsx (4 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/layout.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/overview/components/Usage.tsx (0 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/overview/components/UsageCard.tsx (0 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/page.tsx (2 hunks)
💤 Files with no reviewable changes (3)
  • apps/dashboard/src/@/api/usage/rpc.ts
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/overview/components/UsageCard.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/overview/components/Usage.tsx
🧰 Additional context used
🧬 Code Graph Analysis (1)
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/billing/components/PlanInfoCard.tsx (1)
apps/dashboard/src/@/api/team-subscription.ts (1)
  • TeamSubscription (23-40)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: Size
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Lint Packages
  • GitHub Check: Unit Tests
  • GitHub Check: Build Packages
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (7)
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/page.tsx (1)

23-31: 🛠️ Refactor suggestion

params is declared as Promise but supplied synchronously by Next.js
Same issue as in layout.tsx, remove the Promise and the await.

⛔ Skipped due to learnings
Learnt from: MananTank
PR: thirdweb-dev/js#7152
File: apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/accounts/page.tsx:2-10
Timestamp: 2025-05-26T16:28:10.079Z
Learning: In Next.js 14+, the `params` object in page components is always a Promise that needs to be awaited, so the correct typing is `params: Promise<ParamsType>` rather than `params: ParamsType`.
Learnt from: jnsdls
PR: thirdweb-dev/js#6929
File: apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/insight/webhooks/page.tsx:14-19
Timestamp: 2025-05-21T05:17:31.283Z
Learning: In Next.js server components, the `params` object can sometimes be a Promise that needs to be awaited, despite type annotations suggesting otherwise. In apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/insight/webhooks/page.tsx, it's necessary to await the params object before accessing its properties.
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/_components/usage-category-details.tsx (6)

1-21: LGTM! Clean imports and interface definition.

The imports are well-organized and the interface is appropriately typed.


24-27: LGTM! Correct total calculation.

The reduce operation correctly sums the amountUsdCents from all line items.


75-78: LGTM! Appropriate formatPrice usage.

The formatPrice calls correctly use isUnitPrice: true for unit prices (allowing higher precision) and standard formatting for amounts.

Also applies to: 81-81


109-130: LGTM! Well-implemented currency formatting function.

The formatPrice function handles edge cases properly:

  • Converts string inputs to numbers
  • Returns "N/A" for invalid values
  • Correctly converts cents to dollars
  • Uses appropriate precision for unit prices vs. regular amounts
  • Follows standard currency formatting conventions

86-94: LGTM! Appropriate placeholder for empty state.

The "No usage during this period" message properly handles the case when all line items are filtered out.


98-104: LGTM! Conditional subtotal display.

The subtotal is appropriately shown only when there are actual charges, improving the UI clarity.

Copy link
Contributor

github-actions bot commented Jun 5, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 62.57 KB (0%) 1.3 s (0%) 276 ms (+244.48% 🔺) 1.6 s
thirdweb (cjs) 345.55 KB (0%) 7 s (0%) 631 ms (+0.67% 🔺) 7.6 s
thirdweb (minimal + tree-shaking) 5.7 KB (0%) 114 ms (0%) 88 ms (+1970.76% 🔺) 202 ms
thirdweb/chains (tree-shaking) 531 B (0%) 11 ms (0%) 44 ms (+1819.29% 🔺) 54 ms
thirdweb/react (minimal + tree-shaking) 19.56 KB (0%) 392 ms (0%) 77 ms (+321.74% 🔺) 468 ms

@jnsdls jnsdls force-pushed the _Dashboard_Add_detailed_usage_breakdown_and_billing_preview branch from 4027a3f to a5ad05d Compare June 5, 2025 23:09
@vercel vercel bot temporarily deployed to Preview – login June 5, 2025 23:09 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground June 5, 2025 23:09 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 June 5, 2025 23:09 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui June 5, 2025 23:09 Inactive
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: 3

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4027a3f and a5ad05d.

📒 Files selected for processing (38)
  • apps/dashboard/src/@/api/usage/billing-preview.ts (1 hunks)
  • apps/dashboard/src/@/api/usage/rpc.ts (0 hunks)
  • apps/dashboard/src/@/components/blocks/charts/area-chart.tsx (2 hunks)
  • apps/dashboard/src/@/components/blocks/charts/bar-chart.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/account-permissions/components/account-signer.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/analytics/ContractAnalyticsPage.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/overview/components/Analytics.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/PriceChart.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/(dashboard)/published-contract/[publisher]/[contract_id]/[version]/opengraph-image.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/(dashboard)/published-contract/[publisher]/[contract_id]/opengraph-image.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/account/wallets/LinkWalletUI.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/_components/usage-category-details.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/analytics/components/EcosystemWalletUsersChartCard.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/projects/TeamProjectsPage.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/billing/components/PlanInfoCard.tsx (5 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/members/ManageInvitesSection.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/layout.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/overview/components/Usage.tsx (0 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/overview/components/UsageCard.tsx (0 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/page.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/rpc/components/count-graph.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/rpc/components/rate-graph.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/storage/your-files.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/components/EngineCloudChartCard/EngineCloudBarChartCardUI.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/components/RpcMethodBarChartCard/RpcMethodBarChartCardUI.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/cloud/analytics/tx-chart/tx-chart-ui.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/cloud/analytics/tx-table/tx-table-ui.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/cloud/server-wallets/wallet-table/wallet-table-ui.client.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/alerts/components/ManageEngineAlerts.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/overview/components/transactions-table.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/nebula/components/analytics/nebula-analytics-ui.tsx (2 hunks)
  • apps/dashboard/src/components/contract-components/published-contract/index.tsx (1 hunks)
  • apps/dashboard/src/components/embedded-wallets/Analytics/InAppWalletUsersChartCard.tsx (2 hunks)
  • apps/dashboard/src/components/embedded-wallets/Users/index.tsx (1 hunks)
  • apps/dashboard/src/components/settings/AuthorizedWallets/AuthorizedWalletsTable.tsx (1 hunks)
  • apps/dashboard/src/components/smart-wallets/AccountAbstractionAnalytics/SponsoredTransactionsChartCard.tsx (2 hunks)
  • apps/dashboard/src/components/smart-wallets/AccountAbstractionAnalytics/TotalSponsoredChartCard.tsx (2 hunks)
  • apps/dashboard/src/utils/date-utils.ts (1 hunks)
💤 Files with no reviewable changes (3)
  • apps/dashboard/src/@/api/usage/rpc.ts
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/overview/components/UsageCard.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/overview/components/Usage.tsx
✅ Files skipped from review due to trivial changes (28)
  • apps/dashboard/src/components/contract-components/published-contract/index.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/storage/your-files.tsx
  • apps/dashboard/src/app/(app)/(dashboard)/published-contract/[publisher]/[contract_id]/opengraph-image.tsx
  • apps/dashboard/src/components/embedded-wallets/Users/index.tsx
  • apps/dashboard/src/app/(app)/(dashboard)/published-contract/[publisher]/[contract_id]/[version]/opengraph-image.tsx
  • apps/dashboard/src/@/components/blocks/charts/bar-chart.tsx
  • apps/dashboard/src/components/settings/AuthorizedWallets/AuthorizedWalletsTable.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/nebula/components/analytics/nebula-analytics-ui.tsx
  • apps/dashboard/src/utils/date-utils.ts
  • apps/dashboard/src/components/embedded-wallets/Analytics/InAppWalletUsersChartCard.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/cloud/analytics/tx-table/tx-table-ui.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/alerts/components/ManageEngineAlerts.tsx
  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/overview/components/Analytics.tsx
  • apps/dashboard/src/components/smart-wallets/AccountAbstractionAnalytics/SponsoredTransactionsChartCard.tsx
  • apps/dashboard/src/components/smart-wallets/AccountAbstractionAnalytics/TotalSponsoredChartCard.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/members/ManageInvitesSection.tsx
  • apps/dashboard/src/@/components/blocks/charts/area-chart.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/rpc/components/rate-graph.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/cloud/server-wallets/wallet-table/wallet-table-ui.client.tsx
  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/PriceChart.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/components/RpcMethodBarChartCard/RpcMethodBarChartCardUI.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/overview/components/transactions-table.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/components/EngineCloudChartCard/EngineCloudBarChartCardUI.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/cloud/analytics/tx-chart/tx-chart-ui.tsx
  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/account-permissions/components/account-signer.tsx
  • apps/dashboard/src/app/(app)/account/wallets/LinkWalletUI.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/analytics/components/EcosystemWalletUsersChartCard.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/_components/usage-category-details.tsx
🚧 Files skipped from review as they are similar to previous changes (4)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/layout.tsx
  • apps/dashboard/src/@/api/usage/billing-preview.ts
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/billing/components/PlanInfoCard.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/page.tsx
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: Unit Tests
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: Size
  • GitHub Check: Build Packages
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Lint Packages
  • GitHub Check: Analyze (javascript)

@jnsdls jnsdls force-pushed the _Dashboard_Add_detailed_usage_breakdown_and_billing_preview branch from a5ad05d to 0c782cc Compare June 6, 2025 00:35
@vercel vercel bot temporarily deployed to Preview – docs-v2 June 6, 2025 00:35 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui June 6, 2025 00:35 Inactive
@vercel vercel bot temporarily deployed to Preview – login June 6, 2025 00:35 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground June 6, 2025 00:35 Inactive
@jnsdls jnsdls added the DO NOT MERGE This pull request is still in progress and is not ready to be merged. label Jun 6, 2025 — with Graphite App
@jnsdls jnsdls force-pushed the _Dashboard_Add_detailed_usage_breakdown_and_billing_preview branch from 0c782cc to 9e051ff Compare June 6, 2025 04:43
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground June 6, 2025 04:43 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui June 6, 2025 04:43 Inactive
@vercel vercel bot temporarily deployed to Preview – login June 6, 2025 04:43 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 June 6, 2025 04:43 Inactive
@jnsdls jnsdls force-pushed the _Dashboard_Add_detailed_usage_breakdown_and_billing_preview branch from 9e051ff to 497a570 Compare June 6, 2025 04:52
@vercel vercel bot temporarily deployed to Preview – wallet-ui June 6, 2025 04:52 Inactive
@vercel vercel bot temporarily deployed to Preview – login June 6, 2025 04:52 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 June 6, 2025 04:52 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground June 6, 2025 04:52 Inactive
@jnsdls jnsdls force-pushed the _Dashboard_Add_detailed_usage_breakdown_and_billing_preview branch from 497a570 to aec443c Compare June 6, 2025 06:50
@vercel vercel bot temporarily deployed to Preview – docs-v2 June 6, 2025 06:50 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground June 6, 2025 06:50 Inactive
@vercel vercel bot temporarily deployed to Preview – login June 6, 2025 06:50 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui June 6, 2025 06:50 Inactive
@jnsdls jnsdls force-pushed the _Dashboard_Add_detailed_usage_breakdown_and_billing_preview branch from aec443c to f7fde11 Compare June 6, 2025 07:04
@vercel vercel bot temporarily deployed to Preview – login June 6, 2025 07:04 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui June 6, 2025 07:04 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 June 6, 2025 07:04 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground June 6, 2025 07:04 Inactive
@jnsdls jnsdls removed the DO NOT MERGE This pull request is still in progress and is not ready to be merged. label Jun 6, 2025
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: 2

🧹 Nitpick comments (1)
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/account-abstraction/page.tsx (1)

4-6: Consider using absolute imports for better maintainability.

The relative imports with multiple ../ segments reduce readability and make refactoring more difficult.

Consider updating the import paths to use absolute imports if configured in your TypeScript/bundler setup:

-import { getProjects } from "../../../../../../../../@/api/projects";
-import { getTeamSubscriptions } from "../../../../../../../../@/api/team-subscription";
-import { getAuthToken } from "../../../../../../api/lib/getAuthToken";
+import { getProjects } from "@/api/projects";
+import { getTeamSubscriptions } from "@/api/team-subscription";
+import { getAuthToken } from "@/api/lib/getAuthToken";
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between aec443c and f7fde11.

📒 Files selected for processing (40)
  • apps/dashboard/src/@/api/usage/billing-preview.ts (1 hunks)
  • apps/dashboard/src/@/api/usage/rpc.ts (0 hunks)
  • apps/dashboard/src/@/components/blocks/charts/area-chart.tsx (2 hunks)
  • apps/dashboard/src/@/components/blocks/charts/bar-chart.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/account-permissions/components/account-signer.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/analytics/ContractAnalyticsPage.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/overview/components/Analytics.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/PriceChart.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/(dashboard)/published-contract/[publisher]/[contract_id]/[version]/opengraph-image.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/(dashboard)/published-contract/[publisher]/[contract_id]/opengraph-image.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/account/wallets/LinkWalletUI.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/_components/usage-category-details.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/analytics/components/EcosystemWalletUsersChartCard.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/projects/TeamProjectsPage.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/billing/components/PlanInfoCard.tsx (5 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/members/ManageInvitesSection.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/account-abstraction/page.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/layout.tsx (3 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/overview/components/Usage.tsx (0 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/overview/components/UsageCard.tsx (0 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/page.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/rpc/components/count-graph.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/rpc/components/rate-graph.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/storage/your-files.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/components/EngineCloudChartCard/EngineCloudBarChartCardUI.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/components/RpcMethodBarChartCard/RpcMethodBarChartCardUI.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/cloud/analytics/tx-chart/tx-chart-ui.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/cloud/analytics/tx-table/tx-table-ui.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/cloud/server-wallets/wallet-table/wallet-table-ui.client.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/alerts/components/ManageEngineAlerts.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/overview/components/transactions-table.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/nebula/components/analytics/nebula-analytics-ui.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/page.tsx (1 hunks)
  • apps/dashboard/src/components/contract-components/published-contract/index.tsx (1 hunks)
  • apps/dashboard/src/components/embedded-wallets/Analytics/InAppWalletUsersChartCard.tsx (2 hunks)
  • apps/dashboard/src/components/embedded-wallets/Users/index.tsx (1 hunks)
  • apps/dashboard/src/components/settings/AuthorizedWallets/AuthorizedWalletsTable.tsx (1 hunks)
  • apps/dashboard/src/components/smart-wallets/AccountAbstractionAnalytics/SponsoredTransactionsChartCard.tsx (2 hunks)
  • apps/dashboard/src/components/smart-wallets/AccountAbstractionAnalytics/TotalSponsoredChartCard.tsx (2 hunks)
  • apps/dashboard/src/utils/date-utils.ts (1 hunks)
💤 Files with no reviewable changes (3)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/overview/components/UsageCard.tsx
  • apps/dashboard/src/@/api/usage/rpc.ts
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/overview/components/Usage.tsx
✅ Files skipped from review due to trivial changes (10)
  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/account-permissions/components/account-signer.tsx
  • apps/dashboard/src/components/settings/AuthorizedWallets/AuthorizedWalletsTable.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/storage/your-files.tsx
  • apps/dashboard/src/app/(app)/(dashboard)/published-contract/[publisher]/[contract_id]/opengraph-image.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/cloud/server-wallets/wallet-table/wallet-table-ui.client.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/cloud/analytics/tx-table/tx-table-ui.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/components/RpcMethodBarChartCard/RpcMethodBarChartCardUI.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/cloud/analytics/tx-chart/tx-chart-ui.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/nebula/components/analytics/nebula-analytics-ui.tsx
  • apps/dashboard/src/@/api/usage/billing-preview.ts
🚧 Files skipped from review as they are similar to previous changes (25)
  • apps/dashboard/src/app/(app)/(dashboard)/published-contract/[publisher]/[contract_id]/[version]/opengraph-image.tsx
  • apps/dashboard/src/components/contract-components/published-contract/index.tsx
  • apps/dashboard/src/components/embedded-wallets/Users/index.tsx
  • apps/dashboard/src/@/components/blocks/charts/area-chart.tsx
  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/PriceChart.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/rpc/components/rate-graph.tsx
  • apps/dashboard/src/utils/date-utils.ts
  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/overview/components/Analytics.tsx
  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/analytics/ContractAnalyticsPage.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/rpc/components/count-graph.tsx
  • apps/dashboard/src/@/components/blocks/charts/bar-chart.tsx
  • apps/dashboard/src/components/embedded-wallets/Analytics/InAppWalletUsersChartCard.tsx
  • apps/dashboard/src/components/smart-wallets/AccountAbstractionAnalytics/SponsoredTransactionsChartCard.tsx
  • apps/dashboard/src/app/(app)/account/wallets/LinkWalletUI.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/members/ManageInvitesSection.tsx
  • apps/dashboard/src/components/smart-wallets/AccountAbstractionAnalytics/TotalSponsoredChartCard.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/layout.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/analytics/components/EcosystemWalletUsersChartCard.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/overview/components/transactions-table.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/components/EngineCloudChartCard/EngineCloudBarChartCardUI.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/projects/TeamProjectsPage.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/page.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/_components/usage-category-details.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/billing/components/PlanInfoCard.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/alerts/components/ManageEngineAlerts.tsx
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: Unit Tests
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: Build Packages
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Lint Packages
  • GitHub Check: Size
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (5)
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/page.tsx (1)

260-260: LGTM! Clean refactoring to support component reusability.

Exporting AsyncTotalSponsoredCard aligns well with the PR objectives of adding detailed usage breakdown and billing preview functionality. This enables the component to be reused in other parts of the application while maintaining the existing implementation unchanged.

apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/account-abstraction/page.tsx (4)

16-19: Good use of concurrent data fetching.

Excellent use of Promise.all to fetch data concurrently, which improves performance by avoiding sequential API calls.

Also applies to: 29-32


34-45: Well-implemented subscription validation with clear user feedback.

The subscription type checking and user-friendly error message for free plan users provides a good user experience with clear next steps.


52-64: Clean component structure and appropriate prop passing.

The component renders the SponsoredTransactionsTable with all necessary props including the subscription period boundaries, which ensures the usage data is scoped to the correct billing period.


21-23: ⚠️ Potential issue

Fix missing return statement after loginRedirect.

The loginRedirect call is not followed by a return statement, which means execution will continue even after the redirect is initiated. This could lead to unexpected behavior or runtime errors.

Add a return statement after the redirect:

  if (!authToken) {
    loginRedirect(`/team/${params.team_slug}/~/usage/account-abstraction`);
+   return;
  }
⛔ Skipped due to learnings
Learnt from: MananTank
PR: thirdweb-dev/js#7285
File: apps/dashboard/src/app/(app)/(dashboard)/published-contract/components/uri-based-deploy.tsx:57-57
Timestamp: 2025-06-05T13:59:49.886Z
Learning: In the thirdweb dashboard Next.js app, when using loginRedirect() in server components, ensure to add a return statement after the redirect call to prevent further code execution and potential security issues.
Learnt from: MananTank
PR: thirdweb-dev/js#7228
File: apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/connect/in-app-wallets/settings/page.tsx:23-25
Timestamp: 2025-05-30T18:14:57.074Z
Learning: In the dashboard codebase, the `loginRedirect` function performs an actual page redirect that automatically stops execution, similar to Next.js `redirect()`. No return statement is needed after calling `loginRedirect` as it handles flow control internally.

@jnsdls jnsdls merged commit f89c15c into main Jun 6, 2025
24 of 25 checks passed
@jnsdls jnsdls deleted the _Dashboard_Add_detailed_usage_breakdown_and_billing_preview branch June 6, 2025 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dashboard Involves changes to the Dashboard.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant