Skip to content

Commit dbc5850

Browse files
BillLeoutsakosvl346Bill Leoutsakos
andauthored
improvement(ui): share public chat composer actions (#8075)
Co-authored-by: Bill Leoutsakos <billleoutsakos@Mac.localdomain>
1 parent 607b613 commit dbc5850

2 files changed

Lines changed: 24 additions & 9 deletions

File tree

‎apps/sim/app/(interfaces)/chat/components/input/input.tsx‎

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { ArrowUp, Paperclip, StopFilled, X } from '@sim/emcn/icons'
77
import { createLogger } from '@sim/logger'
88
import { generateId } from '@sim/utils/id'
99
import { CHAT_ACCEPT_ATTRIBUTE } from '@/lib/uploads/utils/validation'
10+
import { PublicChatActionButton } from '@/app/(interfaces)/chat/components/input/public-chat-action-button'
1011

1112
const logger = createLogger('ChatInput')
1213

@@ -221,15 +222,14 @@ export const ChatInput: React.FC<{
221222
<div>
222223
<Tooltip.Root>
223224
<Tooltip.Trigger asChild>
224-
<Button
225+
<PublicChatActionButton
225226
aria-label='Attach files'
226227
variant='quiet'
227228
onClick={() => fileInputRef.current?.click()}
228229
disabled={isStreaming || attachedFiles.length >= 15}
229-
className='size-[28px] rounded-full p-0'
230230
>
231231
<Paperclip className='size-[16px]' />
232-
</Button>
232+
</PublicChatActionButton>
233233
</Tooltip.Trigger>
234234
<Tooltip.Content side='top'>
235235
<p>Attach files</p>
@@ -252,24 +252,22 @@ export const ChatInput: React.FC<{
252252

253253
<div className='flex items-center gap-1.5'>
254254
{isStreaming ? (
255-
<Button
255+
<PublicChatActionButton
256256
variant='primary'
257257
onClick={onStopStreaming}
258-
className='size-[28px] rounded-full p-0'
259258
aria-label='Stop generation'
260259
>
261260
<StopFilled className='block size-[14px] fill-current' />
262-
</Button>
261+
</PublicChatActionButton>
263262
) : (
264-
<Button
263+
<PublicChatActionButton
265264
variant='primary'
266265
onClick={handleSubmit}
267266
disabled={!canSubmit}
268267
aria-label='Send message'
269-
className='size-[28px] rounded-full p-0'
270268
>
271269
<ArrowUp className='block size-[16px]' />
272-
</Button>
270+
</PublicChatActionButton>
273271
)}
274272
</div>
275273
</div>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { type ComponentProps, forwardRef } from 'react'
2+
import { Button } from '@sim/emcn'
3+
4+
interface PublicChatActionButtonProps
5+
extends Omit<
6+
ComponentProps<typeof Button>,
7+
'variant' | 'size' | 'iconSize' | 'iconPadding' | 'className'
8+
> {
9+
variant: 'primary' | 'quiet'
10+
'aria-label': string
11+
}
12+
13+
/** Public chat's circular composer action, retaining its primary and quiet palettes. */
14+
export const PublicChatActionButton = forwardRef<HTMLButtonElement, PublicChatActionButtonProps>(
15+
(props, ref) => <Button {...props} ref={ref} className='size-[28px] rounded-full p-0' />
16+
)
17+
PublicChatActionButton.displayName = 'PublicChatActionButton'

0 commit comments

Comments
 (0)