Skip to content

Conversation

@MananTank
Copy link
Member

@MananTank MananTank commented Aug 14, 2025


PR-Codex overview

This PR primarily focuses on updating the MismatchButton component by replacing the PayEmbed with CheckoutWidget, adjusting transition timing in DynamicHeight, and refining the layout and styling in the dialog content.

Detailed summary

  • Changed transition duration in DynamicHeight from 250ms to 220ms.
  • Replaced PayEmbed with CheckoutWidget in MismatchButton.
  • Updated dialog class names for improved styling.
  • Removed the DynamicHeight wrapper around conditional content in MismatchButton.
  • Simplified button rendering in the no-funds case.

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

Summary by CodeRabbit

  • New Features

    • “Not enough funds” flow now uses a new checkout widget and only appears when your account is connected.
  • Style

    • Payment dialog is wider and uses full available width for improved readability.
    • Spacing and layout refined for a cleaner experience.
    • Slightly faster height transition animations for snappier UI feedback.
  • Refactor

    • Simplified dialog content by removing an extra height wrapper.

@vercel
Copy link

vercel bot commented Aug 14, 2025

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

Project Deployment Preview Comments Updated (UTC)
thirdweb-www Ready Preview Comment Aug 14, 2025 7:07pm
4 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
docs-v2 ⬜️ Skipped Aug 14, 2025 7:07pm
nebula ⬜️ Skipped Aug 14, 2025 7:07pm
thirdweb_playground ⬜️ Skipped Aug 14, 2025 7:07pm
wallet-ui ⬜️ Skipped Aug 14, 2025 7:07pm

@vercel vercel bot temporarily deployed to Preview – docs-v2 August 14, 2025 18:40 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground August 14, 2025 18:40 Inactive
@vercel vercel bot temporarily deployed to Preview – nebula August 14, 2025 18:40 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui August 14, 2025 18:40 Inactive
@changeset-bot
Copy link

changeset-bot bot commented Aug 14, 2025

⚠️ No Changeset found

Latest commit: 98eefdf

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 14, 2025

Walkthrough

Replaced PayEmbed with CheckoutWidget in MismatchButton’s Not Enough Funds flow (render gated by account), removed DynamicHeight wrapper/import and widened dialog styling; DynamicHeight's default height transition shortened from 250ms to 220ms.

Changes

Cohort / File(s) Summary
Tx pay flow refactor
apps/dashboard/src/@/components/tx-button/MismatchButton.tsx
Replaced PayEmbed import/usage with CheckoutWidget; gated rendering on account; added props name="Buy Funds", seller={account.address as \0x${string}`}, amount="0.01", chain={txChain}, theme=..., className="!w-full"; removed DynamicHeightwrapper and import; dialog width updated tomd:max-w-[480px]and!w-full; retained NoFundsDialogContent` without wrapper.
UI transition tweak
apps/dashboard/src/@/components/ui/DynamicHeight.tsx
Default CSS transition changed from height 250ms ease to height 220ms ease; no API/signature changes; behavior otherwise unchanged.

Sequence Diagram(s)

sequenceDiagram
  actor User
  participant MismatchButton
  participant Account
  participant CheckoutWidget
  participant Chain

  User->>MismatchButton: Trigger Not Enough Funds flow
  MismatchButton->>Account: Check account presence
  alt Account exists
    MismatchButton->>CheckoutWidget: Render with {name, seller, amount, chain, theme}
    User->>CheckoutWidget: Complete purchase
    CheckoutWidget->>Chain: Process payment
  else No account
    MismatchButton-->>User: Do not render CheckoutWidget
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • TEAM-0000: Entity not found: Issue - Could not find referenced Issue.
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 08-15-dashboard_fix_no_funds_payembed_in_transactionbutton

🪧 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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

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

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

@MananTank MananTank marked this pull request as ready for review August 14, 2025 18:40
@MananTank MananTank requested review from a team as code owners August 14, 2025 18:40
@github-actions github-actions bot added the Dashboard Involves changes to the Dashboard. label Aug 14, 2025
Copy link
Member Author


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.

@MananTank MananTank force-pushed the 08-15-dashboard_fix_no_funds_payembed_in_transactionbutton branch from f7acb72 to bd5a9c5 Compare August 14, 2025 18:44
@vercel vercel bot temporarily deployed to Preview – docs-v2 August 14, 2025 18:44 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui August 14, 2025 18:44 Inactive
@vercel vercel bot temporarily deployed to Preview – nebula August 14, 2025 18:44 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground August 14, 2025 18:44 Inactive
@codecov
Copy link

codecov bot commented Aug 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.34%. Comparing base (857d4df) to head (98eefdf).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7856   +/-   ##
=======================================
  Coverage   56.34%   56.34%           
=======================================
  Files         905      905           
  Lines       58834    58834           
  Branches     4150     4150           
=======================================
  Hits        33151    33151           
  Misses      25577    25577           
  Partials      106      106           
Flag Coverage Δ
packages 56.34% <ø> (ø)
🚀 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.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 14, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 64.06 KB (0%) 1.3 s (0%) 275 ms (+126.7% 🔺) 1.6 s
thirdweb (cjs) 357.05 KB (0%) 7.2 s (0%) 1.1 s (+12.44% 🔺) 8.2 s
thirdweb (minimal + tree-shaking) 5.73 KB (0%) 115 ms (0%) 104 ms (+1220.44% 🔺) 218 ms
thirdweb/chains (tree-shaking) 526 B (0%) 11 ms (0%) 105 ms (+2947.24% 🔺) 115 ms
thirdweb/react (minimal + tree-shaking) 19.15 KB (0%) 383 ms (0%) 117 ms (+668.37% 🔺) 500 ms

@graphite-app
Copy link
Contributor

graphite-app bot commented Aug 14, 2025

Merge activity

<!--

## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes"

If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000):

