Skip to content

refactor: dedupe shared helpers and centralize hard-coded UI values#29

Open
wmagev wants to merge 2 commits intoentrius:testfrom
wmagev:refactor/dedupe-and-constants
Open

refactor: dedupe shared helpers and centralize hard-coded UI values#29
wmagev wants to merge 2 commits intoentrius:testfrom
wmagev:refactor/dedupe-and-constants

Conversation

@wmagev
Copy link
Copy Markdown

@wmagev wmagev commented Apr 18, 2026

Summary

  • Consolidate duplicated helpers: shortAddr, getStatusColor, and a new toChainUnits replace copy-pasted inline versions across components.
  • Centralize magic UI values (panel heights, page size, debounce delay, copy feedback, label min-width) in src/constants/ui.ts.
  • Replace hex literals (#10b981 / #ef4444) in SwapDetailPage with theme.palette.status.* and drop the conflicting ::selection rule from index.css so the MUI theme stays authoritative.
  • Make the docs URL and the dev vite proxy target env-overridable via VITE_DOCS_URL and VITE_DEV_API_TARGET; defaults match existing behavior.
  • Dedupe allowedHosts in vite.config.ts into a single constant.

No behavior changes, no API changes.

Test plan

  • npm run build (tsc + vite build) passes.
  • Dashboard renders and live events, miners, depth book, and swap tracker look unchanged.
  • Swap detail page timeline colors still match status (completed = green, timed-out = red).
  • Text selection color reflects the active theme's primary.
  • Docs icon links to the correct URL (prod vs test vs VITE_DOCS_URL override).
  • npm run dev proxy still reaches the default API host when VITE_DEV_API_TARGET is unset.

wmagev added 2 commits April 18, 2026 12:49
Extracted shared utilities to eliminate copy-pasted code: getStatusColor
into utils/status, table header/cell sx into dashboard/tableStyles, and
toChainUnits for rao-to-TAO conversion. CopyableAddress now imports
shortAddr from utils/format, and vite.config.ts shares a single
ALLOWED_HOSTS constant across preview and server.
Centralized magic UI numbers (panel heights, page size, debounce delays,
copy feedback, label widths) into src/constants. Swapped hex literals in
SwapDetailPage for theme.palette.status refs and dropped the conflicting
::selection override from index.css so the theme stays authoritative.
Docs URL and the vite dev proxy target are now env-overridable via
VITE_DOCS_URL and VITE_DEV_API_TARGET, with existing behavior as the
default.
@wmagev
Copy link
Copy Markdown
Author

wmagev commented Apr 18, 2026

cc @LandynDev

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