Skip to content

feat:拆分wework tab - #2358

Merged
qdaxb merged 8 commits into
wecode-ai:mainfrom
Micro66:human/sloth-20260731-111530
Jul 31, 2026
Merged

qdaxb merged 8 commits into
wecode-ai:mainfrom
Micro66:human/sloth-20260731-111530

Conversation

@Micro66

@Micro66 Micro66 commented Jul 31, 2026 •

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Added always-visible app tabs for faster navigation between desktop areas.
    • Added improved preference loading, including live updates to language and experimental settings.
    • Added sidebar expansion controls for desktop app layouts.
  • Style

    • Refreshed desktop navigation, title bars, borders, spacing, transparency, and macOS vibrancy effects.
    • Standardized workspace surfaces and sidebar behavior across platforms.
  • Chores

    • Removed legacy demo pages and unused sample interfaces.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b6863d1d-08da-4f31-994b-d4ced43187f2

📥 Commits

Reviewing files that changed from the base of the PR and between cc72678 and 749dcd6.

📒 Files selected for processing (3)
  • wework/e2e/desktop/task-flow.e2e.mjs
  • wework/src-tauri/tauri.windows.conf.json
  • wework/src/test/windows-window-chrome.test.ts

📝 Walkthrough

Walkthrough

The PR removes several demo pages and assets. It adds shared app-preference state, unified desktop titlebar behavior, reusable sidebar primitives, Tauri collapsed-sidebar controls, updated workspace layouts, and corresponding test coverage.

Changes

Desktop shell and demo cleanup