## Notes for the reviewer

Anything important to call out? Be sure to also clarify these in your comments.

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on updating the `MismatchButton` component by replacing the `PayEmbed` with `CheckoutWidget`, adjusting the transition duration in `DynamicHeight`, and streamlining the dialog content structure.

### Detailed summary
- Changed transition duration in `DynamicHeight` from `250ms` to `220ms`.
- Replaced `PayEmbed` with `CheckoutWidget` in the `MismatchButton` component.
- Simplified the dialog content structure by removing the `DynamicHeight` wrapper.
- Adjusted class names for consistency and clarity.

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

<!-- end pr-codex -->

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- New Features
  - “Not enough funds” flow now uses a new checkout widget and only appears when your account is connected.

- Style
  - Payment dialog is wider and uses full available width for improved readability.
  - Spacing and layout refined for a cleaner experience.
  - Slightly faster height transition animations for snappier UI feedback.

- Refactor
  - Simplified dialog content by removing an extra height wrapper.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@graphite-app graphite-app bot force-pushed the 08-15-dashboard_fix_no_funds_payembed_in_transactionbutton branch from bd5a9c5 to 98eefdf Compare August 14, 2025 18:58
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground August 14, 2025 18:58 Inactive
@vercel vercel bot temporarily deployed to Preview – nebula August 14, 2025 18:58 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 August 14, 2025 18:58 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui August 14, 2025 18:58 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: 1

🧹 Nitpick comments (3)
apps/dashboard/src/@/components/tx-button/MismatchButton.tsx (3)

21-28: Lazy-load CheckoutWidget to keep the dashboard bundle lean

CheckoutWidget is likely heavy. Since it only renders in the “pay” dialog, prefer a dynamic import to avoid shipping it in the initial bundle.

Apply this diff to remove the static import:

-import {
-  CheckoutWidget,
-  useActiveAccount,
+import {
+  useActiveAccount,
   useActiveWallet,
   useActiveWalletChain,
   useActiveWalletConnectionStatus,
   useSwitchActiveWalletChain,
   useWalletBalance,
 } from "thirdweb/react";

Then add the dynamic import (outside the selected range, near other imports):

import dynamic from "next/dynamic";

// Split out the widget and ensure it never SSRs in the dialog
const CheckoutWidget = dynamic(
  () => import("thirdweb/react").then((m) => m.CheckoutWidget),
  { ssr: false },
);

253-255: Make dialog width conditional per mode (pay vs. no-funds)

Right now md:!max-w-[480px] applies to both modes. If the intent is to widen only the “pay” view, conditionally set widths to maintain prior sizing for “no-funds”.

-          className={cn(
-            "gap-0 p-0 md:!max-w-[480px]",
-            dialog === "pay" && "border-none bg-transparent",
-          )}
+          className={cn(
+            "gap-0 p-0",
+            dialog === "pay"
+              ? "md:!max-w-[480px] border-none bg-transparent"
+              : "md:!max-w-[360px]",
+          )}

258-268: Removal of DynamicHeight: verify UX for height changes between views

Dropping the height animator may introduce a perceptible jump when switching from “no-funds” to “pay”. If this is intended, ignore. If not, consider a lightweight height transition on the container or per-section fade to smooth the swap.

📜 Review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these settings in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between bd5a9c5 and 98eefdf.

📒 Files selected for processing (2)
  • apps/dashboard/src/@/components/tx-button/MismatchButton.tsx (3 hunks)
  • apps/dashboard/src/@/components/ui/DynamicHeight.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/dashboard/src/@/components/ui/DynamicHeight.tsx
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (CLAUDE.md)

**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity
Re-use shared types from @/types or local types.ts barrels
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose

Files:

  • apps/dashboard/src/@/components/tx-button/MismatchButton.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit Inference Engine (CLAUDE.md)

Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)

