Skip to content

feat(web-ui): show CH Desktop hero badge inside desktop shell - #1323

Merged
iruriQ merged 1 commit into
mainfrom
feat/desktop-shell-hero-badge
Nov 27, 2026
Merged

iruriQ merged 1 commit into
mainfrom
feat/desktop-shell-hero-badge

Conversation

@iruriQ

@iruriQ iruriQ commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

Display CH Desktop instead of Web in the new-session hero badge when the Web UI runs inside the standalone Tauri desktop shell, while keeping Web in ordinary browser tabs.

Changes

  • apps/web-ui/packages/client/ui-conversation/src/client/locales.ts: Add "hero.previewDesktop": "CH Desktop" for both zh and en (keeping "hero.preview": "Web").
  • apps/web-ui/packages/client/ui-conversation/src/client/skeleton/EmptyHero.tsx: Render both .previewBadgeWeb and .previewBadgeDesktop spans inside .previewBadge.
  • apps/web-ui/packages/client/ui-conversation/src/client/skeleton/HeroShell.module.css: Hide .previewBadgeDesktop by default, and switch visibility under :global(html[data-codexhost-shell]) / :global(html[data-tauri-shell]) (attributes set by apps/desktop-shell/src-tauri/src/init_script.js at document_start) for zero first-paint flicker and preserved centered wrapping.

Visual Changes

Browser (Web) Desktop shell (CH Desktop, zh)
Browser Web badge Desktop shell CH Desktop badge zh
Desktop shell (CH Desktop, en) Desktop shell narrow wrap (340px)
Desktop shell CH Desktop badge en Desktop shell CH Desktop narrow viewport

Validation

  • pre-commit Prettier formatting check on all 3 changed files in the PR worktree: passed.
  • Full Web UI build (node --import tsx apps/web-ui/scripts/build.ts) passed in the implementation session, and compiled CSS rules were verified.
  • Rendered screenshots inspected across browser (Web), desktop shell (CH Desktop zh/en), and 340px narrow viewport wrapping.
  • Full-repo lint/typecheck/test delegated to CI per AGENTS.md.

When the Web UI runs inside the Tauri desktop shell (which sets data-codexhost-shell and data-tauri-shell on <html> at document_start), display "CH Desktop" instead of "Web" in the new-session hero badge so desktop users clearly distinguish the standalone desktop shell from a browser tab.

Browser sessions continue to display "Web". Switching is CSS-driven on the root shell attributes to prevent first-paint flicker and preserve centered narrow-viewport wrapping.
@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • 新功能
    • 桌面应用中显示“CH Desktop”预览标识;其他环境继续显示 Web 预览标识。

此变更为中文和英文词典添加 Desktop 预览徽标文案。HeroShell 同时渲染 Web 和 Desktop 徽标,并根据运行环境切换显示内容。

Changes: 桌面预览徽标

层 / 文件 摘要
徽标文案与环境显示
apps/web-ui/packages/client/ui-conversation/src/client/locales.ts, apps/web-ui/packages/client/ui-conversation/src/client/skeleton/EmptyHero.tsx, apps/web-ui/packages/client/ui-conversation/src/client/skeleton/HeroShell.module.css
中文和英文词典新增 hero.previewDesktop 文案 "CH Desktop"。HeroShell 渲染 Web 和 Desktop 两种徽标;在 CodexHost 或 Tauri Shell 中隐藏 Web 徽标并显示 Desktop 徽标。

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Feature

Suggested reviewers: bytepioneer-ai

Merge Risk: Minimal · up to 44540

The new-session hero badge shows "CH Desktop" inside the desktop shell and "Web" in browser tabs. This is a small, low-risk UI change and can be merged.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed 标题“feat(web-ui): show CH Desktop hero badge inside desktop shell”清楚描述了主要变更:在桌面外壳中,新会话 hero 徽标显示 “CH Desktop”。变更摘要显示 locales.ts 新增 hero.previewDesktop,EmptyHero.tsx 渲染两个徽标,HeroShell.module.css 按 data-c…
Description check Passed 描述说明了在 Tauri 桌面外壳中以 “CH Desktop” 替代 “Web” 的目的,并列出了三个变更文件及其改动内容,还包含验证步骤和截图。内容与变更集直接相关。
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.
Full details: Title check

Explanation

标题“feat(web-ui): show CH Desktop hero badge inside desktop shell”清楚描述了主要变更:在桌面外壳中,新会话 hero 徽标显示 “CH Desktop”。变更摘要显示 locales.ts 新增 hero.previewDesktop,EmptyHero.tsx 渲染两个徽标,HeroShell.module.css 按 data-codexhost-shell 或 data-tauri-shell 切换可见性,与标题一致。

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 36d0b79 and 4454090.

Files selected for processing: 3

  • apps/web-ui/packages/client/ui-conversation/src/client/locales.ts
  • apps/web-ui/packages/client/ui-conversation/src/client/skeleton/EmptyHero.tsx
  • apps/web-ui/packages/client/ui-conversation/src/client/skeleton/HeroShell.module.css

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review.

Recent review details

Context from checks skipped due to timeout: 8

  • GitHub Check: CodeRabbit
  • GitHub Check: Check windows-latest
  • GitHub Check: Check macos-26
  • GitHub Check: Vitest
  • GitHub Check: Check ubuntu-22.04
  • GitHub Check: Web Host tests
  • GitHub Check: Static checks
  • GitHub Check: Check Linux ARM64
Additional context used

Code guidelines: 1

docs/product/standalone-web.md — auto-discovered
Path-based instructions: 1

Applicability reference: AGENTS.md: # Repository Guidelines `npm start` / `npm start web` rebuild and relaunch the user's Desktop / Web and may restart the shared Host; `npm stop` stops all local codexhost services across worktrees.

CodeRabbit inference engine (docs/product/standalone-web.md)

Files:

  • apps/web-ui/packages/client/ui-conversation/src/client/locales.ts
  • apps/web-ui/packages/client/ui-conversation/src/client/skeleton/EmptyHero.tsx
  • apps/web-ui/packages/client/ui-conversation/src/client/skeleton/HeroShell.module.css
Stylelint (17.14.0)

apps/web-ui/packages/client/ui-conversation/src/client/skeleton/HeroShell.module.css

[error] 82-82: Unknown pseudo-class selector ":global" (selector-pseudo-class-no-unknown)

(selector-pseudo-class-no-unknown)

[error] 83-83: Unknown pseudo-class selector ":global" (selector-pseudo-class-no-unknown)

(selector-pseudo-class-no-unknown)

[error] 87-87: Unknown pseudo-class selector ":global" (selector-pseudo-class-no-unknown)

(selector-pseudo-class-no-unknown)

[error] 88-88: Unknown pseudo-class selector ":global" (selector-pseudo-class-no-unknown)

(selector-pseudo-class-no-unknown)

Additional comments: 1

apps/web-ui/packages/client/ui-conversation/src/client/skeleton/HeroShell.module.css: 1

82-83: Functional Correctness

該擔憂不成立。applyRootAttributes 在根元素不存在時會返回 false,但初始化腳本隨後會建立 MutationObserver 監聽 document 的子節點變化,並在 DOMContentLoaded 時再次呼叫該函式。兩條路徑都會在根元素出現後設定 data-codexhost-shell 與 data-tauri-shell,因此 .previewBadgeWeb 隱藏、.previewBadgeDesktop 顯示的條件會被滿足。

@iruriQ
iruriQ merged commit ee0aec6 into main Nov 27, 2026
5 of 8 checks passed
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.

2 participants