Skip to content

refactor: UI cleanup pass — dead code, tokens, tab consolidation, design-system audit page#1190

Open
freski-ai wants to merge 10 commits into
NEAR-DevHub:mainfrom
freski-ai:worktree-eager-tinkering-teapot
Open

refactor: UI cleanup pass — dead code, tokens, tab consolidation, design-system audit page#1190
freski-ai wants to merge 10 commits into
NEAR-DevHub:mainfrom
freski-ai:worktree-eager-tinkering-teapot

Conversation

@freski-ai

Copy link
Copy Markdown

Summary

Strict-phases UI refactor (audit → plan → execute-per-step, each step keeping the app working and visually unchanged unless explicitly flagged). Full audit + step plan lives in the session that produced this PR.

  • New: internal /design-system page — live component/token catalog, not a product feature, built to track this app's own design-system drift going forward.
  • Deleted: 4 orphan components (zero consumers anywhere) + 2 pure re-export shims.
  • Removed: 4 dead CSS tokens (--onboarding-primary, --chart-1..5, the full --sidebar-* set — no shadcn Sidebar primitive is even installed — --general-warning-border), all confirmed zero usage.
  • Fixed: hardcoded-color duplication (shield.tsx, sidebar.tsx) with light/dark scoping double-checked before tokenizing — caught and avoided a real bug where tokenizing treasury-layout-client.tsx's outer wrapper would have forced the whole page tree into dark-mode CSS variables regardless of the site's actual theme.
  • Renamed: --brand-blue--brand-green (8 files) — the value was always NEAR green, only the name was wrong.
  • Consolidated: the app's two parallel tab-component families into one (Settings page migrated off the ToggleGroup-based TabGroup onto the Tabs-based ResponsiveTabs — visual change: pill tabs → underline tabs, confirmed before making it).
  • Cards: replaced shadow-based depth with a border, fixed two places that had drifted off the shared Card look (RecentActivity, PendingRequests).
  • Started, not finished: extracted a shared max-w-[600px] constant (NARROW_CONTENT_MAX_WIDTH), wired into 1 of ~20 call sites as proof of concept.

Explicitly deferred (see /design-system and PR discussion for why): splitting the 6 largest god-component files (1200–2227 lines each — core balance/transaction display logic) and moving components/* into components/shared/. Judged too large/risky to rush in this pass; real money-display logic deserves a dedicated, focused effort rather than being ganged through quickly.

Test plan

  • /design-system loads, all sections render, dark/light toggle works
  • Settings page: all 5 tabs switch correctly, "New" pill still shows on Integrations, ?tab= deep links still work, mobile collapses to a Select dropdown
  • Dashboard: sidebar and shell chrome unchanged in both light and dark site theme
  • Recent Activity / Pending Requests cards show a border in both loading and loaded states
  • Confidential/public treasury badge icon renders unchanged
  • Any letter-avatar fallback (deposit modal token picker, token selects, assets table) still shows the same green circle

🤖 Generated with Claude Code

https://claude.ai/code/session_011gbVzMdVpqwrRB9a1Jt4ZK

frol-ai and others added 10 commits July 21, 2026 21:30
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011gbVzMdVpqwrRB9a1Jt4ZK
Live component/token catalog for nt-fe — shadcn primitives, top domain
wrappers (rendered live with variants/sizes + how they actually look
through their app wrapper), real per-token usage counts via grep, and
a side-by-side view of duplicate implementations solving the same
problem (badges, cards, alerts) with no shared base. Not a product
feature — an internal tool for tracking this app's own design-system
drift, kept in sync with every deletion/rename in the cleanup that
follows.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011gbVzMdVpqwrRB9a1Jt4ZK
Card and PageCard now use a border instead of shadow-sm, per design
direction. Fixed two spots that had silently drifted off the shared
Card look: recent-activity-card.tsx explicitly opted out via
border-none, and PendingRequests' loaded/hidden states never had a
border at all (only the loading skeleton did) — both now match.

Also darkens the card border token from the near-invisible --border
to --input for better contrast in light mode.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011gbVzMdVpqwrRB9a1Jt4ZK
4 components with zero consumers anywhere in the app (verified via
grep, re-checked immediately before deleting): selectable-option-button,
asset-details-modal, error-alert, insufficient-balance-modal.

2 files that were pure re-export shims adding no code of their own
(components/datepicker.tsx, components/warnings-provider.tsx) —
consumers now import the real source directly (ui/datepicker,
hooks/use-warnings).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011gbVzMdVpqwrRB9a1Jt4ZK
--onboarding-primary, --chart-1..5, the full --sidebar-* set (8
tokens, no shadcn Sidebar primitive is even installed here), and
--general-warning-border — all defined in globals.css, all confirmed
zero usages anywhere in app code.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011gbVzMdVpqwrRB9a1Jt4ZK
…zing

shield.tsx: 36x repeated fill="#262626" -> one named constant. Left as
raw hex on purpose — it's a fixed decorative badge icon with no dark:
variant, wiring it to --secondary/--muted would make it flip color in
light mode, which it never currently does.

sidebar.tsx: bg-[#262626] (the deliberate always-dark sidebar chrome)
-> bg-secondary, but only inside the two spots already scoped by a
literal `dark` class, since --secondary resolves to the exact same
rgb(38,38,38) there. Almost applied the same fix to
treasury-layout-client.tsx's outer page wrapper too — caught before
committing that adding `dark` there would cascade into every themed
descendant (the whole page, not just chrome) regardless of the site's
actual light/dark setting. Left that one as raw hex, flagged instead.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011gbVzMdVpqwrRB9a1Jt4ZK
CSS var itself was renamed in the globals.css cleanup commit — this
updates the 7 files using the bg-brand-blue utility class (letter-
avatar fallback backgrounds, NEAR-network accents). Value never
changed, only the name — it was NEAR green the whole time.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011gbVzMdVpqwrRB9a1Jt4ZK
Settings page was the only consumer of TabGroup (pill/segmented,
ToggleGroup-based) — the rest of the app uses the Tabs-based family
(underline-tabs/responsive-tabs). Migrated it onto ResponsiveTabs and
deleted tab-group.tsx.

Visual change on the Settings page: pill tabs -> underline tabs (with
mobile Select collapse, new for this page). Confirmed with the user
before making it. ui/toggle-group.tsx (the primitive TabGroup was
built on) now has zero app consumers — left in place, it's a shadcn
primitive.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011gbVzMdVpqwrRB9a1Jt4ZK
max-w-[600px] is copy-pasted ~20 times as the app's de facto narrow-
content-column width (payment forms, onboarding, confidential
activation cards) — a real, consistent convention, just never named.
Added NARROW_CONTENT_MAX_WIDTH to lib/utils.ts and wired up one call
site as a proof of concept.

Stopped here rather than mechanically sweeping all 20 — judged lower
priority than the remaining god-component work for this pass. The
other ~19 sites are unchanged and still using the literal.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011gbVzMdVpqwrRB9a1Jt4ZK
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