refactor: dedupe shared helpers and centralize hard-coded UI values#29
Open
wmagev wants to merge 2 commits intoentrius:testfrom
Open
refactor: dedupe shared helpers and centralize hard-coded UI values#29wmagev wants to merge 2 commits intoentrius:testfrom
wmagev wants to merge 2 commits intoentrius:testfrom
Conversation
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.
Author
|
cc @LandynDev |
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
shortAddr,getStatusColor, and a newtoChainUnitsreplace copy-pasted inline versions across components.src/constants/ui.ts.#10b981/#ef4444) in SwapDetailPage withtheme.palette.status.*and drop the conflicting::selectionrule fromindex.cssso the MUI theme stays authoritative.VITE_DOCS_URLandVITE_DEV_API_TARGET; defaults match existing behavior.allowedHostsinvite.config.tsinto a single constant.No behavior changes, no API changes.
Test plan
npm run build(tsc + vite build) passes.VITE_DOCS_URLoverride).npm run devproxy still reaches the default API host whenVITE_DEV_API_TARGETis unset.