Skip to content

fix(ui): center AI-translate dual columns, consolidate MB-Web tokens, sync DESIGN.md fonts (0.8.3)#137

Merged
helebest merged 2 commits into
mainfrom
ui-polish-083
Jun 27, 2026
Merged

fix(ui): center AI-translate dual columns, consolidate MB-Web tokens, sync DESIGN.md fonts (0.8.3)#137
helebest merged 2 commits into
mainfrom
ui-polish-083

Conversation

@helebest

@helebest helebest commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

What & why

Third UI-polish round (/impeccable critique → polish → deliver). The critique put the main workbench at its polish ceiling; this round lands two real findings plus the design-system doc-sync the delivery loop requires.

1. AI-translate dual columns no longer left-hug the pane (Fixed)

BilingualView's root carries markdown-body bilingual-cols, so it inherited .markdown-body { max-width: 72ch } — the single-column reading measure — and crushed both columns into the left ~half, leaving the pane's right half empty.

.bilingual-cols now overrides the cap: it fills the reader pane (each column gets its own measure) and, past two measures on an ultra-wide pane, caps at 2×72ch + gap and centers.

  • TDD: new bilingual.spec.ts guard "dual-column view fills the reader pane…" — fails pre-fix (ratio ≈ 0.88), passes post-fix (≈ 1.0).
  • Browser-verified: columns now span the full pane with the centered hairline; colW/parentW = 1.0.

2. MB-Web radii + colors consolidated onto the shared tokens (Changed — "彻底并轨")

src/mb/mb.css kept a parallel light+dark literal palette whose values already duplicated the workbench tokens value-for-value (verified each, both themes).

  • Differently-named locals now alias the shared token (--ac: var(--accent), --border: var(--line), --surface2: var(--surface-2), …).
  • Same-named ones (--bg/--surface/--text/--muted/--danger/--radius) inherit the global :root/dark values → the parallel dark block is deleted (only 5 MB-specific dark literals remain).
  • Off-scale "magic" radii (20/22/24px + a 12px chip) → 999px pill; the 4 --radius-lg (12px) cards → --radius (8px) — back on the 4/6/7/8/999 scale.
  • Note-highlighter yellows → named --mb-mark / --mb-mark-staged tokens.
  • Kept local (no shared equivalent): answer-blue pair, on-accent fg, AA-darkened --faint, hover wash.
  • Zero-visual-change for colors; browser-verified across library / reader / notes in light + dark.

3. DESIGN.md typography frontmatter matched to the implementation (Fixed)

The machine-readable typography: block still named the pre-v0.8.0 families (Source Serif 4 / Inter Tight / JetBrains Mono) and carried swapped weights (display 500, label 600), contradicting the shipped IBM Plex superfamily and the §3 prose table (display 600, label 500). Corrected, plus a stray §3 "JetBrains Mono" mention and the §3 MB-Web subsystem note.

Verification

  • npm run verify green: lint · format:check · typecheck · coverage (901 unit, thresholds met) · build · e2e.
  • Clean e2e: 54 passed. (A contended run earlier failed timing-sensitive specs because a Chrome MCP browser session was hammering the same dev server; the known graph.spec.ts:83 Pixi flake + a wiki.spec.ts:165 Mermaid <style> strict-mode timing flake both pass on rerun/in isolation — neither is touched by this diff.)
  • check:bundle: CSS 30.3 KB gzip / 35 (consolidation shrank CSS).
  • Independent code-review pass: no issues at confidence ≥ 80 — all MB-Web aliases cross-checked light+dark, no orphaned vars, fill-guard sound, frontmatter agrees with code.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Fixed the bilingual dual-column reader so it now fills the available reader pane on wide screens instead of staying too narrow.
    • Improved visual consistency across the app by standardizing colors, spacing, and rounded corners.
  • Documentation

    • Updated the design and UI guidance to reflect the latest typography and bilingual layout behavior.
  • Tests

    • Added end-to-end coverage for the bilingual dual-column layout to help prevent regressions.

… sync DESIGN.md fonts (0.8.3)

The bilingual reader's root carries `markdown-body bilingual-cols`, so it inherited
the single-column `max-width: 72ch` and crushed both columns to the left, leaving
the pane's right half empty. `.bilingual-cols` now overrides the cap: it fills the
reader pane (each column gets its own measure) and, past two measures on an
ultra-wide pane, caps and centers. Guarded by a new bilingual.spec.ts e2e
asserting the columns fill ≥95% of the pane.

MB-Web kept a parallel light+dark literal palette that duplicated the workbench
tokens value-for-value. Differently-named locals now alias the shared token
(`--ac: var(--accent)`, `--border: var(--line)`, …), same-named ones inherit the
global values, and the parallel dark block is gone — only the genuinely
MB-specific literals (answer-blue, on-accent fg, AA-darkened faint, hover wash)
remain. Off-scale "magic" radii snapped to the 4/6/7/8/999 scale (cards 8px;
badge/chip/filter/toast/sync pills fully round); the note highlighter yellows
became named --mb-mark / --mb-mark-staged tokens. Zero-visual-change for colors;
verified in the browser across library, reader and notes in light + dark.

