Skip to content

Commit cd39f33

Browse files
committed
fix(mobile): bound workflow attachments and await chat navigation
1 parent ea105b9 commit cd39f33

2 files changed

Lines changed: 23 additions & 5 deletions

File tree

‎apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/chat/chat.tsx‎

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ import {
1111
PopoverItem,
1212
PopoverScrollArea,
1313
PopoverTrigger,
14+
scrollFadeAttributes,
15+
scrollFadeClass,
1416
Tooltip,
1517
Trash,
18+
useScrollEdges,
1619
} from '@sim/emcn'
1720
import { ArrowUp, CircleAlert, Download, MoreVertical, Paperclip, Square, X } from '@sim/emcn/icons'
1821
import { createLogger } from '@sim/logger'
@@ -300,6 +303,7 @@ export function Chat() {
300303
const [moreMenuOpen, setMoreMenuOpen] = useState(false)
301304

302305
const inputRef = useRef<HTMLInputElement>(null)
306+
const attachmentsRef = useRef<HTMLDivElement>(null)
303307
const timeoutRef = useRef<NodeJS.Timeout | null>(null)
304308
const streamReaderRef = useRef<ReadableStreamDefaultReader<Uint8Array> | null>(null)
305309
const preventZoomRef = usePreventZoom()
@@ -318,6 +322,9 @@ export function Chat() {
318322
handleDragLeave,
319323
handleDrop,
320324
} = useChatFileUpload()
325+
const attachmentEdges = useScrollEdges(attachmentsRef, {
326+
enabled: isChatOpen && chatFiles.length > 0,
327+
})
321328

322329
/**
323330
* Resolves the unified start block for chat execution, if available.
@@ -1084,10 +1091,19 @@ export function Chat() {
10841091
>
10851092
{/* File thumbnails */}
10861093
{chatFiles.length > 0 && (
1087-
<div className='mt-1 flex flex-wrap gap-1.5'>
1088-
{chatFiles.map((file) => (
1089-
<ChatFilePreview key={file.id} file={file} onRemove={removeFile} />
1090-
))}
1094+
<div
1095+
ref={attachmentsRef}
1096+
className={cn(
1097+
'mt-1 pointer-coarse:max-h-[102px] pointer-coarse:overflow-y-auto pointer-coarse:overscroll-contain',
1098+
scrollFadeClass
1099+
)}
1100+
{...scrollFadeAttributes(attachmentEdges)}
1101+
>
1102+
<div className='flex flex-wrap gap-1.5'>
1103+
{chatFiles.map((file) => (
1104+
<ChatFilePreview key={file.id} file={file} onRemove={removeFile} />
1105+
))}
1106+
</div>
10911107
</div>
10921108
)}
10931109

‎apps/sim/scripts/test-mobile-e2e.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ async function exerciseViewport(
557557
`${prefix}/navigation opens, dismisses, and preserves desktop preferences`,
558558
page,
559559
async () => {
560-
await visit(page, 'home')
560+
await visit(page, 'files')
561561
const sidebar = page.getByRole('complementary', { name: 'Workspace sidebar' })
562562
const openNavigation = page.getByRole('button', { name: 'Open navigation', exact: true })
563563
await openNavigation.focus()
@@ -574,6 +574,8 @@ async function exerciseViewport(
574574
await expectContained(page, sidebar)
575575
if (viewport.name === 'phone') await capture(page, `${browserName}-phone-navigation`)
576576
await sidebar.getByRole('link', { name: 'New chat', exact: true }).tap()
577+
await expect(page).toHaveURL(`${baseUrl.origin}/workspace/${workspaceId}/home`)
578+
await expect(page.getByRole('textbox', { name: 'Message', exact: true })).toBeVisible()
577579
await expect(sidebar).toBeHidden()
578580
await page.getByRole('button', { name: 'Open navigation', exact: true }).tap()
579581
await page.getByRole('button', { name: 'Close navigation', exact: true }).tap()

0 commit comments

Comments
 (0)