Skip to content

Fix vault balance formatting and layout on iOS - #2596

Merged
MusabShakeel576 merged 2 commits into
masterfrom
claude/monday-tasks-review-fixes-auys1s
Sep 28, 2026
Merged

MusabShakeel576 merged 2 commits into
masterfrom
claude/monday-tasks-review-fixes-auys1s

Conversation

@MusabShakeel576

@MusabShakeel576 MusabShakeel576 commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

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.ts module with comprehensive test coverage

    • formatCompactVaultUsd(): Custom implementation of compact number formatting (K, M, B, T suffixes) that works on iOS where Intl.NumberFormat({ notation: 'compact' }) is not supported by Hermes
    • formatExactVaultUsd(): Formats exact USD values to one decimal place
    • Includes test suite covering edge cases (rounding up to next unit, negative values, NaN handling)
  • Fixed text layout and clipping issues in vault and rewards cards

    • Adjusted line heights to accommodate Mona Sans font metrics (~1.15em needed for proper glyph rendering)
    • Added numberOfLines: 1 and adjustsFontSizeToFit on native platforms to prevent wrapping
    • Changed fixed heights (h-) to minimum heights (min-h-) to allow cards to grow if content wraps on web
    • Fine-tuned margins and padding for consistent spacing across platforms
  • Updated RewardsSummaryCard with similar layout fixes for consistency

Implementation Details

The custom formatCompactVaultUsd() function:

  • Manually iterates through unit thresholds (1, 1K, 1M, 1B, 1T) rather than relying on Intl.NumberFormat
  • Rounds intermediate values to prevent display issues (e.g., 999,999 displays as "1M" not "1000K")
  • Handles edge cases: negative values and NaN are treated as zero
  • Promotes values that round up into the next unit

Platform-specific text rendering:

  • Native: Uses adjustsFontSizeToFit to shrink text to fit single line in half-width column
  • Web: Allows text to wrap naturally since there's no adjustsFontSizeToFit support

https://claude.ai/code/session_013FB6mLN2hZfRTDENZCHKhw


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

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
@vercel

vercel Bot commented Sep 28, 2026

Copy link
Copy Markdown

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

2 Skipped Deployments
Project Deployment Actions Updated
solid-app Ignored Ignored Sep 28, 2026 8:23am UTC
solid-app-staging Ignored Ignored Sep 28, 2026 8:23am UTC

Request Review

@claude

claude Bot commented Sep 28, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.


🤖 Generated with Claude Code

@MusabShakeel576
MusabShakeel576 merged commit 04c847f into master Sep 28, 2026
6 checks passed
@MusabShakeel576
MusabShakeel576 deleted the claude/monday-tasks-review-fixes-auys1s branch September 28, 2026 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants