Skip to content

Commit edcf1d2

Browse files
committed
fix(mothership): icon fallback behind video preview
1 parent b089151 commit edcf1d2

2 files changed

Lines changed: 32 additions & 14 deletions

File tree

apps/sim/app/workspace/[workspaceId]/home/components/chat-message-attachments.tsx

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,29 @@ export function ChatMessageAttachments(props: {
3636
)
3737
}
3838
const isVideo = att.media_type.startsWith('video/')
39-
return (
40-
<div key={att.id} className='h-[56px] w-[56px] overflow-hidden rounded-[8px]'>
41-
{isVideo ? (
39+
if (isVideo) {
40+
const Icon = getDocumentIcon(att.media_type, att.filename)
41+
return (
42+
<div
43+
key={att.id}
44+
className='relative h-[56px] w-[56px] overflow-hidden rounded-[8px] bg-[var(--surface-5)]'
45+
>
46+
<div className='absolute inset-0 flex items-center justify-center text-[var(--text-icon)]'>
47+
<Icon className='h-[18px] w-[18px]' />
48+
</div>
4249
<video
4350
src={att.previewUrl}
4451
muted
4552
playsInline
4653
preload='metadata'
47-
className='h-full w-full object-cover'
54+
className='relative h-full w-full object-cover'
4855
/>
49-
) : (
50-
<img src={att.previewUrl} alt={att.filename} className='h-full w-full object-cover' />
51-
)}
56+
</div>
57+
)
58+
}
59+
return (
60+
<div key={att.id} className='h-[56px] w-[56px] overflow-hidden rounded-[8px]'>
61+
<img src={att.previewUrl} alt={att.filename} className='h-full w-full object-cover' />
5262
</div>
5363
)
5464
})}

apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/attached-files-list.tsx

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,21 @@ export const AttachedFilesList = React.memo(function AttachedFilesList({
3232
onClick={() => onFileClick(file)}
3333
>
3434
{hasPreview && isVideo ? (
35-
<video
36-
src={file.previewUrl}
37-
muted
38-
playsInline
39-
preload='metadata'
40-
className='h-full w-full object-cover'
41-
/>
35+
<>
36+
<div className='absolute inset-0 flex items-center justify-center text-[var(--text-icon)]'>
37+
{(() => {
38+
const Icon = getDocumentIcon(file.type, file.name)
39+
return <Icon className='h-[18px] w-[18px]' />
40+
})()}
41+
</div>
42+
<video
43+
src={file.previewUrl}
44+
muted
45+
playsInline
46+
preload='metadata'
47+
className='relative h-full w-full object-cover'
48+
/>
49+
</>
4250
) : hasPreview ? (
4351
<img
4452
src={file.previewUrl}

0 commit comments

Comments
 (0)