Layer / File(s) Summary
Preferences and application shell
wework/src/features/app-preferences/*, wework/src/features/experimental-features/useExperimentalFeaturesEnabled.ts, wework/src/App.tsx, wework/src-tauri/tauri.conf.json
Adds AppPreferencesProvider, AppPreferencesContext, and useAppPreferencesState hook for shared preference loading and change propagation. Updates App.tsx to initialize preferences, delay route rendering until experimental features load, and apply Tauri macOS transparency and sidebar effects.
Shared sidebar navigation
wework/src/components/layout/DesktopAppSwitcher.tsx, wework/src/components/layout/DesktopAppSwitcher.test.tsx, wework/src/components/layout/DesktopCollapsedSidebarToggle.tsx, wework/src/components/layout/DesktopSidebarPrimitives.tsx, wework/src/components/layout/DesktopSidebar.tsx, wework/src/components/layout/DesktopSidebar.test.tsx
Adds reusable sidebar primitives: DesktopSidebarHeader, DesktopSidebarNavItem, DesktopSidebarSectionHeader. Adds DesktopCollapsedSidebarToggle for Tauri desktop layouts. Extends DesktopAppSwitcher with a tabs variant. Refactors DesktopSidebar to use shared primitives and removes local implementations.
Unified titlebar and workbench layout
wework/src/components/topnav/ChromeTitlebar.tsx, wework/src/components/topnav/ChromeTitlebar.test.tsx, wework/src/components/topnav/TitlebarActionsPortal.tsx, wework/src/components/topnav/AppIframe.tsx, wework/src/components/layout/DesktopWorkbenchLayout.tsx, wework/src/components/layout/DesktopWorkbenchLayout.test.tsx, wework/src/components/layout/DesktopWorkbenchMain.tsx, wework/src/styles/globals.css
Removes DesktopWindowsTitlebar and Windows-specific titlebar paths. Updates ChromeTitlebar with optional showWorkspacePortals and showFeedback props. Unifies titlebar rendering across Tauri and non-Tauri platforms. Adds layered surfaces, vibrancy backgrounds, and application-view insets for desktop vibrancy mode.
Workspace and route integration
wework/src/features/todo/CloudTodoWorkspace.tsx, wework/src/features/todo/CloudTodoWorkspace.test.tsx, wework/src/features/todo/TodoNavigation.tsx, wework/src/pages/AutomationsPage.tsx, wework/src/pages/CloudWorkPage.tsx, wework/src/pages/CloudWorkPage.test.tsx, wework/src/pages/PluginsPage.tsx, wework/src/pages/SitesPage.tsx, wework/src/App.apps.test.tsx, wework/src/App.plugins.test.tsx
Updates workspace and page components to use shared sidebar controls and Tauri collapsed-sidebar expansion. Integrates DesktopCollapsedSidebarToggle for automation, cloud work, plugins, and sites pages. Adds asynchronous element waits in route tests and validates shared titlebar, sidebar scope, and updated desktop chrome expectations.
Window configuration and E2E validation
wework/src-tauri/tauri.windows.conf.json, wework/src/test/windows-window-chrome.test.ts, wework/e2e/desktop/task-flow.e2e.mjs
Enables window shadow on Windows. Adds test to verify Windows Tauri configuration disables decorations and enables shadow. Updates E2E workspace-panel alignment check to compare left positions instead of viewport alignment.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related PRs

Suggested reviewers: qdaxb

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title 'feat:拆分wework tab' refers to splitting WeWork tabs, but the primary changes remove legacy demo files and refactor desktop sidebar/titlebar components—not tab functionality. Update the title to accurately reflect the main change: refactoring desktop shell layout, removing legacy demos, and consolidating sidebar/titlebar components.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
wework/src/features/todo/CloudTodoWorkspace.tsx (1)

1537-1545: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Keep the project action button reachable by keyboard.

Line 1543 uses hidden, which applies display: none. A keyboard user cannot focus the button, so focus:flex cannot make it visible. This blocks the Rename, Archive, and Copy Project ID actions.

Use opacity-based visibility, or keep an always-visible accessible action control.

Proposed fix
- className="hidden h-7 w-7 shrink-0 items-center justify-center rounded-md text-[rgb(var(--color-sidebar-text-muted))] transition hover:bg-[rgb(var(--color-sidebar-hover))] hover:text-[rgb(var(--color-sidebar-text-primary))] focus:flex group-hover:flex"
+ className="absolute right-0 flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-[rgb(var(--color-sidebar-text-muted))] opacity-0 transition-opacity hover:bg-[rgb(var(--color-sidebar-hover))] hover:text-[rgb(var(--color-sidebar-text-primary))] focus-visible:opacity-100 group-hover:opacity-100 group-focus-within:opacity-100"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@wework/src/features/todo/CloudTodoWorkspace.tsx` around lines 1537 - 1545,
Update the project action button in the project sidebar, identified by its
data-testid and onClick handler, so it is not removed from the keyboard focus
order by the hidden display utility. Replace the display-none visibility
approach with an opacity/visibility pattern that preserves keyboard focus and
allows the existing focus styling to reveal it, while retaining the current
hover behavior and project actions.
🧹 Nitpick comments (2)
wework/src/components/layout/DesktopWorkbenchMain.tsx (1)

137-137: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Rename the constant to drop the stale MACOS_ prefix.

MACOS_COLLAPSED_SIDEBAR_CONTROL_ALIGNMENT_CLASS is applied unconditionally whenever sidebarCollapsed is true in the unified Tauri header (lines 2135-2149), regardless of platform. Windows-specific paths were removed in this same change, so the name no longer describes its scope and can mislead future platform-specific edits.

✏️ Proposed rename
-const MACOS_COLLAPSED_SIDEBAR_CONTROL_ALIGNMENT_CLASS = 'pl-2'
+const COLLAPSED_SIDEBAR_CONTROL_ALIGNMENT_CLASS = 'pl-2'

Update the one usage at line 2140 to match.

As per coding guidelines, "/*.{py,ts,tsx,js,jsx}: ... names must be clear."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@wework/src/components/layout/DesktopWorkbenchMain.tsx` at line 137, Rename
MACOS_COLLAPSED_SIDEBAR_CONTROL_ALIGNMENT_CLASS to
COLLAPSED_SIDEBAR_CONTROL_ALIGNMENT_CLASS and update its usage in the unified
Tauri header where sidebarCollapsed is handled, preserving the existing styling
behavior.

Source: Coding guidelines

wework/src/components/layout/DesktopCollapsedSidebarToggle.tsx (1)

1-27: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add direct test coverage for this shared toggle.

This component now gates Tauri sidebar expansion for four pages (AutomationsPage, CloudWorkPage, PluginsPage, SitesPage). No dedicated test file for DesktopCollapsedSidebarToggle appears in this change set. Add a focused test that covers: not rendering when collapsed is false, not rendering outside Tauri runtime, and calling onToggle on click when both conditions hold.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@wework/src/components/layout/DesktopCollapsedSidebarToggle.tsx` around lines
1 - 27, Add a focused test suite for DesktopCollapsedSidebarToggle covering the
non-collapsed and non-Tauri cases as non-rendering, plus rendering and invoking
onToggle when collapsed in Tauri runtime; mock or control isTauriRuntime and
trigger the exposed toggle control via its test identifier.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@wework/src/App.tsx`:
- Around line 301-320: Remove the hardcoded titlebarOverlaysContent constant and
update the affected render branches to use 'flex flex-col' and 'flex-1'
directly. Locate the two ternaries in the App component and eliminate their
obsolete conditional paths while preserving the surrounding layout behavior.

In `@wework/src/components/layout/DesktopAppSwitcher.tsx`:
- Around line 277-313: Update the tabs-variant buttons rendered in
DesktopAppSwitcher around the option.label output to constrain and truncate long
labels, reusing the existing chrome-tab button sizing pattern with max-width,
min-width, min-w-0, and truncate classes while preserving the current active,
disabled, and layout styling.

In `@wework/src/components/layout/DesktopSidebar.tsx`:
- Line 2489: Remove the hardcoded usesOverlayTitlebar variable and all
conditional JSX branches that depend on it, including the pt-[44px] styling,
MacOSTitleBarDragRegion, and duplicate
desktop-sidebar-chrome-controls/DesktopWindowControls block. Retain the active
DesktopSidebarHeader path and remove the now-unused MacOSTitleBarDragRegion
import.

---

Outside diff comments:
In `@wework/src/features/todo/CloudTodoWorkspace.tsx`:
- Around line 1537-1545: Update the project action button in the project
sidebar, identified by its data-testid and onClick handler, so it is not removed
from the keyboard focus order by the hidden display utility. Replace the
display-none visibility approach with an opacity/visibility pattern that
preserves keyboard focus and allows the existing focus styling to reveal it,
while retaining the current hover behavior and project actions.

---

Nitpick comments:
In `@wework/src/components/layout/DesktopCollapsedSidebarToggle.tsx`:
- Around line 1-27: Add a focused test suite for DesktopCollapsedSidebarToggle
covering the non-collapsed and non-Tauri cases as non-rendering, plus rendering
and invoking onToggle when collapsed in Tauri runtime; mock or control
isTauriRuntime and trigger the exposed toggle control via its test identifier.

In `@wework/src/components/layout/DesktopWorkbenchMain.tsx`:
- Line 137: Rename MACOS_COLLAPSED_SIDEBAR_CONTROL_ALIGNMENT_CLASS to
COLLAPSED_SIDEBAR_CONTROL_ALIGNMENT_CLASS and update its usage in the unified
Tauri header where sidebarCollapsed is handled, preserving the existing styling
behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f0d49698-e98e-45dd-92a1-552e64d89f59

📥 Commits

Reviewing files that changed from the base of the PR and between 1c76724 and cc72678.

⛔ Files ignored due to path filters (15)
  • demo/kanban-redesign/preview.png is excluded by !**/*.png
  • demo/kanban-redesign/shots/files.png is excluded by !**/*.png
  • demo/kanban-redesign/shots/index-detail.png is excluded by !**/*.png
  • demo/kanban-redesign/shots/index-members.png is excluded by !**/*.png
  • demo/kanban-redesign/shots/index-new-task.png is excluded by !**/*.png
  • demo/kanban-redesign/shots/index-start-task.png is excluded by !**/*.png
  • demo/kanban-redesign/shots/index.png is excluded by !**/*.png
  • demo/kanban-redesign/shots/my-work.png is excluded by !**/*.png
  • demo/kanban-redesign/shots/new-task.png is excluded by !**/*.png
  • demo/kanban-redesign/shots/projects-new-project.png is excluded by !**/*.png
  • demo/kanban-redesign/shots/projects.png is excluded by !**/*.png
  • demo/kanban-redesign/shots/verify/my-work-calendar.png is excluded by !**/*.png
  • demo/kanban-redesign/shots/verify/my-work-group.png is excluded by !**/*.png
  • demo/kanban-redesign/shots/verify/my-work-list.png is excluded by !**/*.png
  • demo/kanban-redesign/shots/verify/my-work-timeline.png is excluded by !**/*.png
📒 Files selected for processing (42)
  • demo/cloud-space-mention/index.html
  • demo/kanban-redesign/assets/app.js
  • demo/kanban-redesign/assets/my-work.js
  • demo/kanban-redesign/assets/style.css
  • demo/kanban-redesign/files.html
  • demo/kanban-redesign/index.html
  • demo/kanban-redesign/my-work.html
  • demo/kanban-redesign/new-task.html
  • demo/kanban-redesign/projects.html
  • demo/kanban-redesign/shots/verify/shot-mywork.js
  • wework/src-tauri/tauri.conf.json
  • wework/src/App.apps.test.tsx
  • wework/src/App.plugins.test.tsx
  • wework/src/App.tsx
  • wework/src/components/layout/DesktopAppSwitcher.test.tsx
  • wework/src/components/layout/DesktopAppSwitcher.tsx
  • wework/src/components/layout/DesktopCollapsedSidebarToggle.tsx
  • wework/src/components/layout/DesktopSidebar.test.tsx
  • wework/src/components/layout/DesktopSidebar.tsx
  • wework/src/components/layout/DesktopSidebarPrimitives.tsx
  • wework/src/components/layout/DesktopWindowsTitlebar.tsx
  • wework/src/components/layout/DesktopWorkbenchLayout.test.tsx
  • wework/src/components/layout/DesktopWorkbenchLayout.tsx
  • wework/src/components/layout/DesktopWorkbenchMain.tsx
  • wework/src/components/topnav/AppIframe.tsx
  • wework/src/components/topnav/ChromeTitlebar.test.tsx
  • wework/src/components/topnav/ChromeTitlebar.tsx
  • wework/src/components/topnav/TitlebarActionsPortal.tsx
  • wework/src/features/app-preferences/AppPreferencesProvider.test.tsx
  • wework/src/features/app-preferences/AppPreferencesProvider.tsx
  • wework/src/features/app-preferences/appPreferencesContext.ts
  • wework/src/features/app-preferences/useAppPreferencesState.ts
  • wework/src/features/experimental-features/useExperimentalFeaturesEnabled.ts
  • wework/src/features/todo/CloudTodoWorkspace.test.tsx
  • wework/src/features/todo/CloudTodoWorkspace.tsx
  • wework/src/features/todo/TodoNavigation.tsx
  • wework/src/pages/AutomationsPage.tsx
  • wework/src/pages/CloudWorkPage.test.tsx
  • wework/src/pages/CloudWorkPage.tsx
  • wework/src/pages/PluginsPage.tsx
  • wework/src/pages/SitesPage.tsx
  • wework/src/styles/globals.css
