Uh oh!
There was an error while loading. Please reload this page.
Fix buy-sell modal error handling and UI improvements - #12728
Conversation
## Summary This PR fixes two main issues in the buy-sell modal and includes several UI improvements: ### 🐛 Bug Fixes **1. Inconsistent insufficient funds error behavior** - **Issue**: On sell tab, insufficient funds errors displayed immediately when entering amount > balance - **Issue**: On convert tab, errors only displayed after clicking "Continue" - **Fix**: Updated error display logic in BuySellFlow to show validation errors immediately for both sell and convert tabs, while preserving buy tab behavior (errors only after submit attempt) **2. Improved form validation with FixedDecimal precision** - Enhanced `swapFormSchema.ts` to use `FixedDecimal` for all numeric validations - Prevents floating point precision errors in min/max/balance checks - Added proper decimal handling based on token decimals ### ✨ UI Improvements **3. Responsive layout for Your Coins** - Updated `useGroupCoinPairs` to support single-column layout on mobile/tablet - Improved coin filtering logic with proper balance checks - Enhanced mobile experience in pay-and-earn page **4. Form validation enhancements** - Added token validation on token changes to refresh errors for new tokens - Improved insufficient balance detection logic - Better handling of balance loading states **5. Minor UI fixes** - Fixed dropdown section max height - Improved component formatting and structure ## Files Changed - `packages/common/src/store/ui/buy-sell/swapFormSchema.ts` - Enhanced validation with FixedDecimal - `packages/common/src/store/ui/buy-sell/useTokenSwapForm.ts` - Improved validation logic - `packages/common/src/store/ui/buy-sell/useGroupCoinPairs.ts` - Added responsive layout support - `packages/web/src/components/buy-sell-modal/BuySellFlow.tsx` - Fixed error display consistency - `packages/web/src/components/buy-sell-modal/DropdownSection.tsx` - Minor UI fixes - `packages/web/src/pages/pay-and-earn-page/components/YourCoins.tsx` - Added mobile responsive layout ## Testing - [x] Sell tab shows insufficient balance errors immediately - [x] Convert tab shows insufficient balance errors immediately - [x] Buy tab preserves existing behavior (errors after continue click) - [x] Form validation works correctly with decimal precision - [x] Mobile layout displays properly in Your Coins section 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
|
| return !isNaN(parseFloat(val)) | ||
| try { | ||
| // eslint-disable-next-line no-new | ||
| new FixedDecimal(val, decimals) |
There was a problem hiding this comment.
super nit: instead of eslint disable, would _ = new FixedDecimal() work?
| (val) => { | ||
| if (val === '') return false | ||
| return !balance || parseFloat(val) <= balance | ||
| // Treat only null/undefined as "unknown balance"; do not bypass check for numeric 0 |
| {props.hasReceiveAmount && | ||
| props.formattedReceiveAmount !== | ||
| DEFAULT_TOKEN_AMOUNT_PLACEHOLDER ? ( | ||
| <Flex direction='column'> |
Uh oh!
There was an error while loading. Please reload this page.
[c667cb7] Fix share profile drawer issue (#12751) JD Francis [65212e8] Fix E2E tests by fixing remix notification (#12748) Marcus Pasell [42bb9d1] Tweak your coins skeletons (#12756) JD Francis [f20aa78] [PE-6664] Fix small screen coin page layout issues (#12754) JD Francis [3d82588] Fix responsiveness on AUDIO page (#12755) Farid Salau [1f9434e] Show correct image in user badge stack on AllCoinsPage (#12753) Farid Salau [270363a] Invalidate 'userCoins' query after swap (#12752) Farid Salau [11b6310] [PE-6668] Update add external wallets button to send to sign up if user is not signed in (#12750) KJ [fdb8cc9] Small lint fix (#12749) JD Francis [e4241dc] [PE-6657] Artist coin leaderboard card (#12734) JD Francis [edac449] Update qr code colors (#12741) Dylan Jeffers [02b5d48] [PE-6677] Fix user badge artist coins (#12745) Dylan Jeffers [f631cf3] Fix coin options (#12743) Dylan Jeffers [d0ad5ae] [PE-6667] Fix token balance swap issues (#12738) JD Francis [5c2570c] Fix listening history (#12731) Randy Schott [d42fb2e] [PE-6636] Add receive-tokens modal. (#12725) Dylan Jeffers [5841688] Adjust remix contest timezone (#12722) Dylan Jeffers [b883712] Fix buy-sell modal error handling and UI improvements (#12728) Farid Salau [7f4cb6a] Remove original param for download (#12686) Ray Jacobson [4f88de6] [PE-6638] Update coin leaderboard user list to handle long user names (#12730) KJ [1fb49f5] [PE-6588] Add downloads available section to search/explore (#12723) Randy Schott [19a745e] Revert "Speed up sdk build by only building for web and native (#12391)" (#12727) Dylan Jeffers [ddfbaa5] [PE-6621] Connected wallets UI (#12697) JD Francis [bb58d64] Clean up unnecessary amplitude events (#12684) JD Francis [76fd651] [PE-6651, PE-6647, PE-6634, PE-6646] Artist Coin QA 2 (#12724) KJ [b1aec05] [PE-6637, PE-6639] Artist Coin QA 1 (#12721) KJ [e161b05] Speed up sdk build by only building for web and native (#12391) Dylan Jeffers [5ba4590] [PE-6608] Fix persistence of recent searches on web (#12718) Randy Schott [d4d4a39] Web Search/Explore QA fixes (#12717) Randy Schott [d75ae2e] [PE-6643] Add unauth state for Wallet pages (#12714) Farid Salau [31e7687] Update Asset Detail Pages to use proper data (#12713) Farid Salau [b50ccef] Fix trending playlists playback on web (#12712) Randy Schott [74e5991] [QA-2163] Delete collections with tan-query (#12700) Dylan Jeffers [515f884] Fix left-align page container (#12711) Dylan Jeffers [3554bb2] [PE-6656] Fix dupe playlist track uids (#12715) JD Francis [39a3f54] Add support for oembeds (#12692) Marcus Pasell [3ccbd99] Improve mobile profile refresh (#12699) Dylan Jeffers [b186d9b] [PE-6541] Update UserBadges to display top token (#12710) KJ [cd468d8] [QA-2202] Improve podcast support (#12698) Dylan Jeffers [1b2f943] add best of section back to mobile if we aren't showing new explore content (#12708) Randy Schott [6e8f43b] Fix skeletons for title/artist on track tiles (#12707) Randy Schott [f626163] [PE-6605] Add dropdown menu to artist coins (#12705) Farid Salau [36e2a6a] Revert mobile Artwork changes (#12706) Farid Salau
Summary
This PR fixes two main issues in the buy-sell modal and includes several UI improvements:
🐛 Bug Fixes
1. Inconsistent insufficient funds error behavior
2. Improved form validation with FixedDecimal precision
swapFormSchema.tsto useFixedDecimalfor all numeric validations✨ UI Improvements
3. Responsive layout for Your Coins
useGroupCoinPairsto support single-column layout on mobile/tablet4. Form validation enhancements
5. Minor UI fixes
Files Changed
packages/common/src/store/ui/buy-sell/swapFormSchema.ts- Enhanced validation with FixedDecimalpackages/common/src/store/ui/buy-sell/useTokenSwapForm.ts- Improved validation logicpackages/common/src/store/ui/buy-sell/useGroupCoinPairs.ts- Added responsive layout supportpackages/web/src/components/buy-sell-modal/BuySellFlow.tsx- Fixed error display consistencypackages/web/src/components/buy-sell-modal/DropdownSection.tsx- Minor UI fixespackages/web/src/pages/pay-and-earn-page/components/YourCoins.tsx- Added mobile responsive layoutTesting
🤖 Generated with Claude Code
Description
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide repro instructions & any configuration.