Skip to content

feat(affiliate-dashboard): swaps table visual polish#12309

Merged
kaladinlight merged 6 commits intodevelopfrom
affiliate-dashboard-swaps-polish
Apr 30, 2026
Merged

feat(affiliate-dashboard): swaps table visual polish#12309
kaladinlight merged 6 commits intodevelopfrom
affiliate-dashboard-swaps-polish

Conversation

@kaladinlight
Copy link
Copy Markdown
Contributor

@kaladinlight kaladinlight commented Apr 29, 2026

Description

Round of visual polish on the affiliate dashboard's swaps table plus the supporting API change that makes chain identity available on Asset responses.

feat(public-api): include chain identity on Asset responses

  • Enrich every Asset returned from /v1/assets with networkIcon, networkColor, and networkName sourced from the chain's base asset (falling back to the asset's own icon / color when the base asset omits chain-level overrides).
  • Adds the matching optional fields to the OpenAPI Asset schema so generated clients pick them up.

feat(affiliate-dashboard): swaps table visual polish

  • AssetPill: size prop (sm / md), top-left chain icon overlay (driven by the new networkIcon), showNetworkIcon toggle.
  • TxLinks: reuse AssetPill (size sm, network icon hidden) — chain identity already shown in the dedicated Sell/Buy columns.
  • New SwapperIcon directory: bundled per-swapper icons + lookup component shown next to the swapper name.
  • SwapsTable: bumped row scale (size='md', fontSize='md', taller cells), shrunk narrow columns (BPS / Transactions / Verified / Status) with width="1%", added breathing room on first/last cells, centered numeric headers.
  • format.ts: formatUsd now displays 2-4 decimals; new formatUsdFull returns full-precision USD for hover tooltips on Volume / Fee.
  • SettingsCard: optional headerRight slot for actions next to the title (now used by RegisterCard).
  • RegisterCard: restructured into a Row-based field list (Wallet + Affiliate BPS), action button moved to header.
  • ConfigSummaryCard: drop bottom border on the last row (_last skip).
  • AffiliateBpsCard, ReceiveAddressCard: tightened input sizing (InputGroup w='auto', fixed-width inputs) so the action button sits flush.
  • Misc font-size / padding bumps in ConfigBar, PeriodSelector, TabBar, AuthBanner, AuthStatusBar, StatCard.

Issue (if applicable)

closes #

Risk

Low. Scope is the affiliate-dashboard package + an additive change to public-api's Asset response.
The new fields on the OpenAPI Asset schema are .optional() — additive only, no consumer breakage.
No on-chain transactions, wallet flows, or shared state are touched.

What protocols, transaction types, wallets or contract interactions might be affected by this PR?

None — UI polish on a standalone dashboard plus an additive API enrichment.

Testing

Engineering

  • Boot `pnpm --filter @shapeshiftoss/public-api dev` and `pnpm --filter @shapeshiftoss/affiliate-dashboard dev`.
  • Hit the dashboard with a wallet that has affiliate swaps; verify:
    • Sell / Buy asset pills render the chain icon overlay (top-left) for chains that ship a `networkIcon` (Base, Arbitrum, etc.) and gracefully omit it for chains without one.
    • Tx column inline pills do NOT show the chain overlay (chain identity is already in the Sell/Buy columns).
    • Volume / Fee hover tooltips show full-precision USD.
    • Swapper column shows an icon next to the name for every supported swapper.
    • Settings tab cards (Register, Receive Address, Affiliate BPS, Current Configuration) lay out cleanly; inputs hug their action buttons.
  • Hit `/v1/assets` directly; confirm `networkIcon` / `networkColor` / `networkName` round-trip on responses.

Operations

  • 🏁 My feature is behind a flag and doesn't require operations testing (yet)

UI-only change in an internal dashboard; no operations-side smoke needed beyond confirming the affiliate-dashboard preview deploys.

Screenshots (if applicable)

See PR conversation for before/after screenshots if needed.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Swapper icons now display in swap table listings
    • Asset pills support configurable sizing and optional network indicators
    • Settings card header can accommodate additional actions
  • Improvements

    • Enhanced typography and spacing across dashboard for improved readability
    • Refined table styling and input field layouts
    • Extended asset API responses with network metadata (name, color, icon)
  • Bug Fixes

    • Fixed extra border divider in configuration summary cards