💤 Files with no reviewable changes (13)
  • demo/kanban-redesign/shots/verify/shot-mywork.js
  • demo/kanban-redesign/files.html
  • demo/cloud-space-mention/index.html
  • demo/kanban-redesign/assets/style.css
  • wework/src/pages/CloudWorkPage.test.tsx
  • demo/kanban-redesign/projects.html
  • demo/kanban-redesign/new-task.html
  • demo/kanban-redesign/my-work.html
  • demo/kanban-redesign/index.html
  • demo/kanban-redesign/assets/my-work.js
  • wework/src/components/layout/DesktopWindowsTitlebar.tsx
  • demo/kanban-redesign/assets/app.js
  • wework/src/components/topnav/TitlebarActionsPortal.tsx

Comment thread wework/src/App.tsx
Comment on lines +301 to +320
const isPopoutWindow = isPopoutWindowRuntime()
const usesDesktopVibrancy = isTauri && !isPopoutWindow && getPlatform() === 'mac'
const titlebarOverlaysContent = false
const showChromeTitlebar = isTauri && !isPopoutWindow
const titlebarActiveKey = path === '/todo' ? 'todo' : activeAppKey
const [workbenchStartupReady, setWorkbenchStartupReady] = useState(false)
const [workbenchStartupRevealTimedOut, setWorkbenchStartupRevealTimedOut] = useState(false)
const isPopoutWindow = isPopoutWindowRuntime()
const openWeworkForAppshot = useCallback(() => {
navigateToApp('wework')
}, [navigateToApp])

useEffect(() => {
if (!usesDesktopVibrancy) return undefined

document.documentElement.dataset.desktopVibrancy = 'true'
return () => {
delete document.documentElement.dataset.desktopVibrancy
}
}, [usesDesktopVibrancy])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Remove the dead titlebarOverlaysContent branch.