DESIGN.md's typography frontmatter still named the pre-v0.8.0 families (Source
Serif 4 / Inter Tight / JetBrains Mono) with swapped weights (display 500, label
600), contradicting the shipped IBM Plex superfamily and the §3 table — now
corrected, along with a stray §3 "JetBrains Mono" mention and a ui-checklist item
for the dual-column fill.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@helebest, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 51 minutes. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 10f15544-c1cc-4a2f-af86-fc71d265480a

📥 Commits

Reviewing files that changed from the base of the PR and between f5212b6 and 95776e0.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • src/styles.css
  • tests/e2e/bilingual.spec.ts
📝 Walkthrough

Walkthrough

Version 0.8.3 fixes the bilingual dual-column reader layout by adding max-width and centering to .bilingual-cols, verified by a new e2e width-ratio test. MB-Web CSS colors and radii are consolidated onto shared design tokens, replacing hardcoded palette literals and normalizing border radii. Typography docs are updated to reflect IBM Plex families.

Changes

Bilingual layout fix

Layer / File(s) Summary
.bilingual-cols width fix and e2e test
src/styles.css, docs/ui-checklist.md, tests/e2e/bilingual.spec.ts
.bilingual-cols gains max-width: calc(72ch * 2 + 40px) and margin-inline: auto, overriding the inherited .markdown-body measure cap. A new e2e test asserts the column width ratio against its parent exceeds 0.95. Checklist updated with explicit fill-behavior requirement.

MB-Web token consolidation

Layer / File(s) Summary
MB-Web shared token aliasing and radii
src/mb/mb.css
Light-theme .mb-app variables aliased to shared --surface*, --border, --ac*, --faint tokens; dark-theme block reduced to MB-only literals. Border radii normalized: chip/badge/toast/sync/filter to 999px, note/pop/confirm to var(--radius). ::selection and ::highlight(mb-staged) now use --mb-mark / --mb-mark-staged.
DESIGN.md typography and MB-Web docs
DESIGN.md
Type Roles updated to IBM Plex Serif/Sans/Mono families and revised per-role metrics. MB-Web section documents shared-token migration, removed dark block, and remaining local literals. Label uppercase rule references IBM Plex Mono.
Version bump and changelog
package.json, CHANGELOG.md, .gitignore
Version bumped to 0.8.3; changelog entry added for both fixes; .impeccable/critique/ added to .gitignore.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • OpenDIKW/dikw-web#134: Overlaps with this PR's DESIGN.md IBM Plex typography contract updates in the same document sections.
  • OpenDIKW/dikw-web#136: Previous MB-Web token migration work in src/mb/mb.css that this PR continues.

Poem

🐇 Two columns wide, no more hugging the left,
The bilingual reader is no longer bereft!
Tokens aligned on a shared design scale,
IBM Plex Mono marks the label trail.
The rabbit hops on — 0.8.3 set sail! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately captures the three main changes: dual-column layout, MB-Web token consolidation, and DESIGN.md font sync.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ui-polish-083

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f5212b6205

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/styles.css
line length on an ultra-wide monitor. */
.bilingual-cols {
position: relative;
max-width: calc(72ch * 2 + 40px);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restore the single-column cap when columns stack

When the viewport is below 1100px, the media query later in this file collapses .bi-pair to one column, but this new override still leaves the container capped at two reading measures instead of the original .markdown-body 72ch cap. On tablet/narrow desktop widths where the wiki layout is already single-column, bilingual source/translation paragraphs can now run nearly the full panel width while the normal reader remains capped, regressing the readability this cap was meant to protect. Add a narrow-mode override such as restoring max-width: 72ch for .bilingual-cols once the pairs stack.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — fixed in 95776e0. Below 1100px the pairs stack to a single column, so I restored max-width: 72ch for .bilingual-cols inside that stack media query; the two-measure cap now applies only to the side-by-side layout. Added a bilingual.spec.ts guard asserting the resolved max-width reverts to the single measure at a narrow viewport.

… (Codex P2)

Below 1100px the bilingual pairs collapse to one stacked column, but the new
`.bilingual-cols` two-measure cap left a stacked paragraph free to run the full
panel width — wider than the mono reader's 72ch, regressing the readability the
cap protects. Restore `max-width: 72ch` inside the existing stack media query.
Guarded by a new bilingual.spec.ts test asserting the resolved max-width reverts
to the single measure at a narrow viewport.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@helebest helebest merged commit 2f2168f into main Jun 27, 2026
9 checks passed
@helebest helebest deleted the ui-polish-083 branch June 27, 2026 13:47
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