mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-29 16:03:34 +08:00
fix(desktop): align conversation content with composer #782
This commit is contained in:
parent
96fa164cb1
commit
5d3c126d50
@ -403,13 +403,13 @@ describe('MessageList nested tool calls', () => {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
render(<MessageList />)
|
const { rerender } = render(<MessageList />)
|
||||||
const messageList = screen.getByTestId('message-list')
|
const messageList = screen.getByTestId('message-list')
|
||||||
const scroller = messageList.querySelector('.chat-scroll-area') as HTMLElement
|
const scroller = messageList.querySelector('.chat-scroll-area') as HTMLElement
|
||||||
const layoutObserver = observers.find(({ targets }) => targets.includes(messageList))
|
const layoutObserver = observers.find(({ targets }) => targets.includes(messageList))
|
||||||
expect(layoutObserver).toBeTruthy()
|
expect(layoutObserver).toBeTruthy()
|
||||||
expect(screen.getByTestId('conversation-navigator').getAttribute('data-mode')).toBe('full')
|
expect(screen.getByTestId('conversation-navigator').getAttribute('data-mode')).toBe('full')
|
||||||
expect(scroller.className.split(/\s+/)).toContain('pl-20')
|
expect(scroller.className.split(/\s+/)).toContain('px-20')
|
||||||
|
|
||||||
const resizeTo = (width: number) => {
|
const resizeTo = (width: number) => {
|
||||||
act(() => {
|
act(() => {
|
||||||
@ -422,20 +422,29 @@ describe('MessageList nested tool calls', () => {
|
|||||||
|
|
||||||
resizeTo(900)
|
resizeTo(900)
|
||||||
expect(screen.getByTestId('conversation-navigator').getAttribute('data-mode')).toBe('compact')
|
expect(screen.getByTestId('conversation-navigator').getAttribute('data-mode')).toBe('compact')
|
||||||
expect(scroller.className.split(/\s+/)).toContain('pl-12')
|
expect(scroller.className.split(/\s+/)).toContain('px-12')
|
||||||
|
|
||||||
resizeTo(640)
|
resizeTo(640)
|
||||||
expect(screen.getByTestId('conversation-navigator').getAttribute('data-mode')).toBe('compact')
|
expect(screen.getByTestId('conversation-navigator').getAttribute('data-mode')).toBe('compact')
|
||||||
|
|
||||||
resizeTo(520)
|
resizeTo(520)
|
||||||
expect(screen.getByTestId('conversation-navigator').getAttribute('data-mode')).toBe('edge')
|
expect(screen.getByTestId('conversation-navigator').getAttribute('data-mode')).toBe('edge')
|
||||||
expect(scroller.className.split(/\s+/)).toContain('pl-7')
|
expect(scroller.className.split(/\s+/)).toContain('px-7')
|
||||||
|
|
||||||
resizeTo(1000)
|
resizeTo(1000)
|
||||||
expect(screen.getByTestId('conversation-navigator').getAttribute('data-mode')).toBe('full')
|
expect(screen.getByTestId('conversation-navigator').getAttribute('data-mode')).toBe('full')
|
||||||
expect(scroller.className.split(/\s+/)).toContain('pl-20')
|
expect(scroller.className.split(/\s+/)).toContain('px-20')
|
||||||
expect(scroller.className.split(/\s+/)).not.toContain('pl-12')
|
expect(scroller.className.split(/\s+/)).not.toContain('px-12')
|
||||||
expect(scroller.className.split(/\s+/)).not.toContain('pl-7')
|
expect(scroller.className.split(/\s+/)).not.toContain('px-7')
|
||||||
|
|
||||||
|
rerender(<MessageList compact />)
|
||||||
|
expect(scroller.className.split(/\s+/)).toContain('px-20')
|
||||||
|
|
||||||
|
resizeTo(900)
|
||||||
|
expect(scroller.className.split(/\s+/)).toContain('px-12')
|
||||||
|
|
||||||
|
resizeTo(520)
|
||||||
|
expect(scroller.className.split(/\s+/)).toContain('px-7')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('updates the active conversation marker while the transcript scrolls', () => {
|
it('updates the active conversation marker while the transcript scrolls', () => {
|
||||||
|
|||||||
@ -1957,18 +1957,18 @@ export function MessageList({ sessionId, compact = false }: MessageListProps = {
|
|||||||
conversationNavigationItems.length >= CONVERSATION_NAVIGATION_MIN_ITEMS
|
conversationNavigationItems.length >= CONVERSATION_NAVIGATION_MIN_ITEMS
|
||||||
const chatScrollPaddingClass = compact
|
const chatScrollPaddingClass = compact
|
||||||
? showConversationNavigator && conversationNavigationMode === 'full'
|
? showConversationNavigator && conversationNavigationMode === 'full'
|
||||||
? 'pb-5 pl-20 pr-3 py-3'
|
? 'pb-5 px-20 py-3'
|
||||||
: showConversationNavigator && conversationNavigationMode === 'compact'
|
: showConversationNavigator && conversationNavigationMode === 'compact'
|
||||||
? 'pb-5 pl-12 pr-3 py-3'
|
? 'pb-5 px-12 py-3'
|
||||||
: showConversationNavigator && conversationNavigationMode === 'edge'
|
: showConversationNavigator && conversationNavigationMode === 'edge'
|
||||||
? 'pb-5 pl-7 pr-3 py-3'
|
? 'pb-5 px-7 py-3'
|
||||||
: 'px-3 py-3 pb-5'
|
: 'px-3 py-3 pb-5'
|
||||||
: showConversationNavigator && conversationNavigationMode === 'full'
|
: showConversationNavigator && conversationNavigationMode === 'full'
|
||||||
? 'pl-20 pr-4 py-4'
|
? 'px-20 py-4'
|
||||||
: showConversationNavigator && conversationNavigationMode === 'compact'
|
: showConversationNavigator && conversationNavigationMode === 'compact'
|
||||||
? 'pl-12 pr-4 py-4'
|
? 'px-12 py-4'
|
||||||
: showConversationNavigator && conversationNavigationMode === 'edge'
|
: showConversationNavigator && conversationNavigationMode === 'edge'
|
||||||
? 'pl-7 pr-4 py-4'
|
? 'px-7 py-4'
|
||||||
: 'px-4 py-4'
|
: 'px-4 py-4'
|
||||||
const confirmTurnCard = useMemo(
|
const confirmTurnCard = useMemo(
|
||||||
() => visibleTurnChangeCards.find((card) => card.target.messageId === turnUndoConfirmTargetId) ?? null,
|
() => visibleTurnChangeCards.find((card) => card.target.messageId === turnUndoConfirmTargetId) ?? null,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user