Files:

  • apps/dashboard/src/@/components/tx-button/MismatchButton.tsx
apps/{dashboard,playground-web}/**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (CLAUDE.md)

apps/{dashboard,playground-web}/**/*.{ts,tsx}: Import UI primitives from @/components/ui/* (Button, Input, Select, Tabs, Card, Sidebar, Badge, Separator) in dashboard and playground apps
Use NavLink for internal navigation with automatic active states in dashboard and playground apps
Use Tailwind CSS only – no inline styles or CSS modules
Use cn() from @/lib/utils for conditional class logic
Use design system tokens (e.g., bg-card, border-border, text-muted-foreground)
Server Components (Node edge): Start files with import "server-only";
Client Components (browser): Begin files with 'use client';
Always call getAuthToken() to retrieve JWT from cookies on server side
Use Authorization: Bearer header – never embed tokens in URLs
Return typed results (e.g., Project[], User[]) – avoid any
Wrap client-side data fetching calls in React Query (@tanstack/react-query)
Use descriptive, stable queryKeys for React Query cache hits
Configure staleTime/cacheTime in React Query based on freshness (default ≥ 60s)
Keep tokens secret via internal API routes or server actions
Never import posthog-js in server components

Files:

  • apps/dashboard/src/@/components/tx-button/MismatchButton.tsx
🧠 Learnings (1)
📚 Learning: 2025-07-18T19:20:32.530Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Interactive UI that relies on hooks (`useState`, `useEffect`, React Query, wallet hooks).

Applied to files:

  • apps/dashboard/src/@/components/tx-button/MismatchButton.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Size
  • GitHub Check: Unit Tests
  • GitHub Check: Build Packages
  • GitHub Check: Lint Packages
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (1)
apps/dashboard/src/@/components/tx-button/MismatchButton.tsx (1)

359-360: LGTM: Clear CTA to open the pay flow

Button wiring to openPayModal is straightforward and consistent with the surrounding dialog logic.

Comment on lines +270 to +280
{dialog === "pay" && account && (
<CheckoutWidget
className="!w-full"
client={props.client}
chain={txChain}
amount="0.01"
name="Buy Funds"
seller={account.address as `0x${string}`}
theme={getSDKTheme(theme === "dark" ? "dark" : "light")}
/>
)}
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

CheckoutWidget usage: verify prop semantics; add resilience and reset behavior

  • Verify that seller={account.address} is the correct prop to direct funds to the connected wallet for “Buy Funds” use-cases. If the prop represents a merchant/recipient (not the buyer), confirm it aligns with your intended flow.
  • Consider forcing a remount when the chain or address changes to avoid stale internal state.
  • If the widget exposes success/close callbacks, wire them to setDialog(undefined) so the dialog closes on completion/cancel.

Apply this small resilience tweak (safe regardless of API details):

-            <CheckoutWidget
+            <CheckoutWidget
+              key={`${txChain.id}-${account.address}`}
               className="!w-full"
               client={props.client}
               chain={txChain}
               amount="0.01"
               name="Buy Funds"
               seller={account.address as `0x${string}`}
               theme={getSDKTheme(theme === "dark" ? "dark" : "light")}
             />

To confirm the prop semantics, please run this web query:


🌐 Web query:

What are the props and semantics of thirdweb’s React CheckoutWidget (particularly the meaning of the `seller` prop and expected format of `amount`)? Provide the relevant docs link.

💡 Result:

Short answer

  • seller — the recipient wallet (an Address) that will receive the payment. Pass the seller’s wallet address (e.g. "0x1234...abcd"). (portal.thirdweb.com)
  • amount — the purchase amount as a human‑readable string (e.g. "99" or "0.0002"). The CheckoutWidget TypeScript prop is typed as string, so prefer passing a string (examples in the docs sometimes show numeric literals, but the typed prop is string). The widget will interpret the amount relative to the other props you pass (currency / tokenAddress / supportedTokens). (portal.thirdweb.com)

Key props / semantics (most useful ones)

Recommended usage (TypeScript-friendly)

  • Pass amount as a string to match the prop type and avoid TS errors.
  • Pass seller as an address string (checksummed address string).
    Example:
    <CheckoutWidget
    client={client}
    chain={arbitrum}
    amount="99" // e.g. $99 (or "0.01" ETH depending on configuration)
    seller="0x1234...abcDEF" // wallet that should receive payouts
    name="Premium Course"
    description="Complete guide to web3 development"
    purchaseData={{ productId: "premium-course" }}
    onSuccess={() => { /* ... */ }}
    />

