Skip to content
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

[SDK] Add onClose callback to details modal #5605

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kien-ngo
Copy link
Contributor

@kien-ngo kien-ngo commented Dec 4, 2024

CNCT-2444
CNCT-2444


PR-Codex overview

This PR focuses on enhancing the ConnectButton component by adding an onClose callback for the details modal and improving the ChainIcon functionality, including test coverage and icon resolution.

Detailed summary

  • Added onClose callback to ConnectButton details modal options.
  • Improved fetchChainIcon logic for better icon resolution.
  • Enhanced test coverage for ChainIcon.
  • Created ChainActiveDot component for active chain indication.
  • Updated DetailsModal to utilize new callback and components.

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

Copy link

vercel bot commented Dec 4, 2024

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

Name Status Preview Comments Updated (UTC)
docs-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 14, 2024 11:43am
thirdweb_playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 14, 2024 11:43am
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 14, 2024 11:43am
wallet-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 14, 2024 11:43am

Copy link

changeset-bot bot commented Dec 4, 2024

🦋 Changeset detected

Latest commit: 99cc2f5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
thirdweb Patch
@thirdweb-dev/wagmi-adapter Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

graphite-app bot commented Dec 4, 2024

Your org has enabled the Graphite merge queue for merging into main

Add the label “merge-queue” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix.

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

@kien-ngo kien-ngo marked this pull request as ready for review December 4, 2024 11:07
Copy link
Contributor Author

kien-ngo commented Dec 4, 2024


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
Contributor

github-actions bot commented Dec 4, 2024

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 44.94 KB (0%) 899 ms (0%) 2.1 s (+18.99% 🔺) 3 s
thirdweb (cjs) 110.78 KB (0%) 2.3 s (0%) 3.8 s (-20.27% 🔽) 6.1 s
thirdweb (minimal + tree-shaking) 5.58 KB (0%) 112 ms (0%) 265 ms (-23.11% 🔽) 376 ms
thirdweb/chains (tree-shaking) 506 B (0%) 10 ms (0%) 27 ms (-49.53% 🔽) 37 ms
thirdweb/react (minimal + tree-shaking) 19.03 KB (0%) 381 ms (0%) 725 ms (+91.97% 🔺) 1.2 s

Copy link

codecov bot commented Dec 4, 2024

Codecov Report

Attention: Patch coverage is 24.10714% with 170 lines in your changes missing coverage. Please review.

Project coverage is 51.41%. Comparing base (ce0da51) to head (bbb3ab1).
Report is 14 commits behind head on main.

Files with missing lines Patch % Lines
...hirdweb/src/react/web/ui/ConnectWallet/Details.tsx 6.19% 106 Missing ⚠️
...src/react/web/ui/ConnectWallet/NetworkSelector.tsx 0.00% 59 Missing ⚠️
.../thirdweb/src/react/web/ui/prebuilt/Chain/icon.tsx 89.47% 4 Missing ⚠️
...thirdweb/src/react/web/ui/components/ChainIcon.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5605      +/-   ##
==========================================
- Coverage   51.53%   51.41%   -0.13%     
==========================================
  Files        1094     1097       +3     
  Lines       57592    57716     +124     
  Branches     4755     4758       +3     
==========================================
- Hits        29681    29674       -7     
- Misses      27193    27327     +134     
+ Partials      718      715       -3     
Flag Coverage Δ *Carryforward flag
legacy_packages 65.68% <ø> (ø) Carriedforward from ce0da51
packages 48.09% <24.10%> (-0.15%) ⬇️

*This pull request uses carry forward flags. Click here to find out more.

Files with missing lines Coverage Δ
...b/src/react/web/ui/ConnectWallet/ConnectButton.tsx 49.01% <ø> (ø)
...web/src/react/web/ui/components/ChainActiveDot.tsx 100.00% <100.00%> (ø)
...b/src/react/web/ui/components/fallbackChainIcon.ts 100.00% <100.00%> (ø)
...thirdweb/src/react/web/ui/components/ChainIcon.tsx 8.57% <0.00%> (-23.35%) ⬇️
.../thirdweb/src/react/web/ui/prebuilt/Chain/icon.tsx 61.01% <89.47%> (ø)
...src/react/web/ui/ConnectWallet/NetworkSelector.tsx 3.99% <0.00%> (-0.17%) ⬇️
...hirdweb/src/react/web/ui/ConnectWallet/Details.tsx 48.49% <6.19%> (-5.37%) ⬇️

... and 1 file with indirect coverage changes

Copy link
Member

@gregfromstl gregfromstl left a comment

Choose a reason for hiding this comment

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

LGTM but I'm a little confused how this solves the original issue, also why we need the screen param to be passed to onClose (feels like something a little too internal to be exposing). I trust though

@kien-ngo kien-ngo force-pushed the kien/onClose-callback-modal branch 2 times, most recently from a9d7d06 to 3a9de42 Compare December 12, 2024 12:52
```tsx
<ConnectButton
detailsModal={{
onClose: (screen: string) => {
Copy link
Member

Choose a reason for hiding this comment

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

Rather than burying this in the detailsModal prop, could we make it top level?

Copy link
Member

@gregfromstl gregfromstl left a comment

Choose a reason for hiding this comment

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

Remove screen param at least

@kien-ngo kien-ngo force-pushed the kien/onClose-callback-modal branch from bbb3ab1 to f1d4fd5 Compare December 14, 2024 11:31
@kien-ngo kien-ngo force-pushed the kien/onClose-callback-modal branch from f1d4fd5 to 99cc2f5 Compare December 14, 2024 11:35
/**
* @internal
*/
export const getSrcChainIcon = (props: {
Copy link

Choose a reason for hiding this comment

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

Remove 'export' keyword since getSrcChainIcon is only used internally within this file and not imported elsewhere

Spotted by Graphite Reviewer (based on CI logs)

Is this helpful? React 👍 or 👎 to let us know.

@@ -0,0 +1,3 @@
import { describe } from "vitest";

describe.runIf(process.env.TW_SECRET_KEY)("ChainIcon-legacy", () => {});
Copy link

Choose a reason for hiding this comment

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

Remove the empty legacy test suite since it's not being used and there are already comprehensive tests in place for the ChainIcon component

Spotted by Graphite Reviewer (based on CI logs)

Is this helpful? React 👍 or 👎 to let us know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
packages SDK Involves changes to the thirdweb SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants