fix: let the assistant sidebar use available width
The resizable assistant sidebar stopped at 640px even on wide windows, leaving result and workspace previews unnecessarily cramped. It now expands up to the viewport-derived limit while preserving at least 520px for the main workspace. Release note: 助手工作栏现在可在宽屏上拉伸到更大宽度,同时为主工作区保留至少 520 像素。
This commit is contained in:
@@ -67,7 +67,7 @@ function renderSidebar({
|
||||
}
|
||||
|
||||
describe('RightAssistantSidebar resizing', () => {
|
||||
it('resizes with pointer capture and clamps the resulting width', () => {
|
||||
it('resizes with pointer capture and preserves the minimum app width', () => {
|
||||
const sidebar = renderSidebar()
|
||||
const separator = screen.getByRole('separator', {
|
||||
name: '调整助手工作栏宽度'
|
||||
@@ -86,7 +86,7 @@ describe('RightAssistantSidebar resizing', () => {
|
||||
pointerId: 7
|
||||
})
|
||||
fireEvent.pointerMove(separator, {
|
||||
clientX: 600,
|
||||
clientX: 100,
|
||||
pointerId: 7
|
||||
})
|
||||
|
||||
@@ -94,7 +94,7 @@ describe('RightAssistantSidebar resizing', () => {
|
||||
expect(sidebar).toHaveClass('assistant-sidebar--resizing')
|
||||
expect(
|
||||
sidebar.style.getPropertyValue('--assistant-sidebar-width')
|
||||
).toBe('640px')
|
||||
).toBe('880px')
|
||||
|
||||
fireEvent.pointerUp(separator, { pointerId: 7 })
|
||||
expect(releasePointerCapture).toHaveBeenCalledWith(7)
|
||||
@@ -121,7 +121,7 @@ describe('RightAssistantSidebar resizing', () => {
|
||||
fireEvent.keyDown(separator, { key: 'End' })
|
||||
expect(
|
||||
sidebar.style.getPropertyValue('--assistant-sidebar-width')
|
||||
).toBe('640px')
|
||||
).toBe('880px')
|
||||
})
|
||||
|
||||
it('remains resizable when the sidebar overlays a medium window', () => {
|
||||
|
||||
@@ -114,7 +114,6 @@ const tabIds: AssistantSidebarTab[] = [
|
||||
const emptyChangedFiles: WorkspaceChanges['files'] = []
|
||||
const defaultSidebarWidth = 350
|
||||
const minimumSidebarWidth = 300
|
||||
const maximumSidebarWidth = 640
|
||||
const minimumRemainingAppWidth = 520
|
||||
const compactSidebarBreakpoint = 720
|
||||
const keyboardResizeStep = 16
|
||||
@@ -126,11 +125,8 @@ function getSidebarWidthLimits(viewportWidth: number): {
|
||||
minimum: minimumSidebarWidth,
|
||||
maximum: Math.max(
|
||||
minimumSidebarWidth,
|
||||
Math.min(
|
||||
maximumSidebarWidth,
|
||||
viewportWidth - minimumRemainingAppWidth
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user