fix: reserve Windows titlebar chrome space for Code actions

This commit is contained in:
2026-09-15 10:14:44 +08:00
parent a39fbc1619
commit dae64e52b9
6 changed files with 144 additions and 7 deletions

View File

@@ -14,12 +14,10 @@ import { useCodingWorkspaceStore } from '@/stores/coding-workspace';
import { useSettingsStore } from '@/stores/settings';
import logoWordmarkSource from '@/assets/makelore-wordmark-source.png';
import type { SidebarPeekSource } from './sidebar-peek';
import { TITLEBAR_LOGO_WIDTH, WINDOWS_TITLEBAR_CONTROLS_WIDTH } from './titlebar-metrics';
type SidebarPeekChange = (open: boolean, source: SidebarPeekSource) => void;
// Three 44px buttons plus the control container's 8px padding on each side.
const WINDOWS_TITLEBAR_CONTROLS_WIDTH = 148;
type TitleBarProps = {
integrated?: boolean;
workspaceLayout?: boolean;
@@ -123,10 +121,11 @@ function ProductTitleBar({
<div
data-testid="titlebar-logo"
className={cn(
'pointer-events-none absolute top-1/2 z-10 h-6 w-24 -translate-y-1/2 overflow-hidden',
'pointer-events-none absolute top-1/2 z-10 h-6 -translate-y-1/2 overflow-hidden',
overlay ? 'bg-transparent' : 'bg-background',
)}
style={{
width: TITLEBAR_LOGO_WIDTH,
right: `${windowControlsWidth}px`,
}}
>

View File

@@ -0,0 +1,4 @@
export const TITLEBAR_LOGO_WIDTH = 96;
// Three 44px buttons plus the control container's 8px padding on each side.
export const WINDOWS_TITLEBAR_CONTROLS_WIDTH = 148;

View File

@@ -20,6 +20,7 @@ import {
import { Input } from '@/components/ui/input';
import { cn } from '@/lib/utils';
import { useSettingsStore } from '@/stores/settings';
import { TITLEBAR_LOGO_WIDTH, WINDOWS_TITLEBAR_CONTROLS_WIDTH } from '@/components/layout/titlebar-metrics';
import type { ConversationSnapshot } from '@/types/coding-conversation';
import type { CodingConversationMetadata } from '@/types/coding-project';
@@ -110,7 +111,8 @@ export function CodingConversationHeader({
<header
className={cn(
'drag-region flex h-10 min-w-0 items-center gap-1 border-b border-border/80 px-3',
hasCustomTitleBar ? 'bg-transparent pr-40' : 'bg-background',
hasCustomTitleBar ? 'bg-transparent' : 'bg-background',
platform === 'darwin' && 'pr-40',
)}
data-testid="coding-conversation-header"
>
@@ -184,7 +186,11 @@ export function CodingConversationHeader({
<div
className="pointer-events-none fixed right-0 top-0 z-[80] h-10"
data-testid="coding-conversation-header-titlebar"
style={{ left: `${sidebarCollapsed ? WORKSPACE_COLUMN_WIDTH : WORKSPACE_COLUMN_WIDTH * 2}px` }}
style={{
left: `${sidebarCollapsed ? WORKSPACE_COLUMN_WIDTH : WORKSPACE_COLUMN_WIDTH * 2}px`,
// Keep both actions and their hit area outside the product chrome.
right: platform === 'win32' ? TITLEBAR_LOGO_WIDTH + WINDOWS_TITLEBAR_CONTROLS_WIDTH : 0,
}}
>
<div className="pointer-events-auto h-full">{header}</div>
</div>,