Repository navigation
fix(client): red peak / green off-peak badge, green pause button - #5
Closed
traderjoe1968 wants to merge 1 commit into
Closed
traderjoe1968 wants to merge 1 commit into
traderjoe1968 wants to merge 1 commit into
Conversation
徽标与按钮按峰谷语义着色,改用 DSH 真实存在的状态令牌: - 峰时 `.sg-peak`:橙黄 → 红(`--dsw-alias-state-error-primary`)。 - 谷时 `.sg-off`:此前没有规则、一直是中性灰 → 绿(`--dsw-alias-state-success-primary`)。 - 周末 `.sg-weekend`:保持绿色,与谷时合并为同一条规则。 - 「暂停 / 继续会话」按钮:中性灰 / 按下橙黄 → 常驻绿字绿边,按下态用绿色浅底。 顺带修掉一个静默回退:旧样式用的 `--dsw-alias-state-warning-primary` 在 DSH 里并不存在 (实际令牌是 `state-warn-primary`),所以 `[aria-pressed='true']` 一直吃 `#d97706` 兜底色, 主题切换时不会跟随。现在只用 `state-error-primary` / `state-success-primary`。 测试:新增 `tests/client-styles.test.mjs`(5 条)钉住选择器、颜色令牌与「不得再出现 warning 令牌」;全量 296 tests / 296 pass,lint 干净。
Author
|
Abandoning this in favor of dsh-save-money — no action needed, sorry for the noise. |
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.
What
Recolor the phase badge and the pause/resume button by peak/off-peak semantics, using only status tokens that actually exist in DSH:
.sg-peak#d97706(fallback — see below)--dsw-alias-state-error-primary.sg-off(off-peak)--dsw-alias-state-success-primary.sg-weekend.sg-off).sg-pause(Pause session).sg-pause[aria-pressed='true'](Resume session)Badges also get an 8%
color-mixtint so the state reads at a glance; the pause button uses 8% on hover and 14% when pressed.Why
.sg-status.sg-offwas rendered bystatus-badge.tsxbut never matched instyles.ts, so it looked identical to the neutral state.--dsw-alias-state-warning-primarydoes not exist in DSH (the real token isstate-warn-primary), so[aria-pressed='true']always fell back to the hardcoded#d97706and did not follow theme tokens. This PR drops it.Changes
src/client/styles.ts— the CSS above.lib/client.js,lib/client.js.map— rebuilt withpnpm build(build is reproducible; only the CSS string changed).tests/client-styles.test.mjs— 5 new tests pinning the selectors, the two color tokens, and that the non-existentwarningtoken never comes back.Verification
Visual result is unverified in a running DSH instance (no browser in the environment that produced this PR); the CSS diff is the only behavioral change and is covered by the token-level tests.
中文摘要
峰谷配色修正:
.sg-peak:橙黄 → 红(--dsw-alias-state-error-primary)。.sg-off:此前没有任何规则、一直是中性灰 → 绿(--dsw-alias-state-success-primary)。顺带修掉一处静默回退:旧样式用的
--dsw-alias-state-warning-primary在 DSH 里不存在(实际是state-warn-primary),按下态一直吃#d97706兜底色,不跟随主题令牌,现已移除。lib/client.js由pnpm build重新生成(构建可复现,仅 CSS 字符串变化)。新增 5 条样式测试;全量 296 tests / 296 pass,lint 干净。