titlebarOverlaysContent is now hardcoded to false and never recomputed. Lines 507 and 524 still branch on it (titlebarOverlaysContent ? 'relative' : 'flex flex-col' and titlebarOverlaysContent ? 'h-full' : 'flex-1'), but both always resolve to the second arm. Remove the constant and the ternaries, and use 'flex flex-col' and 'flex-1' directly.

🧹 Proposed cleanup
-  const titlebarOverlaysContent = false
   const showChromeTitlebar = isTauri && !isPopoutWindow
-        titlebarOverlaysContent ? 'relative' : 'flex flex-col'
+        'flex flex-col'
-          titlebarOverlaysContent ? 'h-full' : 'flex-1'
+          'flex-1'

Based on learnings, this matches the repo-wide instruction to "remove obsolete paths, and fix the primary flow rather than hiding defects behind fallbacks."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@wework/src/App.tsx` around lines 301 - 320, Remove the hardcoded
titlebarOverlaysContent constant and update the affected render branches to use
'flex flex-col' and 'flex-1' directly. Locate the two ternaries in the App
component and eliminate their obsolete conditional paths while preserving the
surrounding layout behavior.

Source: Coding guidelines

Comment on lines +277 to +313
if (variant === 'tabs') {
return (
<nav
data-testid="desktop-app-switcher"
aria-label={t('workbench.app_navigation', '应用导航')}
className={cn('flex shrink-0 items-center gap-1', className)}
>
{options.map(option => {
const active = option.key === activeApp
const optionTestId = testIds?.[option.key] ?? `chrome-tab-${option.key}`

return (
<button
key={option.key}
type="button"
data-testid={optionTestId}
onClick={() => !option.disabled && onNavigate(option.key)}
disabled={option.disabled}
title={option.availabilityLabel ?? option.description}
aria-label={option.label}
aria-current={active ? 'page' : undefined}
className={cn(
'flex h-8 items-center rounded-lg px-2 text-sm font-medium leading-none transition-colors',
active
? 'bg-black/[0.045] text-text-primary'
: 'text-text-secondary hover:bg-black/[0.04] hover:text-text-primary',
option.disabled && 'cursor-not-allowed opacity-50 hover:bg-transparent'
)}
>
{option.label}
</button>
)
})}
</nav>
)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Add truncation to the tabs-variant buttons.

The tabs-variant buttons render {option.label} with no truncate, min-w-0, or max-w class. The default labels are short Chinese strings, but a longer translation could overflow the fixed h-[38px] titlebar row. The existing chrome-tab-* buttons in ChromeTitlebar.tsx already guard against this with max-w-[220px] min-w-24 ... truncate.

🐛 Proposed fix
             <button
               key={option.key}
               type="button"
               data-testid={optionTestId}
               onClick={() => !option.disabled && onNavigate(option.key)}
               disabled={option.disabled}
               title={option.availabilityLabel ?? option.description}
               aria-label={option.label}
               aria-current={active ? 'page' : undefined}
               className={cn(
-                'flex h-8 items-center rounded-lg px-2 text-sm font-medium leading-none transition-colors',
+                'flex h-8 max-w-[160px] min-w-0 items-center rounded-lg px-2 text-sm font-medium leading-none transition-colors',
                 active
                   ? 'bg-black/[0.045] text-text-primary'
                   : 'text-text-secondary hover:bg-black/[0.04] hover:text-text-primary',
                 option.disabled && 'cursor-not-allowed opacity-50 hover:bg-transparent'
               )}
             >
-              {option.label}
+              <span className="truncate">{option.label}</span>
             </button>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (variant === 'tabs') {
return (
<nav
data-testid="desktop-app-switcher"
aria-label={t('workbench.app_navigation', '应用导航')}
className={cn('flex shrink-0 items-center gap-1', className)}
>
{options.map(option => {
const active = option.key === activeApp
const optionTestId = testIds?.[option.key] ?? `chrome-tab-${option.key}`
return (
<button
key={option.key}
type="button"
data-testid={optionTestId}
onClick={() => !option.disabled && onNavigate(option.key)}
disabled={option.disabled}
title={option.availabilityLabel ?? option.description}
aria-label={option.label}
aria-current={active ? 'page' : undefined}
className={cn(
'flex h-8 items-center rounded-lg px-2 text-sm font-medium leading-none transition-colors',
active
? 'bg-black/[0.045] text-text-primary'
: 'text-text-secondary hover:bg-black/[0.04] hover:text-text-primary',
option.disabled && 'cursor-not-allowed opacity-50 hover:bg-transparent'
)}
>
{option.label}
</button>
)
})}
</nav>
)
}
if (variant === 'tabs') {
return (
<nav
data-testid="desktop-app-switcher"
aria-label={t('workbench.app_navigation', '应用导航')}
className={cn('flex shrink-0 items-center gap-1', className)}
>
{options.map(option => {
const active = option.key === activeApp
const optionTestId = testIds?.[option.key] ?? `chrome-tab-${option.key}`
return (
<button
key={option.key}
type="button"
data-testid={optionTestId}
onClick={() => !option.disabled && onNavigate(option.key)}
disabled={option.disabled}
title={option.availabilityLabel ?? option.description}
aria-label={option.label}
aria-current={active ? 'page' : undefined}
className={cn(
'flex h-8 max-w-[160px] min-w-0 items-center rounded-lg px-2 text-sm font-medium leading-none transition-colors',
active
? 'bg-black/[0.045] text-text-primary'
: 'text-text-secondary hover:bg-black/[0.04] hover:text-text-primary',
option.disabled && 'cursor-not-allowed opacity-50 hover:bg-transparent'
)}
>
<span className="truncate">{option.label}</span>
</button>
)
})}
</nav>
)
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@wework/src/components/layout/DesktopAppSwitcher.tsx` around lines 277 - 313,
Update the tabs-variant buttons rendered in DesktopAppSwitcher around the
option.label output to constrain and truncate long labels, reusing the existing
chrome-tab button sizing pattern with max-width, min-width, min-w-0, and
truncate classes while preserving the current active, disabled, and layout
styling.