Relevant docs

If you want, I can:

  • paste the full prop type list from the API reference, or
  • show example permutations (fiat vs. token checkout) and how amount is interpreted in each case. Which would you prefer?

Citations:


Confirm CheckoutWidget props; implement remount key and close callbacks

  • seller={account.address} is correct: this prop directs payouts to the provided wallet.
  • amount="0.01" is the expected human-readable string format.
  • To avoid stale internal state, add a key prop that changes when txChain or account.address changes.
  • Wire the widget’s completion/cancel callbacks to setDialog(undefined) so the modal closes on success, error, or cancellation.

Proposed diff:

           {dialog === "pay" && account && (
-            <CheckoutWidget
+            <CheckoutWidget
+              key={`${txChain.id}-${account.address}`}
               className="!w-full"
               client={props.client}
               chain={txChain}
               amount="0.01"
               name="Buy Funds"
               seller={account.address as `0x${string}`}
+              onSuccess={() => setDialog(undefined)}
+              onError={() => setDialog(undefined)}
+              onCancel={() => setDialog(undefined)}
               theme={getSDKTheme(theme === "dark" ? "dark" : "light")}
             />
           )}

Reference: CheckoutWidget API – props and semantics (seller = recipient address, amount = human-readable string)
https://portal.thirdweb.com/references/typescript/v5/widgets/CheckoutWidget [1]

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{dialog === "pay" && account && (
<CheckoutWidget
className="!w-full"
client={props.client}
chain={txChain}
amount="0.01"
name="Buy Funds"
seller={account.address as `0x${string}`}
theme={getSDKTheme(theme === "dark" ? "dark" : "light")}
/>
)}
{dialog === "pay" && account && (
<CheckoutWidget
key={`${txChain.id}-${account.address}`}
className="!w-full"
client={props.client}
chain={txChain}
amount="0.01"
name="Buy Funds"
seller={account.address as `0x${string}`}
onSuccess={() => setDialog(undefined)}
onError={() => setDialog(undefined)}
onCancel={() => setDialog(undefined)}
theme={getSDKTheme(theme === "dark" ? "dark" : "light")}
/>
)}
🤖 Prompt for AI Agents
In apps/dashboard/src/@/components/tx-button/MismatchButton.tsx around lines 270
to 280, the CheckoutWidget needs a remount key and close callbacks: add a key
prop that changes when txChain or account.address changes (e.g.,
`${txChain}-${account.address}`) to force remounts when either changes, and pass
callbacks (onSuccess, onError, onCancel or the widget's equivalent) that call
setDialog(undefined) so the modal closes on completion, error, or cancellation;
keep seller as account.address and amount as "0.01".

@graphite-app graphite-app bot merged commit 98eefdf into main Aug 14, 2025
24 checks passed
@graphite-app graphite-app bot deleted the 08-15-dashboard_fix_no_funds_payembed_in_transactionbutton branch August 14, 2025 19:07
@vercel vercel bot temporarily deployed to Production – nebula August 14, 2025 19:07 Inactive
@vercel vercel bot temporarily deployed to Production – docs-v2 August 14, 2025 19:07 Inactive
@vercel vercel bot temporarily deployed to Production – thirdweb_playground August 14, 2025 19:07 Inactive
@vercel vercel bot temporarily deployed to Production – wallet-ui August 14, 2025 19:07 Inactive
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.

3 participants