kaladinlight and others added 2 commits April 29, 2026 14:15
Enrich every Asset returned from /v1/assets with networkIcon,
networkColor, and networkName sourced from the chain's base asset
(falling back to the asset's own icon/color when the base asset omits
chain-level overrides). Adds the matching optional fields to the
OpenAPI Asset schema so generated clients pick them up.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Round of polish on the affiliate swaps table:
- AssetPill: size prop (sm/md), top-left chain icon overlay (driven
  by the new networkIcon on Asset responses), showNetworkIcon toggle.
- TxLinks: reuse AssetPill (size sm, network icon hidden) — chain
  identity already shown in the dedicated Sell/Buy columns.
- SwapperIcon: bundled per-swapper icons + lookup component shown
  next to swapper name.
- SwapsTable: bumped row scale (size md, fontSize md, taller tbody
  cells), shrunk narrow columns (BPS / Transactions / Verified /
  Status) with width="1%", added pl/pr breathing room on first/last
  cells, centered numeric headers.
- format.ts: formatUsd now displays 2-4 decimals; new formatUsdFull
  helper returns full-precision USD for hover tooltips on Volume /
  Fee.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@kaladinlight kaladinlight requested a review from a team as a code owner April 29, 2026 21:54
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 29, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b7e813e7-5b03-4283-b85b-275078b83b61

📥 Commits

Reviewing files that changed from the base of the PR and between 1ec9912 and d2206e4.

📒 Files selected for processing (3)
  • packages/affiliate-dashboard/src/components/settings/SettingsCard.tsx
  • packages/affiliate-dashboard/src/components/swaps/SwapsTable.tsx
  • packages/caip/src/adapters/coingecko/index.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/affiliate-dashboard/src/components/settings/SettingsCard.tsx
  • packages/affiliate-dashboard/src/components/swaps/SwapsTable.tsx

📝 Walkthrough

Walkthrough

The changes encompass comprehensive styling refinements across the affiliate dashboard, including typography scaling (font size adjustments), layout improvements (spacing and input dimensions), and component enhancements (new props like headerRight and showNetworkIcon). Additionally, the public API assets enrichment now includes network icon and color metadata, and a Starknet asset reference test was corrected.

Changes

Cohort / File(s) Summary
Typography Updates
packages/affiliate-dashboard/src/components/ConfigBar.tsx, PeriodSelector.tsx, TabBar.tsx, overview/StatCard.tsx, settings/AuthBanner.tsx, settings/AuthStatusBar.tsx
Font size increments across multiple components (e.g., 'xs''sm', 'sm''md') and padding adjustments for improved visual hierarchy.
Input & Layout Refinements
packages/affiliate-dashboard/src/components/settings/AffiliateBpsCard.tsx, ReceiveAddressCard.tsx, ConfigSummaryCard.tsx
Input field width and spacing adjustments; removal of trailing border dividers; switch from flex-based to character-width layout for fixed-width inputs.
Settings Components
packages/affiliate-dashboard/src/components/settings/RegisterCard.tsx, SettingsCard.tsx
RegisterCard restructured to use new headerRight prop for button placement and Row layout for labeled config display; SettingsCard extended with optional headerRight prop and refactored header rendering from vertical to horizontal flex layout.
Swaps Component Suite
packages/affiliate-dashboard/src/components/swaps/AssetPill.tsx, StatusBadge.tsx, SwapperIcon/SwapperIcon.tsx, SwapsTable.tsx, TxLinks.tsx
AssetPill and TxLinks updated to support sizing and network icon display; new SwapperIcon component added for icon rendering; SwapsTable styling enhanced with larger table size, adjusted column widths, and swapper icon integration; StatusBadge padding refined.
Public API Asset Enrichment
packages/public-api/src/assets.ts, routes/assets/types.ts
Assets enriched with networkIcon and networkColor fields derived from base asset properties; AssetSchema extended with three new optional response fields.
Test Correction
packages/caip/src/adapters/coingecko/index.test.ts
Starknet usd-coin asset reference corrected with leading zero prefix in test assertion.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~30 minutes

Poem

