Skip to content

feat(web): rebuild the dashboard in OKX design language - #2

Merged
azen07508-debug merged 1 commit into
mainfrom
okx-redesign
Sep 19, 2026
Merged

azen07508-debug merged 1 commit into
mainfrom
okx-redesign

Conversation

@azen07508-debug

Copy link
Copy Markdown
Owner

这个 PR 做了什么

把前端从「浅灰底 + 圆角卡片 + 通用排版」换成 OKX 的金融终端语言。

设计令牌不是凭印象写的,是用 Playwright 打开 okx.com 首页和 okx.com/trade-spot/btc-usdt,读 getComputedStyle 统计频次量出来的。

只改了两个文件,没有触碰任何 Solidity 合约。

量出来的设计令牌

维度 实测值
底色 #000000 纯黑(OKX 不用 off-black)
面板四级 #121212 / #1d1d1d / #2e2e2e / #383838
文字灰阶 #FFFFFF → #B0B0B0 → #909090 → #5B5B5B
强调绿 #25A750(中等饱和,不是荧光绿)
负向红 #CA3F64 —— 偏玫红的暗红,不是正红
发丝线 1px #383838(主)/ 1px #2e2e2e(弱)
圆角 交易界面 0px 全直角;营销界面 999px 胶囊
字号 14px 是绝对主力(出现 895 次),几乎无 32px 以上

核心气质:纯黑底 + 全直角 + 发丝线分区 + 密集数据 + 数字右对齐。层级靠字重和灰度,不靠字号和阴影。

新增

行情条 —— 顶部六格密集数据带(Pool / Status / Risk Score / Dynamic Fee / Ref. Liquidity / Last Block),发丝线分栏。这是 OKX 交易页最具辨识度的结构。

资金流示意图 —— Trader → Router → Pool Manager → XGuard Hook → Settlement,Hook 节点绿框高亮并显示实时风险分与费率。

用 HTML/CSS 而不是 SVG:第一版是内联 SVG,桌面没问题但窄屏只能横向滚动。改 HTML/CSS 后窄屏直接变纵向排列、箭头自动转 90°。

风险曲线 —— 用 RiskUpdated 事件串成走势线。

  • 首屏用 getContractEvents 拉历史播种,一进页面就有内容
  • 复用已有的 watchContractEvent 订阅实时追加
  • 最多保留 40 个点

流动动效 —— 交易 pending 时箭头扫光 + 节点依次脉动,已处理 prefers-reduced-motion。

仪表位置指针 —— 风险分为 0 时填充宽度为 0,仪表会完全空掉。加一条始终可见的指针,用 clamp() 夹在轨道内。

风险态图例 —— 三行解释 Normal / Warning / Protected 的含义,当前态高亮。没有编造阈值数字。

无障碍

  • 所有按钮通过 WCAG AA(5.03 – 6.95)
  • 最弱一级文字从 OKX 原值 #5B5B5B(纯黑上仅 3.1:1)提到 #7A7A7A(4.9:1)
  • 禁用按钮保留可读文字,不再用 opacity: 0.45 —— 那个写法会把按钮和页面背景混色,实测对比度只有约 2.9:1,而首屏 7 个按钮里有 6 个是禁用态

验证

本地预演了 CI 会跑的全部检查:

  • forge test —— 12 / 12
  • npm run verify —— 22 / 22 单测 + 前端构建
  • npm run submission:check:final —— 通过
  • 横向溢出(1440 / 1280 / 390)—— 均无
  • 按钮文字折行 —— 0 处
  • 全页文字对比度 —— 无低于 AA 的项

注意

这个分支不会触发 Pages 部署(pages.yml 只在 push 到 main 时跑),所以合并之前线上提交页面不受影响。

合并到 main 会立即重新部署 GitHub Pages。

Replace the generic light-theme card layout with a financial-terminal look
derived from design tokens measured on okx.com (home page + BTC/USDT spot
page, read via getComputedStyle frequency counts).

Design tokens
- background #000000 (OKX uses pure black, not off-black)
- panels #121212 / #1d1d1d / #2e2e2e / #383838
- accent green #25A750; negative rose #CA3F64 (OKX uses rose, not pure red)
- border-radius 0 everywhere; the trading UI is fully square
- 1px #383838 hairline dividers instead of card borders and shadows
- 14px base type scale; numbers right-aligned with tabular-nums

Added
- instrument strip: six-cell dense data bar under the header
- fund-flow diagram: Trader -> Router -> PoolManager -> XGuardHook ->
  Settlement, with the hook node highlighted and showing the live risk
  score and fee. Built with HTML/CSS rather than SVG so it reflows into a
  vertical flow on narrow screens instead of scrolling sideways.
- risk trend curve built from RiskUpdated events: seeded from
  getContractEvents on load so it has content immediately, then appended
  through the existing watchContractEvent subscription
- flow animation while a transaction is pending (arrow sweep plus a
  staggered node pulse), gated behind prefers-reduced-motion
- gauge position marker so the gauge is still readable when the score is 0
- risk state legend explaining Normal / Warning / Protected

Accessibility
- every button passes WCAG AA (5.03 - 6.95)
- the weakest text tier was raised from OKX's #5B5B5B (3.1:1 on black) to
  #7A7A7A (4.9:1)
- disabled buttons keep legible labels instead of opacity: 0.45, which
  silently blended the button into the page background

Verified
- npm run web:build, npm run test:node (22/22), npm run submission:check
- no horizontal overflow at 1440 / 1280 / 390
- no button text wrapping
@vercel

vercel Bot commented Sep 19, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
xguard-hook Ready Ready Preview Sep 19, 2026 7:59am UTC

@azen07508-debug
azen07508-debug merged commit 34e0ad5 into main Sep 19, 2026
3 checks passed

This branch was successfully deployed

1 active deployment
Preview — d0ea3663 Deployed Sep 19, 2026 by vercel[bot]
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