const requiresCloudLogin = usesCloudAccount && !cloud.isConnected
const platform = getPlatform()
const usesOverlayTitlebar = isTauriRuntime() && platform === 'mac'
const usesOverlayTitlebar = false

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Remove the now-unreachable overlay-titlebar branch.

usesOverlayTitlebar is hardcoded to false at line 2489, so the pt-[44px] branch (line 2943), the MacOSTitleBarDragRegion render (lines 2947-2949), and the duplicate desktop-sidebar-chrome-controls block with its own DesktopWindowControls (lines 2950-2964) can never execute. The new DesktopSidebarHeader (lines 2965-2989) already renders the equivalent toggle unconditionally when onToggleSidebar is provided, so this block is redundant as well as dead.

Remove usesOverlayTitlebar, the dead JSX branches, and the now-unused MacOSTitleBarDragRegion import/usage to keep only the active path.

As per coding guidelines, "Delete dead code and do not add compatibility shims or fallback paths without agreement; correct the primary path."

♻️ Proposed cleanup
-  const usesOverlayTitlebar = false
   const isWindowsTauri = isTauriRuntime() && platform === 'win'
@@
         <div
           className={cn(
             'relative flex h-full flex-col px-1.5',
-            usesOverlayTitlebar ? 'pt-[44px]' : 'pt-1.5'
+            'pt-1.5'
           )}
           style={{ width: sidebarWidth }}
         >
-          {usesOverlayTitlebar && (
-            <MacOSTitleBarDragRegion className="absolute inset-x-0 top-0 z-0 h-[38px]" />
-          )}
-          {usesOverlayTitlebar && onToggleSidebar && (
-            <div
-              data-testid="desktop-sidebar-chrome-controls"
-              className={cn(
-                'absolute inset-x-0 top-0 z-chrome flex h-[38px] items-center justify-between pr-2',
-                'pl-[92px]'
-              )}
-            >
-              <DesktopWindowControls
-                sidebarCollapsed={false}
-                onToggleSidebar={onToggleSidebar}
-                className="gap-1"
-              />
-            </div>
-          )}
           <DesktopSidebarHeader

Also applies to: 2941-2964

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@wework/src/components/layout/DesktopSidebar.tsx` at line 2489, Remove the
hardcoded usesOverlayTitlebar variable and all conditional JSX branches that
depend on it, including the pt-[44px] styling, MacOSTitleBarDragRegion, and
duplicate desktop-sidebar-chrome-controls/DesktopWindowControls block. Retain
the active DesktopSidebarHeader path and remove the now-unused
MacOSTitleBarDragRegion import.

Source: Coding guidelines

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