🐰 Typography scales and layouts bloom,
New icons grace the swapper's room,
Headers gain a rightward friend,
Assets shine with network's trend,
A dash of polish, corner to end! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main visual polish changes to the swaps table and related affiliate-dashboard components.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch affiliate-dashboard-swaps-polish

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
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: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/affiliate-dashboard/src/components/swaps/SwapsTable.tsx (1)

28-28: ⚠️ Potential issue | 🟠 Major

Unknown USD amounts are being rendered as $0.00.

Line 28 coerces null/invalid values to 0, so missing data is displayed as a real amount in Volume/Fee cells (table and card). This can mislead users and analytics interpretation.

💡 Suggested fix (preserve unknown vs zero)
-const parseUsd = (v: string | null): number => parseFloat(v ?? '') || 0
+const parseUsd = (v: string | null): number | null => {
+  if (v == null) return null
+  const n = parseFloat(v)
+  return Number.isNaN(n) ? null : n
+}
+
+const formatUsdMaybe = (v: string | null): string => {
+  const n = parseUsd(v)
+  return n == null ? '—' : formatUsd(n)
+}

Then use formatUsdMaybe(...) where Volume/Fee values are rendered.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/affiliate-dashboard/src/components/swaps/SwapsTable.tsx` at line 28,
The parser currently coerces null/invalid USD strings to 0 which causes missing
data to display as $0.00; update the parseUsd function to preserve unknown
values by returning number | null (i.e., parse the string and return null when
parseFloat yields NaN instead of 0). Then update the places in SwapsTable where
Volume/Fee are rendered to use formatUsdMaybe(...) (or other existing "maybe"
formatter) so null values render as blank/placeholder while real zeros still
show $0.00; reference parseUsd and formatUsdMaybe in your changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/affiliate-dashboard/src/components/settings/RegisterCard.tsx`:
- Around line 61-63: The wallet address rendered in RegisterCard (the Text that
outputs {address}) can overflow on small widths; update that Text element to
constrain width and enable truncation/wrapping (e.g., set a maxWidth or width
responsive prop and use truncation/word-break props such as isTruncated or
overflowWrap/wordBreak) so the address doesn’t break the layout on mobile while
preserving accessibility (keep the full value available via title/tooltip if
needed).

In `@packages/affiliate-dashboard/src/lib/format.ts`:
- Around line 11-20: formatUsdFull currently uses parseFloat which loses
precision; instead parse and validate the input with the project's BigNumber
type (e.g., BigNumber.from / new BigNumber(raw) depending on the lib used),
return '—' for null/invalid inputs, and produce the display string from the
BigNumber (e.g., use toFixed(18) or the BigNumber library's formatting API to
preserve all decimal digits) rather than converting to a JS Number; if you still
want locale-aware grouping, split the BigNumber string into integer and
fraction, run Intl.NumberFormat only on the integer substring, then join the
fraction back—make the change in formatUsdFull so it never calls parseFloat and
uses BigNumber parsing/formatting instead.

---

Outside diff comments:
In `@packages/affiliate-dashboard/src/components/swaps/SwapsTable.tsx`:
- Line 28: The parser currently coerces null/invalid USD strings to 0 which
causes missing data to display as $0.00; update the parseUsd function to
preserve unknown values by returning number | null (i.e., parse the string and
return null when parseFloat yields NaN instead of 0). Then update the places in
SwapsTable where Volume/Fee are rendered to use formatUsdMaybe(...) (or other
existing "maybe" formatter) so null values render as blank/placeholder while
real zeros still show $0.00; reference parseUsd and formatUsdMaybe in your
changes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e924623e-c22f-4abe-88b1-13bbbb4a27b3

📥 Commits

Reviewing files that changed from the base of the PR and between e8c7d89 and 1ec9912.

