Fix vault balance formatting and layout on iOS - #2596
Merged
Merged
Conversation
The vault balance card set its 26px value on a 24px line box and the
rewards summary set its 26px value on a 26px one; iOS clips glyphs that
overflow the line box, cutting the tops of the digits and the `$`.
Both values now get a 32px line, with the vault card's margins trimmed
so its layout height is unchanged.
The vault card also relied on Intl compact notation, which Hermes on iOS
ignores, so balances showed in full ("6,759.16 USD") and wrapped inside
the fixed-height card. The compact figure is now formatted by hand, the
value stays on one line and shrinks to fit on native, and the card uses
a min height so wrapped text on web is no longer cut off.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013FB6mLN2hZfRTDENZCHKhw
Mona Sans has a 1.41em natural line (1.09em ascent, 0.32em descent). When a lineHeight is shorter, iOS keeps the full descent and trims the top of the first line, while Android trims both edges evenly, cutting the bottom of the last line; both then clip the glyphs to the view. Web does neither, which is why only the native apps showed it. The vault card's exact-USD line gets the same ~1.15em headroom as the balance figure (its `$` sat within a pixel of the edge), and the rewards card and its value row use min heights so larger system font sizes, common on Android, grow the card instead of clipping the text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013FB6mLN2hZfRTDENZCHKhw
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. 🤖 Generated with Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes vault balance display issues on iOS by implementing a custom compact number formatter and improving text layout to prevent clipping and wrapping.
Key Changes
Extracted vault balance formatting logic into a new
vaultBalanceFormat.tsmodule with comprehensive test coverageformatCompactVaultUsd(): Custom implementation of compact number formatting (K, M, B, T suffixes) that works on iOS whereIntl.NumberFormat({ notation: 'compact' })is not supported by HermesformatExactVaultUsd(): Formats exact USD values to one decimal placeFixed text layout and clipping issues in vault and rewards cards
numberOfLines: 1andadjustsFontSizeToFiton native platforms to prevent wrappingh-) to minimum heights (min-h-) to allow cards to grow if content wraps on webUpdated RewardsSummaryCard with similar layout fixes for consistency
Implementation Details
The custom
formatCompactVaultUsd()function:Intl.NumberFormatPlatform-specific text rendering:
adjustsFontSizeToFitto shrink text to fit single line in half-width columnadjustsFontSizeToFitsupporthttps://claude.ai/code/session_013FB6mLN2hZfRTDENZCHKhw
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.