fix(web): keep composer add action attachment-only

This commit is contained in:
imccyu
2026-07-25 16:19:36 +08:00
parent 08ce02da2b
commit 468c64a078
3 changed files with 2 additions and 5 deletions

View File

@@ -73,7 +73,6 @@ export interface EmptyHeroProps {
status?: string status?: string
onDraftChange: (text: string) => void onDraftChange: (text: string) => void
onSend: (mode: 'queue' | 'steer') => void onSend: (mode: 'queue' | 'steer') => void
onAdd?: () => void
/** Overlay content after the stack (EmptyState's modals). */ /** Overlay content after the stack (EmptyState's modals). */
children?: ReactNode children?: ReactNode
} }
@@ -92,7 +91,6 @@ export function EmptyHero({
status, status,
onDraftChange, onDraftChange,
onSend, onSend,
onAdd,
children, children,
}: EmptyHeroProps) { }: EmptyHeroProps) {
// Stable filter id so multiple hero mounts do not collide in the DOM. // Stable filter id so multiple hero mounts do not collide in the DOM.
@@ -140,8 +138,6 @@ export function EmptyHero({
placeholder={placeholder ?? 'Describe what you want to build'} placeholder={placeholder ?? 'Describe what you want to build'}
onDraftChange={onDraftChange} onDraftChange={onDraftChange}
onSend={onSend} onSend={onSend}
{...(onAdd === undefined ? {} : { onAdd })}
addLabel="Create workspace"
/* v8 ignore next -- structural noop: hero never passes running=true, so stop is unreachable. */ /* v8 ignore next -- structural noop: hero never passes running=true, so stop is unreachable. */
onStop={() => {}} onStop={() => {}}
/> />

View File

@@ -72,7 +72,6 @@ export function EmptyState({
error={error} error={error}
onDraftChange={updateSessionPrompt} onDraftChange={updateSessionPrompt}
onSend={() => { sendSession() }} onSend={() => { sendSession() }}
onAdd={() => { setPickerOpen(true) }}
/> />
) )
} }

View File

@@ -72,6 +72,8 @@ describe('EmptyState', () => {
prompt: 'draft', phase: 'ready', prompt: 'draft', phase: 'ready',
}) })
expect(b.view.getByRole('button', { name: 'Choose workspace' }).textContent).toContain('workspace') expect(b.view.getByRole('button', { name: 'Choose workspace' }).textContent).toContain('workspace')
fireEvent.click(b.view.getByRole('button', { name: 'Add attachment' }))
expect((b.pickerOwner() as { open: boolean }).open).toBe(false)
fireEvent.change(b.view.getByPlaceholderText('Describe what you want to build'), { target: { value: 'build it' } }) fireEvent.change(b.view.getByPlaceholderText('Describe what you want to build'), { target: { value: 'build it' } })
expect(b.updateSessionPrompt).toHaveBeenCalledWith('build it') expect(b.updateSessionPrompt).toHaveBeenCalledWith('build it')
fireEvent.click(b.view.getByRole('button', { name: 'Send message' })) fireEvent.click(b.view.getByRole('button', { name: 'Send message' }))