⛔ Files ignored due to path filters (17)
  • packages/affiliate-dashboard/src/components/swaps/SwapperIcon/0x-icon.png is excluded by !**/*.png
  • packages/affiliate-dashboard/src/components/swaps/SwapperIcon/across-icon.svg is excluded by !**/*.svg
  • packages/affiliate-dashboard/src/components/swaps/SwapperIcon/arbitrum-bridge-icon.png is excluded by !**/*.png
  • packages/affiliate-dashboard/src/components/swaps/SwapperIcon/avnu-icon.jpg is excluded by !**/*.jpg
  • packages/affiliate-dashboard/src/components/swaps/SwapperIcon/bebop-icon.png is excluded by !**/*.png
  • packages/affiliate-dashboard/src/components/swaps/SwapperIcon/butterswap.png is excluded by !**/*.png
  • packages/affiliate-dashboard/src/components/swaps/SwapperIcon/cetus-icon.jpg is excluded by !**/*.jpg
  • packages/affiliate-dashboard/src/components/swaps/SwapperIcon/chainflip-icon.png is excluded by !**/*.png
  • packages/affiliate-dashboard/src/components/swaps/SwapperIcon/cow-icon.png is excluded by !**/*.png
  • packages/affiliate-dashboard/src/components/swaps/SwapperIcon/debridge-icon.svg is excluded by !**/*.svg
  • packages/affiliate-dashboard/src/components/swaps/SwapperIcon/maya_logo.png is excluded by !**/*.png
  • packages/affiliate-dashboard/src/components/swaps/SwapperIcon/near-intents-icon.png is excluded by !**/*.png
  • packages/affiliate-dashboard/src/components/swaps/SwapperIcon/portals-icon.png is excluded by !**/*.png
  • packages/affiliate-dashboard/src/components/swaps/SwapperIcon/relay-icon.svg is excluded by !**/*.svg
  • packages/affiliate-dashboard/src/components/swaps/SwapperIcon/stonfi-icon.png is excluded by !**/*.png
  • packages/affiliate-dashboard/src/components/swaps/SwapperIcon/sunio-icon.png is excluded by !**/*.png
  • packages/affiliate-dashboard/src/components/swaps/SwapperIcon/thorchain-icon.png is excluded by !**/*.png
📒 Files selected for processing (19)
  • packages/affiliate-dashboard/src/components/ConfigBar.tsx
  • packages/affiliate-dashboard/src/components/PeriodSelector.tsx
  • packages/affiliate-dashboard/src/components/TabBar.tsx
  • packages/affiliate-dashboard/src/components/overview/StatCard.tsx
  • packages/affiliate-dashboard/src/components/settings/AffiliateBpsCard.tsx
  • packages/affiliate-dashboard/src/components/settings/AuthBanner.tsx
  • packages/affiliate-dashboard/src/components/settings/AuthStatusBar.tsx
  • packages/affiliate-dashboard/src/components/settings/ConfigSummaryCard.tsx
  • packages/affiliate-dashboard/src/components/settings/ReceiveAddressCard.tsx
  • packages/affiliate-dashboard/src/components/settings/RegisterCard.tsx
  • packages/affiliate-dashboard/src/components/settings/SettingsCard.tsx
  • packages/affiliate-dashboard/src/components/swaps/AssetPill.tsx
  • packages/affiliate-dashboard/src/components/swaps/StatusBadge.tsx
  • packages/affiliate-dashboard/src/components/swaps/SwapperIcon/SwapperIcon.tsx
  • packages/affiliate-dashboard/src/components/swaps/SwapsTable.tsx
  • packages/affiliate-dashboard/src/components/swaps/TxLinks.tsx
  • packages/affiliate-dashboard/src/lib/format.ts
  • packages/public-api/src/assets.ts
  • packages/public-api/src/routes/assets/types.ts

Comment thread packages/affiliate-dashboard/src/lib/format.ts Outdated
Reverts the formatUsd 2→4 decimal bump, the formatUsdFull helper, and
the Volume/Fee Tooltip wrappers. These were tied to the verified-amounts
feature (still in flight) and don't belong in the visual-polish scope.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@kaladinlight kaladinlight force-pushed the affiliate-dashboard-swaps-polish branch from 1a7b752 to 814ac28 Compare April 29, 2026 22:32
@kaladinlight kaladinlight enabled auto-merge (squash) April 29, 2026 22:36
@kaladinlight kaladinlight merged commit 07714b1 into develop Apr 30, 2026
4 checks passed
@kaladinlight kaladinlight deleted the affiliate-dashboard-swaps-polish branch April 30, 2026 01:19
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.

1 participant